trailing underscores in display of numbers

It's All About Spacing and Positioning

trailing underscores in display of numbers

PostPosted by drab » Tue Oct 28, 2014 7:42 am

Please explain why you sometimes use trailing underscores in the display of numbers with long precision.

I have deduced that they usually stand for zeros, but I do not understand why or precisely when they are used.

I'm guessing that they appear when a number has higher precision that ⎕pp, but I can't find a definitive explanation in any of the documentation.

In what way are they better than just plain zeros?

There is at least one way in which they are worse -- they break datatype conversion because they are not executable:

⍎⍕⎕←10v*9
1000000000
1000000000

⍎⍕⎕←10v*10
1000000000_
VALUE ERROR
⍎ 1000000000_


I'm not saying that trailing underscores are necessarily a bad thing. If I knew the precise reason for them, then I might agree with it. But maybe you should also consider recognizing them in numeric input so they don't break ⍎⍕ .
drab
 
Posts: 315
Joined: Thu Oct 09, 2014 6:23 am

Re: trailing underscores in display of numbers

PostPosted by drab » Mon Feb 20, 2017 6:55 am

I never got an official answer to this question, but I have since deduced that it must mean "the end".

⎕fpc
128
10⍟2*128
38.53183944
38⍕1v
1.00000000000000000000000000000000000000
39⍕1v
1.00000000000000000000000000000000000000_
drab
 
Posts: 315
Joined: Thu Oct 09, 2014 6:23 am

Re: trailing underscores in display of numbers

PostPosted by forummaster » Mon Feb 20, 2017 10:49 am

drab wrote:I never got an official answer to this question, but I have since deduced that it must mean "the end".

⎕fpc
128
10⍟2*128
38.53183944
38⍕1v
1.00000000000000000000000000000000000000
39⍕1v
1.00000000000000000000000000000000000000_

Sorry for the late reply.

Trailing underscores in display indicate underflow. That is, there are more digits in the display, but the precision of the number as calculated (or to be displayed as per ⎕PP) isn't sufficient to tell us what they are.

I thought I had excised all underscores by various ploys such as switching to E-format, but this case appears to be a bug. It might take a while before I get around to this one as it doesn't appear to be pressing.
forummaster
 
Posts: 567
Joined: Wed Jan 23, 2013 1:00 pm


Return to Array Output

Who is online

Users browsing this forum: No registered users and 0 guests

cron