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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Float#next_float Float#prev_float #3417

Merged
merged 2 commits into from May 30, 2015

Conversation

jsyeo
Copy link
Member

@jsyeo jsyeo commented May 30, 2015

I followed MRI's C implementation for this. 馃槄 Let me know if it's alright.


frac, exp = Math.frexp self

if frac == -0.5 then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for then here.

@jsyeo
Copy link
Member Author

jsyeo commented May 30, 2015

@yorickpeterse fixed!

d = EPSILON / 2
d = Math.ldexp(d, MIN_EXP - exp) if exp < MIN_EXP

result_frac = frac + d
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does d stand for in this case? This is rather picky but I personally despise single letter variables.

brixen added a commit that referenced this pull request May 30, 2015
Implement Float#next_float Float#prev_float
@brixen brixen merged commit 2c164e5 into rubinius:2.2 May 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants