[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bash arithmetic doesn't give error message on wrap.
From: |
Richard Neill |
Subject: |
Bash arithmetic doesn't give error message on wrap. |
Date: |
Fri, 27 Apr 2007 19:27:01 +0100 |
User-agent: |
Thunderbird 1.5.0.10 (X11/20070403) |
Bash Version: 3.2
Patch Level: 13
Release Status: release
Description:
$ echo $((4000000000*4000000000)
-2446744073709551616
Repeat-By:
Do some arithmetic in bash $((....)).
If the numbers are out of range, the output will be wrong in
all sorts of interesting ways. No error message is given.
Fix:
Arbitrary-precision maths would be nice. But at least, could we
have an error message if an overflow occurs?
The man page says:
"Evaluation is done in fixed-width integers with no
check for overflow..."
but I'd suggest this represents a bug, not a feature.
Regards,
Richard
- Bash arithmetic doesn't give error message on wrap.,
Richard Neill <=
- Re: Bash arithmetic doesn't give error message on wrap., Chet Ramey, 2007/04/28
- Re: Bash arithmetic doesn't give error message on wrap., Richard Neill, 2007/04/28
- Re: Bash arithmetic doesn't give error message on wrap., Bob Proulx, 2007/04/29
- Re: Bash arithmetic doesn't give error message on wrap., Richard Neill, 2007/04/29
- Re: Bash arithmetic doesn't give error message on wrap., Andreas Schwab, 2007/04/30
- Re: Bash arithmetic doesn't give error message on wrap., Bob Proulx, 2007/04/30
- Re: Bash arithmetic doesn't give error message on wrap., Richard Neill, 2007/04/30
- Re: Bash arithmetic doesn't give error message on wrap., Paul Jarc, 2007/04/30
- Re: Bash arithmetic doesn't give error message on wrap., Andreas Schwab, 2007/04/30
- Re: Bash arithmetic doesn't give error message on wrap., Paul Jarc, 2007/04/30