-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Review #asInteger #4701
Comments
Ansi says to use rounded rather than truncated : ``` 5.6.2.16.Message: asInteger Synopsis Answer an integer approximating the receiver. Definition: <number> Answer the result of sending #rounded to the receiver. ```` Changed to `rounded`, ran all the tests that seemed relevant, and added a testcase for the issue at hand.
Changed the comment to match the ansi standard
The implementation of asInteger doing truncation instead of the ansi way of doing rounded is taken over from Squeak. It seems like the morphic system is depending on asInteger doing truncation instead of rounding. I added a comment in asInteger to warn about the fact that we are not ansi compliant.
I just wonder the rationale for answering rounded (nearest int), is it really in the final version? |
I dont want to participate on a discussion weather asInteger should truncate or round. |
Hello nicolas @frank-lesser I do not understand your point then. About roundVariables, I see that it is used in the primitive so we will have check. |
my point was to accept the decision with the clear comment in the implementation, and to review senders of asInteger ( example roundVariables ) in order to improve the quality. |
Even if ANSI conformance is not a primary goal, the knowledge of conformance still has a value. I would advise using explicit direction whenever possible. |
Frank Ok I got your point. Thanks for the clarification. We should at least document the difference in a comment. This has a value. |
As reported by Frank Lesser [LSW] on Discord today in channel #development:
caused by Number >>#asInteger - not conforming to ANSI
The text was updated successfully, but these errors were encountered: