bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-apl] Useful range of decode function is limited.


From: Frederick H. Pitts
Subject: [Bug-apl] Useful range of decode function is limited.
Date: Mon, 04 Aug 2014 20:37:48 -0500

Juergen,

        Please consider the following:

      ( 62 ⍴ 2 ) ⊤ ⎕ ← 2 ⊥ 53 ⍴ 1
9007199254740991
0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      ( 62 ⍴ 2 ) ⊤ ⎕ ← 2 ⊥ 54 ⍴ 1
18014398509481984
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 
      0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

        Between 53 bits and 54 bits, decode starts returning an incorrect
result (the reported value is even when it should be odd).  Presumably
floating point numbers start creeping in at that point.
        Is it possible to tweak the decode code so that at least 62 bits of a
64-bit integer are usable with encode and decode?  I'd really like to
use 9 7-bit fields (63 bit total) to track powers of dimensions in
unit-of-measure calculations but I'm confident that is asking for too
much. I can cut the range of one of the dimensions in half.

        BTW, the "smallest (negative) integer" label of the ⎕SYL output would
read better as "largest negative integer".  ¯9200000000000000000 is not
small.
¯1, 0, and 1 are small.

Regards,

Fred
Retired Chemical Engineer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]