-
Notifications
You must be signed in to change notification settings - Fork 997
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
irrational behaviour? #913
Comments
This follows the specification. The notation 4.56 denotes the number 4.56=456/1000 which is rational.
|
Chez supports rational roots. If your explanation about 4.56 were correct, then the following behaviour would have been incorrect, wouldn't it?
How can 4.56 be both rational and inexact if it denotes precisely 456/100? |
My own thinking: As a concept the number 4.56 itself is always exact. The spec: = Numbers =
= Exactness =
|
It's an inexact literal, that means it's not assumed to be an exact number. It is precisely 456/100, but every inexact number is a precise number that approximates some number. If you actually divide 456 by 100,
or as a ratio literal
|
In contrast to most languages where numeric types are based on their machine representations, Scheme takes a mathematical view of numbers as far as possible – but only as far as possible.
With your next two examples, we unfortunately reach the ‘as far as possible’ part. The Scheme Many years ago there was a proposal to clean up the semantics and terminology here, but aside from some minor patches in the R6RS spec compared to R5RS, it didn’t really go anywhere. The exactness/inexactness situation has some weird edge cases like this but it seems we’re stuck with it. |
Does this behaviour make sense??
The text was updated successfully, but these errors were encountered: