Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

fx* does not check for overflow #10

Closed
hyln9 opened this issue Sep 12, 2014 · 7 comments
Closed

fx* does not check for overflow #10

hyln9 opened this issue Sep 12, 2014 · 7 comments
Labels

Comments

@hyln9
Copy link
Owner

hyln9 commented Sep 12, 2014

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)

Launchpad Details: #LP191310 leppie - 2008-02-12 13:21:49 -0500

@hyln9 hyln9 added the high label Sep 12, 2014
@hyln9
Copy link
Owner Author

hyln9 commented Sep 12, 2014

Will fix. Thanks.

Launchpad Details: #LPC Abdulaziz Ghuloum - 2008-02-12 13:36:36 -0500

@hyln9
Copy link
Owner Author

hyln9 commented Sep 12, 2014

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

Launchpad Details: #LPC leppie - 2008-02-12 13:58:14 -0500

@hyln9
Copy link
Owner Author

hyln9 commented Sep 12, 2014

fx* now checks for overflow (revision 1380).

Launchpad Details: #LPC Abdulaziz Ghuloum - 2008-02-12 14:48:26 -0500

@hyln9
Copy link
Owner Author

hyln9 commented Sep 12, 2014

fx- now checks for overflow (revision 1381)

Launchpad Details: #LPC Abdulaziz Ghuloum - 2008-02-12 15:05:56 -0500

@hyln9
Copy link
Owner Author

hyln9 commented Sep 12, 2014

Is that it?

Launchpad Details: #LPC Abdulaziz Ghuloum - 2008-02-12 15:07:39 -0500

@hyln9
Copy link
Owner Author

hyln9 commented Sep 12, 2014

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 #)

IronScheme:

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

Launchpad Details: #LPC leppie - 2008-02-12 15:41:02 -0500

@hyln9
Copy link
Owner Author

hyln9 commented Sep 12, 2014

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

Launchpad Details: #LPC Abdulaziz Ghuloum - 2008-02-12 16:45:33 -0500

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant