-
Notifications
You must be signed in to change notification settings - Fork 577
scientific notation parsing/conversion problems #9095
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
Comments
From [email protected]This is a bug report for perl from davidp@lanl.gov, Upon investigation I've discovered some disturbing things: 1. perl -e 'print eval($ARGV[0]),"\n"' If that's not disturbing enough, then read on ... The most disturbing fact occurs when I remove the scientific notation from the literals: 1. perl -e 'print eval($ARGV[0]),"\n"' Compilers are the bane of my life ... sigh. The following was suggested to me: perl -e 'printf("%.15E\n", eval($ARGV[0])),"\n"' \ It was not portable to Cygwin since my Cygwin build of Perl continued to produce the original, perl -e '$s=$ARGV[0]; $s=~s/[eE]([+-]?\d+)/*10**$1/g; printf "%s =\n%s Basically, I convert the scientific notation numbers to standard floating point numbers with regex, Flags: Site configuration information for perl v5.8.8: Configured by rurban at Sun Jul 8 19:08:44 GMT 2007. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Locally applied patches: @INC for perl v5.8.8: Environment for perl v5.8.8: PATH=/usr/local/bin:/usr/bin:/bin:/cygdrive/c/PROGRA |
From @dcollinsn$ perl5.25.2 -e 'print eval("(1.818343814922934E+05-1.818343815129567E+05)"),"\n"' What gives? -- |
The RT System itself - Status changed from 'new' to 'open' |
From [email protected]Dan Collins via RT wrote:
$ perl -MData::Float=float_hex -le 'print float_hex($_) for 181834.3814922934, 1.818343814922934e5' Looks like another form of [perl #41202]. The former is the true closest $ perl -le 'printf "%.60f\n", $_ for 181834.3814922934, 1.818343814922934e5' -zefram |
From @khwilliamsonOn 07/16/2016 05:40 PM, Zefram wrote:
I've wondered if things like this would be improved if we were to take |
From [email protected]Karl Williamson wrote:
No, it would not. When putting multiple digits together, we still need -zefram |
Please see GH #7586 for a similar issue |
RT #41202 (GH #8730 ) was fixed in 5.30. I just ran Dan Collins examples on blead, and both now give the same result. So I'm closing this ticket: blead -le 'print eval("(1.818343814922934E+05-1.818343815129567E+05)"),"\n"' blead -le 'print eval("(181834.3814922934-181834.3815129567)"),"\n"' |
Migrated from rt.perl.org#47087 (status was 'open')
Searchable as RT47087$
The text was updated successfully, but these errors were encountered: