Discussion:
[Bug-apl] E in number printing style (scientific notation)
Ala'a Mohammad
2017-07-20 20:05:47 UTC
Permalink
Hi,

Is it possible to control when the interpreter uses the 'E' or display
the number without it? I know of quad print precision, but it did not
affect the printing of notation used for displaying these numbers when
I played with it.

I'm asking this because on one side I understand that this notation
helps when having very big or very small numbers, but on the other
hand it confuses me (rather than help) when numbers are in the middle
of the range (for example 1j10, or 24) and they are displayed with 'E'
(i.e. 1J1E1 or 2.4E1). The second example was notable when I was
trying the quad SQL functionality querying a table from a sample
database.

Regards,

Ala'a
Juergen Sauermann
2017-07-20 20:55:31 UTC
Permalink
Hi Ala'a

you cant control it. The rules when the E-notation is to be used is
described in the IBM APL2 language reference, page 13. So there is little
that can be changed without violating that reference.

However, you may want to have look at dyadic ⍕ (called Format by example and
Format by specification) which gives you some more control over the number
format (page 139 ff.)

/// Jürgen
Post by Ala'a Mohammad
Hi,
Is it possible to control when the interpreter uses the 'E' or display
the number without it? I know of quad print precision, but it did not
affect the printing of notation used for displaying these numbers when
I played with it.
I'm asking this because on one side I understand that this notation
helps when having very big or very small numbers, but on the other
hand it confuses me (rather than help) when numbers are in the middle
of the range (for example 1j10, or 24) and they are displayed with 'E'
(i.e. 1J1E1 or 2.4E1). The second example was notable when I was
trying the quad SQL functionality querying a table from a sample
database.
Regards,
Ala'a
Continue reading on narkive:
Loading...