Many thanks to John and Raul,
for simplicity I can summarise that
smallest is 2^_1074
just <1  is 0.9999999999999999 (which =(!.0) 0.99999999999999988898)
it only remains that the largest number needs a more complicated calculation.


John Randall wrote:
Raul Miller wrote:
On 4/10/07, John Randall <[EMAIL PROTECTED]> wrote:
NB. smallest positive
   value 1 1 0
2.22507e_308
You did not consider denormalized numbers
   _2{-:^:a: 1
4.94066e_324


You're right: my value function assumes normalization.

NB. largest positive
   value 1,2046,#. 52#1
1.79769e308
That's what I got, too.

NB. largest less than 1
    0j20":   value 1 1022,#. 52#1
0.99999999999999988898
I got a  different answer
   0j20":_2{unq]1--:^:a: 1
0.99999999999999989000

But when I execute your expression I get yet another answer:
   value 1 1022,#. 52#1
0.5

This is a difference between 32-bit and 64-bit J: #. 52 #1 is a valid
64-bit integer but not a valid 32-bit integer.  The result I quoted was
done with J64: I get the same incorrect value in J32.

What I am trying to get at is the binary fraction .1111....1111 where
there are 53 1's.  Unless I am misunderstanding the IEEE 754 standard,
this is the largest double not greater than 1.

Doing calculations rather than working with bit patterns may introduce
roundoff error.  I was too lazy to manipulate the bits directly.

Best wishes,

John

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



--
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to