It appears that Intel supports quad iee 128. How available is this in other microprocessors as well? Any thoughts of this in J?
On Sep 8, 2017 11:50 AM, "Jimmy Gauvin" <jimmy.gau...@gmail.com> wrote: > Hi, > > I was curious how J's cousin, APL, deals with this. > So I used Dyalog APL (Version: 15.0.27982.0 64 Unicode) and got a > surprising result: > > ⍪(¯4 ¯3 ¯2 ¯1 0 1 2 3 4+14*2) | 5729082486784839 > 0 > 0 > 0 > 0 > 0 > 104 > 0 > 113 > 0 > > Changing from IEE-754 64-bit to IEE-754-2008 128-bit floating point > representation corrects the problem > ⎕FR > 645 > ⎕FR←1287 > > ⍪(¯4 ¯3 ¯2 ¯1 0 1 2 3 4+14*2) | 5729082486784839 > 135 > 146 > 23 > 39 > 147 > 104 > 171 > 113 > 39 > > Jimmy > > PS > I guess a manual for beginners should have some sort of warning > paragraph/blurb about the perils of numerical computations (and the good > habits of verifying our results just like we were taught in elementary > school). > > PPS for history buffs > Back in the older days, Burroughs computer had modulo-3 checking of > arithmetic operations > http://bitsavers.trailing-edge.com/pdf/burroughs/BSP/ > BSP_Floating_Point_Processor.pdf > http://www.acsel-lab.com/arithmetic/arith4/papers/ARITH4_Gajski.pdf > > > On Fri, Sep 8, 2017 at 9:21 AM, Erling Hellenäs <erl...@erlinghellenas.se> > wrote: > > > Hi all ! > > > > It seems an IEEE double can hold this value without lost precision. I > > don't know what might happen in the calculations. Where the precision is > > lost. Maybe something with comparison tolerance. > > > > 5729082486784839 - 5729082486784839 - 0.999 > > > > 1 > > > > > > JWithATwist does not lose precision. Here with integer and float right > > argument. > > > > > > { ( 14 ^ 2 ) {! ] - [ * |<. ] % [ } 1.0 * 5729082486784839 } > > 147 > > { ( 14 ^ 2 ) {! ] - [ * |<. ] % [ } 5729082486784839 } > > 147 > > > > > > Cheers, > > > > > > Erling Hellenäs > > > > > > > > Den 2017-09-08 kl. 13:19, skrev Erling Hellenäs: > > > >> Case 3 seems to be working in the latest Beta(8.06.03). The problem > seems > >> to be solved. /Erling > >> > >> 3!:0 (x: n^2) > >> > >> 128 > >> > >> (x: n^2) | 5729082486784839 > >> > >> 147 > >> > >> 3!:0 (x: n^2) > >> > >> 128 > >> > >> > >> Den 2017-09-07 kl. 20:40, skrev Erling Hellenäs: > >> > >>> Hi all ! > >>> > >>> Case 1: > >>> 3!:0 [ (n^2) > >>> > >>> 8 > >>> > >>> (n^2) | 5729082486784839 > >>> > >>> 0 > >>> > >>> It is non-intuitive that an integer raised to an integer is a float, > but > >>> I think it is normal. It would be possible with a performance penalty > to > >>> get an integer result. One problem with that is that it would easily > >>> overflow. It would also be possible to have a special operation for > this > >>> case. > >>> When the left argument is a float the right argument has to be > converted > >>> to a float. It must be assumed that this conversion is intentional, > even > >>> though it is implicit. > >>> > >>> Case 2: > >>> 3!:0 [ (n^2) > >>> > >>> 8 > >>> > >>> (n^2) | 5729082486784839x > >>> > >>> 0 > >>> > >>> 3!:0 (n^2) | 5729082486784839x > >>> > >>> 8 > >>> > >>> Here the rational seems to be converted to a float and the result is > >>> float. Shouldn't we have an error instead of converting rationals to > float? > >>> > >>> Case 3: > >>> > >>> 3!:0 (x: n^2) > >>> > >>> 128 > >>> > >>> (x: n^2) | 5729082486784839 > >>> > >>> 0 > >>> > >>> 3!:0 (x: n^2) | 5729082486784839 > >>> > >>> 128 > >>> > >>> I have a hard time understanding what happens here. This result seems > >>> very peculiar. Is the left and right argument converted to float and > the > >>> float result converted to rational?! > >>> Shouldn't we have an error instead of converting rationals to float? > >>> We could not have floats auto-converted to rationals? > >>> In this case the integer should be converted to rational and we should > >>> get a rational result? > >>> > >>> It is non-intuitive that (*: n) does not give the same result as (n^2). > >>> Maybe once this was decided because of performance reasons. > >>> > >>> Cheers, > >>> > >>> Erling Hellenäs > >>> > >>> On 2017-09-05 18:41, Rob B wrote: > >>> > >>>> Could someone explain this please? > >>>> > >>>> n=.14 > >>>> n > >>>> 14 > >>>> (*: n) | 5729082486784839 > >>>> 147 > >>>> 196 | 5729082486784839 > >>>> 147 > >>>> (n^2) | 5729082486784839 > >>>> 0 > >>>> (n^2) | 5729082486784839x > >>>> 0 > >>>> (x: n^2) | 5729082486784839 > >>>> 0 > >>>> (x: n^2) | 5729082486784839x > >>>> 147 > >>>> > >>>> > >>>> Regards, Rob Burns > >>>> ------------------------------------------------------------ > ---------- > >>>> 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 > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm