jsoftware / jsource

J engine source mirror
Other
645 stars 91 forks source link

A proposal to implement a negative zeros detector #182

Closed jip closed 5 months ago

jip commented 5 months ago

It would be nice to have a foreign to detect negative zeros:

   dat=. _ _0.0 _. 1 __ 0 _.

   128!:N dat
0 1 0 0 0 0 0
   128!:N < dat
1

where N is some integer. Just as we detect NaNs:

   128!:5 dat
0 0 1 0 0 1
   128!:5 < dat
1

Of course, such a facility can be implemented via foreigns 3!:2 and 3!:3. So, non-critical.

moon-chilled commented 5 months ago

__ = %

jip commented 5 months ago

Yep! Thank you.