It looks like we have a reliable solution to find a fractional part of a
floating point number, while maintaining the sign:

    v

_2.375 _5.84615 _11.4 13.0028 13.0014 13 12.9986

    fp=. * * 1||    NB. Thanks to Martin

    fp v

_0.375 _0.846154 _0.4 0.0027933 0.00139082 0 0.998621


Credit should also go to the people who suggested the building blocks, e.g.

(1|y) Raul  --  (1||y) Pascal  --  (*y) Raul

It is also nice to have the companion verb - integer part:

    ip=: * * <.@|       NB. Thanks to Louis

    ip v

_2 _5 _11 13 13 13 12


I have needed these functions more than once in my enginering work. I
believe that these two verbs need to be inserted somewhere in the "Numbers"
section of the J Phrases doc. Maybe under "8A-Numbers & Counting", or
8C-Representations", or "8D-Arithmetic".


How do we get them in the document? What section do they fit the best in?
Can I edit the Phrases doc?

Skip Cave
Cave Consulting LLC



>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to