syphilis has asked for the wisdom of the Perl Monks concerning the following question:
would be exactly equal to the perl value 1e-298.SV * get_problem_val(void) { return newSVnv(1e-298L); }
As well as confirming that nvtype is long double and that the values differ, it also reveals that the last 5 (least significant) bits of the 64-bit perl mantissa are 10000 whereas the 64-bit C mantissa terminates with 01110#!perl -l use warnings; use strict; use Config; use Inline C => Config => USING => 'ParseRegExp', BUILD_NOISY => 1; use Inline C => <<'EOC'; SV * get_problem_val(void) { return newSVnv(1e-298L); } EOC print "\n\$Config{nvtype}: $Config{nvtype}"; print "Different values" if 1e-298 != get_problem_val(); print scalar reverse unpack "b64", pack "D", 1e-298; print scalar reverse unpack "b64", pack "D", get_problem_val();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: When 1e-298L != 1e-298L
by BrowserUk (Patriarch) on Oct 24, 2013 at 14:23 UTC | |
|
Re: When 1e-298L != 1e-298L
by kcott (Archbishop) on Oct 24, 2013 at 14:41 UTC | |
by syphilis (Archbishop) on Oct 24, 2013 at 23:23 UTC | |
by kcott (Archbishop) on Oct 25, 2013 at 02:47 UTC | |
|
Re: When 1e-298L != 1e-298L
by BrowserUk (Patriarch) on Oct 24, 2013 at 17:27 UTC | |
by syphilis (Archbishop) on Oct 24, 2013 at 23:59 UTC | |
by BrowserUk (Patriarch) on Oct 25, 2013 at 00:25 UTC | |
by syphilis (Archbishop) on Oct 25, 2013 at 01:41 UTC | |
|
Re: When 1e-298L != 1e-298L
by syphilis (Archbishop) on Oct 25, 2013 at 11:09 UTC | |
by syphilis (Archbishop) on Nov 01, 2013 at 13:42 UTC |