fx* does not check for overflow

Bug #191310 reported by leppie
2
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Fix Committed
High
Abdulaziz Ghuloum

Bug Description

Not sure if this is classified as a bug. The behaviour is not defined in R6RS (is it part of the IEEE floating point spec maybe?). There also seems to be inconsistency between fx*/fx+ and fx-/fx/ expected results in terms of exceptions and the 'correct' vs the 'mathematically correct' answer.

> (fx* 429496728 2)
-214748368
> (fx+ 429496728 429496728)
Unhandled exception
 Condition components:
   1. &assertion
   2. &who: fx+
   3. &message: "overflow when adding numbers"
   4. &irritants: (429496728 429496728)

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Will fix. Thanks.

Changed in ikarus:
assignee: nobody → aghuloum
importance: Undecided → High
status: New → Confirmed
Revision history for this message
leppie (leppie) wrote :

Ignore the IEEE floating point stuff I mentioned (brain lapse ;p).

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

fx* now checks for overflow (revision 1380).

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

fx- now checks for overflow (revision 1381)

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Is that it?

Changed in ikarus:
status: Confirmed → Fix Committed
Revision history for this message
leppie (leppie) wrote :

Nope :) found more. I think there is only that one case in negate, but it seems Ikarus does not handle 'fx-negate' (yet).

Ikarus:
> (fx- (greatest-fixnum))
Unhandled exception
 Condition components:
   1. &assertion
   2. &who: apply
   3. &message: "incorrect number of arguments"
   4. &irritants: (1 #<procedure fx->)

IronScheme:
> (fx- (greatest-fixnum))
-2147483647
> (fx- (least-fixnum))
&assertion
&who: fx-
&message: arithmetic overflow
&irritants: (-2147483648)

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Missed that. Thanks. It's now fixed in 1382.

Changed in ikarus:
milestone: none → 0.0.4
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.