Surely integer 999...9 is a better value than 1000...0 .

Henry Rich

On Aug 9, 2017 18:33, "Raul Miller" <rauldmil...@gmail.com> wrote:

> It's not a bug, it's an artifact of the 64 bit floating point standard.
>
>    2 ^.9999999999999999
> 53.1508
>
> https://en.wikipedia.org/wiki/IEEE_754#Basic_and_interchange_formats
>
> The binary64 format has 53 binary digits or 15.95 decimal digits. This
> means ".16#'9' cannot be represented exactly using this format.
>
> And, we do not use exact representation of large numbers by default
> because that's too slow for large datasets. Put differently, if you
> want exact representation and are willing to take the performance hit,
> you should specify that. For example: ".'x',~16#'9' or
> ".'3r10+','x',~16#'9'
>
> Thanks,
>
> --
> Raul
>
> On Wed, Aug 9, 2017 at 12:05 PM, Henry Rich <henryhr...@gmail.com> wrote:
> > This is a bug,  since 999...9.3 should become 999...9 rather than
> 100...0.
> > I'm away from home now,  but I think what's happening is this:
> >
> > 999...9 is converted to integer
> >
> > . is encountered and turns it to float
> >
> > It's rounded to the nearest float which is 100...0
> >
> > As a final step the JE checks to see if the value is exactly integral,
> > which it is,  and it is converted back to integer.
> >
> > If you add this to Interpreter/Bugs I'll fix it when i get back.
> >
> > Henry Rich
> >
> > On Aug 9, 2017 16:16, "bill lam" <bbill....@gmail.com> wrote:
> >
> > I think this is the difference between 32 and 64-bit,
> >
> >    9!:14''
> > j602/2008-03-03/16:45
> >    3!:0[ 9999999999999999.3
> > 4
> >
> > In J32
> >
> >    a.i. 2 fc 9999999999999999.3
> > 0 128 224 55 121 195 65 67
> >    a.i. 2 fc 1e16
> > 0 128 224 55 121 195 65 67
> >
> > the number has the same bit pattern as 1e16 (an integer)
> > which can be represented as a 64-bit integer. I guess
> > J64 is correct since 9999999999999999.3 and 1e16 is the
> > same number in ieee fp and J prefers integer to floats,
> > eg
> >   3!:0 [ 2.0
> > 4
> >
> > Ср, 09 авг 2017, robert therriault написал(а):
> >> Hi Pascal,
> >>
> >> I see the same behaviour in j806 as j805. Do you see something
> different?
> >>
> >>     JVERSION
> >> Engine: j806/j64avx/darwin
> >> Beta-4: commercial/2017-06-27T12:55:06
> >> Library: 8.06.03
> >> Qt IDE: 1.5.3/5.6.2
> >> Platform: Darwin 64
> >> Installer: J806 install
> >> InstallPath: /users/bobtherriault/j64-806
> >> Contact: www.jsoftware.com
> >>    (; datatype) 999999999999999.3
> >> ┌────┬────────┐
> >> │1e15│floating│
> >> └────┴────────┘
> >>    (; datatype) 9999999999999999.3
> >> ┌─────────────────┬───────┐
> >> │10000000000000000│integer│
> >> └─────────────────┴───────┘
> >>    (; datatype) 99999999999999999.3
> >> ┌──────────────────┬───────┐
> >> │100000000000000000│integer│
> >> └──────────────────┴───────┘
> >>    (; datatype) 999999999999999999.3
> >> ┌───────────────────┬───────┐
> >> │1000000000000000000│integer│
> >> └───────────────────┴───────┘
> >>    (; datatype) 9999999999999999999.3
> >> ┌────┬────────┐
> >> │1e19│floating│
> >> └────┴────────┘
> >>
> >> Cheers, bob
> >>
> >> > On Aug 9, 2017, at 7:54 AM, 'Pascal Jasmin' via Programming <
> > programm...@jsoftware.com> wrote:
> >> >
> >> > in j806,    9999999999999999.310000000000000000 probably the j805
> > behaviour is preferred.  If only for consistency.  But there may be a
> good
> > reason for change.
> >> >
> >> >      From: robert therriault <bobtherria...@mac.com>
> >> > To: Programming forum <programm...@jsoftware.com>
> >> > Sent: Wednesday, August 9, 2017 10:40 AM
> >> > Subject: [Jprogramming] Integer-floating type change for large numbers
> > in j805 and j806
> >> >
> >> > I am guessing that the following has something to do with precision of
> > large numbers in j805 and is also true for j806.
> >> >
> >> >   (; datatype) 999999999999999.3
> >> > ┌────┬────────┐
> >> > │1e15│floating│
> >> > └────┴────────┘
> >> >   (; datatype) 9999999999999999.3
> >> > ┌─────────────────┬───────┐
> >> > │10000000000000000│integer│
> >> > └─────────────────┴───────┘
> >> >   (; datatype) 99999999999999999.3
> >> > ┌──────────────────┬───────┐
> >> > │100000000000000000│integer│
> >> > └──────────────────┴───────┘
> >> >   (; datatype) 999999999999999999.3
> >> > ┌───────────────────┬───────┐
> >> > │1000000000000000000│integer│
> >> > └───────────────────┴───────┘
> >> >   (; datatype) 9999999999999999999.3
> >> > ┌────┬────────┐
> >> > │1e19│floating│
> >> > └────┴────────┘
> >> >   JVERSION
> >> > Engine: j805/j64/darwin
> >> > Release: commercial/2016-12-11T08:17:56
> >> > Library: 8.05.14
> >> > Qt IDE: 1.5.4/5.6.2
> >> > Platform: Darwin 64
> >> > Installer: J805 install
> >> > InstallPath: /applications/j64-805
> >> > Contact: www.jsoftware.com
> >> >
> >> > Further investigation shows me it was not this way with the 32 bit
> > version of j701, so it may be an artifact of moving to 64 bit?
> >> >
> >> >       (; datatype) 999999999999999.3
> >> > ┌────┬────────┐
> >> > │1e15│floating│
> >> > └────┴────────┘
> >> >   (; datatype) 9999999999999999.3
> >> > ┌────┬────────┐
> >> > │1e16│floating│
> >> > └────┴────────┘
> >> >   (; datatype) 999999999999999999.3
> >> > ┌────┬────────┐
> >> > │1e18│floating│
> >> > └────┴────────┘
> >> >   (; datatype) 9999999999999999999.3
> >> > ┌────┬────────┐
> >> > │1e19│floating│
> >> > └────┴────────┘
> >> >   JVERSION
> >> > Engine: j701/2011-01-10/11:25
> >> > Library: 7.01.088
> >> > Platform: Darwin 32
> >> > Installer: j701a_mac_intel.dmg
> >> > InstallPath: /Applications/j701
> >> >
> >> > Cheers, bob
> >> >
> >> >
> >> >
> >> > ------------------------------------------------------------
> ----------
> >> > For information about J forums see http://www.jsoftware.com/
> forums.htm
> >> >
> >> >
> >> > ------------------------------------------------------------
> ----------
> >> > For information about J forums see http://www.jsoftware.com/
> forums.htm
> >>
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >
> > --
> > regards,
> > ====================================================
> > GPG key 1024D/4434BAB3 2008-08-24
> > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> > gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to