|
|
On 2/17/23 20:49, Tor Olav Kristensen wrote:
>> Aside: You can use the 3 term select depending upon a boolean result in
>> the first term test by doing something like:
>>
>> select(1-(2*((x<0.0) | (x>1.0))), 0, 1)
>> ...
> How about just this:
>
> select(
> -((x < 0.0) | (1.0 < x)),
> 0,
> 1
> )
>
> - or this:
>
> select(
> -((0.0 <= x) & (x <= 1.0)),
> 1,
> 0
> )
:-)
Very likely OK in practice, and cleaner in form than my three term select.
What spooks me some is that -0 and +0 are real things in the IEEE
floating point standard and as supported by C++. If a C++ coder has
thought to test for -0 < 0, they can.
Bill P.
Post a reply to this message
|
|