Boost logo

Boost :

Subject: Re: [boost] Interest in chained relational operations
From: Rahman Salim Zengin (rsz_at_[hidden])
Date: 2016-10-24 03:31:43


Repository:
https://github.com/rszengin/chain

Project structure is corrected.

On 22.10.2016 01:36, Edward Diener wrote:
> The syntax is baffling ...
Now, there are stricter rules. Only Ascending or Descending ordered
chaining is possible. Syntax is simply explained.

On 22.10.2016 11:53, Joaquin M López Muñoz wrote:
> ... using operator < to initiate the comparison chain looks arbitrary.
> Maybe operator <<
>
> cmp::chain << 0 < x <= 5
> ...
Now, operator "<<" is used to initiate Ascending comparison and operator
">>" is used to initiate Descending comparison.
> * As it stands, you're not detecting foul-smelling comparisons such as
>
> cmp::chain < x <= y >= z // not exactly wrong, but not the
> mathematical custom
Mixed ordered chaining is not allowed anymore.
> or (more importantly)
>
> cmp::chain < 5 <= y <= 0 // always false
> ...
For now, I could only achieved runtime detection. Working on it. Please
see the branch below.

https://github.com/rszengin/chain/tree/detect_always_false

On 22.10.2016 13:01, Klemens Morgenstern wrote:
> Considering that the actual use-cases are things like "x < y <= z" I'd
> rather think about this as a set of ternary operators.
> ...
I will consider that.
> Things like x < y > z wouldn't make that sense from a logical point of
> view - I'd just not allow them. ...
Not allowed anymore.
> ... But I'm not sure there are actually that much use cases; I'd think
> the main would be, to check if y is in the right
Perhaps.
> And then - to top it off - we could add comparisions with a tolerance ...
In SPICE simulators ABSTOL and RELTOL are parameters used to describe
tolerances. It may be:

x == y + abstol(eps) for absolute tolerance and x == y + reltol(eps) for
relative tolerance, which eps is epsilon.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk