Let your imagination run wild

Re: GCD and LCM

PostPosted by drab » Wed Oct 22, 2014 7:25 am

Please explain why rational numbers sometimes display with trailing underscores.
Posts: 289
Joined: Thu Oct 09, 2014 6:23 am

Re: GCD and LCM

PostPosted by FreeTrav » Wed Dec 17, 2014 2:38 pm

drab wrote:Please explain why rational numbers sometimes display with trailing underscores.

I'd ask you for some specific examples, just to be sure I'm understanding what you're seeing correctly, but if you're referring to the example from upthread, reading between the lines suggests that it's because []PP was set "too low" to display the number "accurately".
Posts: 7
Joined: Fri Dec 05, 2014 7:13 pm

Re: GCD and LCM

PostPosted by nars2000 » Wed Dec 17, 2014 7:00 pm

This behavior mimics that of ⎕FMT from the early days. For example,
Code: Select all
      'F22.0' ⎕fmt 1e20
where the trailing underscores indicate underflow, that is, the precision of the number (18 digits for IEEE-754 double precision numbers) is insufficient for the requested precision.

Also, ⎕FMT has a Symbol Substitution for the underscore as in S<_?> which (in this case) would substitute a ? for the default underflow character.

Underflow digits should not occur in the display of Rational numbers, but are used in certain cases when displaying VFP numbers such as
Code: Select all
      ⎕pp←40 ⋄ ⎕fpc←53
Here the precision of the VFP number is 53 bits (same as IEEE-754 numbers).
Site Admin
Posts: 2
Joined: Wed Jan 16, 2013 1:44 pm

Re: GCD and LCM

PostPosted by forummaster » Sun May 31, 2015 9:30 am

drab wrote:I was right about what it should be ...

2 ∧ ⎕←2+(⍳9)÷10x
21r10 11r5 23r10 12r5 5r2 13r5 27r10 14r5 29r10
42 22 46 12 10 26 54 14 58

You are quite correct! The problem was two-fold: I was using the built-in fmod instead of the APL version, and I was using a ⎕CT that was too small (3E¯15 instead of 1E¯10).
The fixed version may be found in the beta directory (http://www.nars2000.org/download/binaries/beta/).

At long last I'm ready to release a new version. Please let me know if you experience anything unusual with this beta version.
Posts: 545
Joined: Wed Jan 23, 2013 1:00 pm


Return to New Primitive Operators

Who is online

Users browsing this forum: No registered users and 0 guests