The negative zero makes comparison using integer instructions a chore.

Henry Rich

On 9/25/2021 5:03 PM, Raul Miller wrote:
An interesting, perhaps non-obvious issue here, is:

Why do floating point numbers have 2^53 as their limiting value when
there's only 52 bits of mantissa?

It's because an implied leading 1 digit is always assumed for non-zero
floating point numbers, so it's not represented in the mantissa bits.

(This is spelled out in the page I linked, in the paragraph
immediately above the diagram which shows the layout of the bits. But
it's easy to miss if you are quickly skimming over the content.)

There's other interesting quirks of this format (like: integer less
than and greater than mechanisms can be used when comparing floating
point values). Some people put real thought into it.

FYI,

--
Raul

On Sat, Sep 25, 2021 at 4:52 PM Raul Miller <rauldmil...@gmail.com> wrote:
Actually, I think the limit value for raw integers is

    2^63x
9223372036854775808

Because we use signed integer values, so one bit is reserved for
distinguishing positive and negative values.

(Technically, it's going to be one less than that for positive
integers and exactly that for negative integers, because we also have
to represent the value 0.)

And, once that's exceeded, we use
https://en.wikipedia.org/wiki/Double-precision_floating-point_format#IEEE_754_double-precision_binary_floating-point_format:_binary64
which means that the mantissa's precision is limited to

    x:2^53
9007199254740992

So ... intermediate results arrived at using different numbers are
likely going to be different.

FYI,

--
Raul

On Sat, Sep 25, 2021 at 4:44 PM Henry Rich <henryhr...@gmail.com> wrote:
     2^64x
18446744073709551616

135301852344706760704

Henry Rich


On 9/25/2021 4:32 PM, Skip Cave wrote:
From: https://code.jsoftware.com/wiki/Essays/Fibonacci_Sequence

f0b=: (-&2 +&$: -&1) ^: (1&<) M.

f2a=: 3 : '{. +/\@|.^:y 0 1x'

x:f0b 98

135301852344706760704

x:f2a 98

135301852344706746049


(x:f0b 98) -: x:f2a 98

0


Why the discrepancy?


Skip


Skip Cave
Cave Consulting LLC
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

--
This email has been checked for viruses by AVG.
https://www.avg.com

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


--
This email has been checked for viruses by AVG.
https://www.avg.com

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

Reply via email to