Viktor Cerovski wrote: 
> More  precisely, if you have M-bits of mantissa, your integer should be
> 2^M .

D'oh!  Of course.  Thank you.

>  Since dlamch reports that it sees 53 bits, that means your integer 
>  should be somewhere near 1e16.  But it is not according to the test!

This is probably be due to J's tolerance.  Which, according to:

    http://www.jsoftware.com/help/dictionary/d000.htm

defaults to  2^_44  .  Your tests seem to support this conclusion:

>     two=:1%0.5
>     (= >:)two^43
>  0
>     (= >:)two^44
>  1

as do these:

          (=!.0 >:)two^43
        0
          (=!.0 >:)two^44
        0
          
Further tests more or less agree with your Lisp examples:

          (=!.0 >:)two^52
        0
          (=!.0 >:)two^53
        1

>  $ clisp -q
>  [1]> (defun test(x)(=(- x 1.0d0)x))
>  TEST
>  [2]> (test(expt 2.0d0 53))
>  NIL
>  [3]> (test(expt 2.0d0 54))
>  T

But I don't know why J's answer changes at  two^53  yet Lisp's at 2^54  . 
Maybe the FP representation of   1%0.5  in J isn't the same as  2.0d0  in
Lisp.

-Dan
-- 
View this message in context: 
http://www.nabble.com/Format-fractional-hexadecimal-tf4895825s24193.html#a14085632
Sent from the J Programming mailing list archive at Nabble.com.

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

Reply via email to