Skip to content
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

Interval size error with Floating Point step #17284

Open
rjsargent opened this issue Oct 17, 2024 · 1 comment
Open

Interval size error with Floating Point step #17284

rjsargent opened this issue Oct 17, 2024 · 1 comment

Comments

@rjsargent
Copy link

Pharo v9 through v12 overstates the size of (-4 to: 4 by: 0.1)
Bug description
Since 0.1 is not exactly represented in FP, we should see only 80 elements in that interval. But, #size calculates as 81 rather than 80.

To Reproduce
| elements |
elements := OrderedCollection new.
-4 to: 4 by: 0.1 do: [ :i | elements add: i].
elements size
80

| elements |
elements := OrderedCollection new.
(-4 to: 4 by: 0.1) do: [ :i | elements add: i].
elements size
81

Expected behavior
#do: should enumerate the same 80 elements that #to:by:do: does.

Screenshots
If applicable, add screenshots to help explain your problem.

Version information:

  • OS: Windows
  • Version: 10 Pro
  • Pharo Version: 9 through 12, at least

Expected development cost
Expected to be small

Copy link

welcome bot commented Oct 17, 2024

Thanks for opening your first issue! Please check the CONTRIBUTING documents for some tips about which information should be provided. You can find information of how to do a Pull Request here: https://github.com/pharo-project/pharo/wiki/Contribute-a-fix-to-Pharo

GitHub
Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk. - pharo-project/pharo

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

No branches or pull requests

1 participant