-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perl-5.18.0 apparently miscalculates the NV 1e-298 #13370
Comments
From @sisyphusHi, One of those perls has nvtype of 'double', the other has nvtype of 'long I run the following Inline::C script: ####################### #!perl -l #use Inline C => Config => use Inline C => <<'EOC'; SV * get_problem_val(long nvsize) { EOC my $s = $Config{nvsize}; if($Config{nvsize} != 8) { ####################### When I run that on the "double" build of perl-5.18.0, it produces the $Config{nvtype}: double When I run that on the "long double" build of perl-5.18.0, it produces: $Config{nvtype}: long double In both instances it's the second of the 2 values (ie the value returned I presume there would be other values that also produce the discrepancy, Here are the 'perl -V' outputs for both perls - firstly, the "double" build: ######################## This is perl 5, version 18, subversion 0 (v5.18.0) built for Copyright 1987-2013, Larry Wall Perl may be copied only under the terms of either the Artistic License Complete documentation for Perl, including FAQ lists, should be found on sisyphus@sisyphus5-desktop:~/pscrpt/inline$ perl -V Platform: Characteristics of this binary (from libperl): ######################## and the "long double" build: ######################## Copyright 1987-2013, Larry Wall Perl may be copied only under the terms of either the Artistic License Complete documentation for Perl, including FAQ lists, should be found on sisyphus@sisyphus5-desktop:~/pscrpt/inline$ perl -V Platform: Characteristics of this binary (from libperl): ######################## Cheers, |
From zefram@fysh.orgSisyphus wrote:
See [perl #41202], where Perl gets the wrong value and libc gets the -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @sisyphus-----Original Message----- Sisyphus wrote:
Is there a connection ? Where nvtype is "double": And where nvtype is "long double" (Sorry if I've missed the point.) Cheers, |
From zefram@fysh.orgsisyphus1@optusnet.com.au wrote:
They're the same class of problem: libc performs better than Perl at
You gave Perl the text "1e-298" in a context where it was treated as a
That's the difference between these two tickets. 2**70 can be represented Oh, another way to see the "1e-298" difference: compare "1e-298" against -zefram |
From @sisyphus-----Original Message----- sisyphus1@optusnet.com.au wrote:
Ok ... and this has been known about for quite some time ... which leads to [snip]
Yes, on the perl-5.18.0 built with nvtype eq 'double', 10 ** -298 produces $ perl -le 'print scalar reverse unpack "b64", pack "D", 10 ** -298;' That differs from the C value for 1e-298 beginning at the 57th bit. Cheers, |
From zefram@fysh.orgsisyphus1@optusnet.com.au wrote:
Ooh, interesting. OK, I get the same values as you. In summary (via +0x1.0be08d0527e1d69cp-990 C source (gcc) 1e-298L, C strtold "1e-298", I'm mystified as to how Perl 10**-298 gets a different result from C -zefram |
From zefram@fysh.orgI wrote:
I've narrowed this difference down to C constant folding. powl() on -zefram |
From @sisyphus-----Original Message-----
Oh, yes - I can see this. long double ld; and: long double ld, val, pow; And this would be a bug in the constant folding, I presume. Cheers, |
From zefram@fysh.orgsisyphus1@optusnet.com.au wrote:
Well, it's a bug that the constant folding doesn't match the runtime I reported it as a libc bug via Debian -zefram |
Migrated from rt.perl.org#120363 (status was 'open')
Searchable as RT120363$
The text was updated successfully, but these errors were encountered: