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
Floating Point Number Printing Bug #1174
Comments
From pdh@best.comCreated by pdh@best.comHi, This is an obscure bug. A number is reported as being precisely 25, I've been using perl for years without ever really finding a bug, so Peter Case 1: Works Case 2: Take integer part, doesn't work: Case 3: Add small constant, works again: Perl Info
|
From @tamiasOn Sun, Feb 13, 2000 at 03:50:27PM -0800, Peter Hendrickson wrote:
I'm afraid this bug is neither as obscure nor as exciting as you think. perldoc -q decimal (or perldoc perlfaq4 with perl5.004_04) =head2 Why am I getting long decimals (eg, 19.9499999999999) instead of the Ronald |
From [Unknown Contact. See original ticket]Created by pdh@best.com
I believe you have misunderstood the bug. The problem is that I am If I was getting something like "24.9999999999999..." I would be happy Here's another symptom. This should not happen:
Peter P.S. Here's the original bug report: This is a bug report for perl from pdh@best.com, ----------------------------------------------------------------- This is an obscure bug. A number is reported as being precisely 25, I've been using perl for years without ever really finding a bug, so Peter Case 1: Works Case 2: Take integer part, doesn't work: Case 3: Add small constant, works again: Perl Info
|
From @tamiasOn Mon, Feb 14, 2000 at 02:03:32PM -0800, Peter Hendrickson wrote:
It's all the same 'bug'. print() uses a format for printing floating point int(), on the other hand, does not round the number before truncating it. Try replacing your print with printf "%.16f". Ronald |
From [Unknown Contact. See original ticket]Peter Hendrickson <pdh@best.com> wrote
No. Ronald understands floating point very well. You have failed % perldoc -f int =item int Returns the integer portion of EXPR. If EXPR is omitted, uses C<$_>. (*) I note you are using a Perl version which is two and a half years Mike Guy |
From @tamiasOn Tue, Feb 15, 2000 at 06:38:37PM +0000, M.J.T. Guy wrote:
FYI for p5p: Peter emailed me offlist acknowledging that he understands the Ronald |
Migrated from rt.perl.org#2143 (status was 'resolved')
Searchable as RT2143$
The text was updated successfully, but these errors were encountered: