bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GAWK bugissue report - ROUNDMODE inconsistencies between standard an


From: arnold
Subject: Re: GAWK bugissue report - ROUNDMODE inconsistencies between standard and bignum invocations
Date: Thu, 24 Feb 2022 12:04:49 -0700
User-agent: Heirloom mailx 12.5 7/5/10

This is the final time that I will remind you to send these
messages to bug-gawk@gnu.org and not to my personal emails.

I will delete any further bug reports sent directly to me without
answering or forwarding them.

Arnold

"Jason C. Kwan" <jasonckwan@yahoo.com> wrote:
> 
> In the ROUNDMODE = D ( rounding [D]own towards negative infinity),
> using this very straight forward equation, one would end up getting a
> slightly different value. 
> 
> Regardless of how high or how low a precision I tried to set in gawk -M,
> the only one with the same result is a precision of 39, but using the
> -d print out feature, it reveals an internal value without decimals for
> gawk -M, 
> 
> while standard gawk -e matches the 16 digit significant digits, and only
> off by 1 at the 17th digit. 
> 
> I even tested a ridiculous PREC setting of 200 milliion to eliminate
> any chance the value fluctuates depending on PREC, and the result indeed
> matches nearly all other settings, including not setting PREC and assuming
> the default value of 53.
> 
> I know I'm being pedantic here since we're talking about the 22nd
> significant digit in octal, so entirely up to you whether this warrants
> any attention. 
>
> GNU Awk 5.1.1, API: 3.1 (GNU MPFR 4.1.0, GNU MP 6.2.1)
>
> Darwin MacBook-Pro.local 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 
> 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64
>
>   BEGIN {
>        ROUNDMODE = "D"
>        x = ( 2 ^ -13 ) * ( 2 ^ 52 - 3 ) - 1
>        x = -x
>        printf( "%o" , 1E0 + x )
>   }
>
>   ------------------------------------------------------
>
>   gawk 5.1.1 -e                                 :: 177777777000000000000 [3] 
> <<
>
>   ------------------------------------------------------
>
>   gawk -M -e :: 177777777000000000000[2]
>   gawk -M -v PREC=200000000 -e  :: 177777777000000000000 2
>
>   ------------------------------------------------------
>   gawk -M -v PREC=37 -e                :: 17777777700000000000 10
>   gawk -M -v PREC=38 -e                :: 177777777000000000000  4
>   gawk -M -v PREC=39 -e                :: 177777777000000000000 [3] <<
>   gawk -M -v PREC=40 -e                :: 177777777000000000000  2
>   ------------------------------------------------------
>
>   PREC :: nm
>   :                    1777777770000000000003
>   x: -549755813886.99963
>                  ^
>   standard ^ vs. --bignum v
>                                           v
>   PREC ::  0 ::  1777777770000000000002
>   x: -549755813886.99964
>
>   PREC :: 39 :: 1777777770000000000003
>   x: -549755813886
>
> ----------------------------------------------------------
>   1      PREC ::   1 :: 1777777776000000000000
>   2      PREC ::   2 :: 1777777774000000000000
>   3      PREC ::   3 :: 1777777772000000000000
>   4      PREC ::   4 :: 1777777771000000000000
>   5      PREC ::   5 :: 1777777770400000000000
>
>   6      PREC ::   6 :: 1777777770200000000000
>   7      PREC ::   7 :: 1777777770100000000000
>   8      PREC ::   8 :: 1777777770040000000000
>   9      PREC ::   9 :: 1777777770020000000000
>   10    PREC :: 10 :: 1777777770010000000000
>
>   11    PREC :: 11 :: 1777777770004000000000
>   12    PREC :: 12 :: 1777777770002000000000
>   13    PREC :: 13 :: 1777777770001000000000
>   14    PREC :: 14 :: 1777777770000400000000
>   15    PREC :: 15 :: 1777777770000200000000
>
>   16    PREC :: 16 :: 1777777770000100000000
>   17    PREC :: 17 :: 1777777770000040000000
>   18    PREC :: 18 :: 1777777770000020000000
>   19    PREC :: 19 :: 1777777770000010000000
>   20    PREC :: 20 :: 1777777770000004000000
>
>   21    PREC :: 21 :: 1777777770000002000000
>   22    PREC :: 22 :: 1777777770000001000000
>   23    PREC :: 23 :: 1777777770000000400000
>   24    PREC :: 24 :: 1777777770000000200000
>   25    PREC :: 25 :: 1777777770000000100000
>
>   26    PREC :: 26 :: 1777777770000000040000
>   27    PREC :: 27 :: 1777777770000000020000
>   28    PREC :: 28 :: 1777777770000000010000
>   29    PREC :: 29 :: 1777777770000000004000
>   30    PREC :: 30 :: 1777777770000000002000
>
>   31    PREC :: 31 :: 1777777770000000001000
>   32    PREC :: 32 :: 1777777770000000000400
>   33    PREC :: 33 :: 1777777770000000000200
>   34    PREC :: 34 :: 1777777770000000000100
>   35    PREC :: 35 :: 1777777770000000000040
>
>   36    PREC :: 36 :: 1777777770000000000020
>   37    PREC :: 37 :: 1777777770000000000010
>   38    PREC :: 38 :: 1777777770000000000004
>   39    PREC :: 39 :: 1777777770000000000003 <<<<<<
>   40    PREC :: 40 :: 1777777770000000000002
>
>   41    PREC :: 41 :: 1777777770000000000002
>   42    PREC :: 42 :: 1777777770000000000002
>   43    PREC :: 43 :: 1777777770000000000002
>   44    PREC :: 44 :: 1777777770000000000002
>   45    PREC :: 45 :: 1777777770000000000002
>
>   46    PREC :: 46 :: 1777777770000000000002
>   47    PREC :: 47 :: 1777777770000000000002
>   48    PREC :: 48 :: 1777777770000000000002
>   49    PREC :: 49 :: 1777777770000000000002
>   50    PREC :: 50 :: 1777777770000000000002
>
>   51    PREC :: 51 :: 1777777770000000000002
>   52    PREC :: 52 :: 1777777770000000000002
>   53    PREC :: 53 :: 1777777770000000000002 <<<<<<
>   54    PREC :: 54 :: 1777777770000000000002
>   55    PREC :: 55 :: 1777777770000000000002
>
>   56    PREC :: 56 :: 1777777770000000000002
>   57    PREC :: 57 :: 1777777770000000000002
>   58    PREC :: 58 :: 1777777770000000000002
>   59    PREC :: 59 :: 1777777770000000000002
>   60    PREC :: 60 :: 1777777770000000000002
>
>   61    PREC :: 61 :: 1777777770000000000002
>   62    PREC :: 62 :: 1777777770000000000002
>   63    PREC :: 63 :: 1777777770000000000002
>   64    PREC :: 64 :: 1777777770000000000002
>   65    PREC :: 65 :: 1777777770000000000002
>
>   66    PREC :: 66 :: 1777777770000000000002
>   67    PREC :: 67 :: 1777777770000000000002
>   68    PREC :: 68 :: 1777777770000000000002
>   69    PREC :: 69 :: 1777777770000000000002
>   70    PREC :: 70 :: 1777777770000000000002
>
>   71    PREC :: 71 :: 1777777770000000000002
>   72    PREC :: 72 :: 1777777770000000000002
>   73    PREC :: 73 :: 1777777770000000000002
>   74    PREC :: 74 :: 1777777770000000000002
>   75    PREC :: 75 :: 1777777770000000000002
>
>   76    PREC :: 76 :: 1777777770000000000002
>   77    PREC :: 77 :: 1777777770000000000002
>   78    PREC :: 78 :: 1777777770000000000002
>   79    PREC :: 79 :: 1777777770000000000002
>   80    PREC :: 80 :: 1777777770000000000002
>
>   81    PREC :: 81 :: 1777777770000000000002
>   82    PREC :: 82 :: 1777777770000000000002
>   83    PREC :: 83 :: 1777777770000000000002
>   84    PREC :: 84 :: 1777777770000000000002
>   85    PREC :: 85 :: 1777777770000000000002
>
>   86    PREC :: 86 :: 1777777770000000000002
>   87    PREC :: 87 :: 1777777770000000000002
>   88    PREC :: 88 :: 1777777770000000000002
>   89    PREC :: 89 :: 1777777770000000000002
>   90    PREC :: 90 :: 1777777770000000000002
>
>   91    PREC :: 91 :: 1777777770000000000002
>   92    PREC :: 92 :: 1777777770000000000002
>   93    PREC :: 93 :: 1777777770000000000002
>   94    PREC :: 94 :: 1777777770000000000002
>   95    PREC :: 95 :: 1777777770000000000002
>
>   96    PREC :: 96 :: 1777777770000000000002
>   97    PREC :: 97 :: 1777777770000000000002
>   98    PREC :: 98 :: 1777777770000000000002
>   99    PREC :: 99 :: 1777777770000000000002



reply via email to

[Prev in Thread] Current Thread [Next in Thread]