(toarith): Rewrite to detect/diagnose integer overflow,
authorJim Meyering <jim@meyering.net>
Fri, 14 Jan 2005 14:15:25 +0000 (14:15 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 14 Jan 2005 14:15:25 +0000 (14:15 +0000)
commit7eff5901c419afb8945bd96a5ed12d196802bc79
tree4b14cd3abd5b554d54531af4c4b0937ac2815bfa
parent9eea26656326f27517c042a88d817a4a32ab938b
(toarith): Rewrite to detect/diagnose integer overflow,
rather than suffering silently.
Before, expr would silently overflow and wrap around:
  $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
  1
Now it detects the problem and exits nonzero:
  $ ./expr $(echo 2^63|bc) = 0
  ./expr: 9223372036854775808: integer is too large
src/expr.c