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

Doc errors in Math.round #2933

Closed
Maaartinus opened this issue Oct 15, 2019 · 1 comment
Closed

Doc errors in Math.round #2933

Maaartinus opened this issue Oct 15, 2019 · 1 comment
Assignees
Milestone

Comments

@Maaartinus
Copy link

There a few mismatches between the doc and the implementation:
https://github.com/codenameone/CodenameOne/blob/master/Ports/CLDC11/src/java/lang/Math.java#L216

  • The result is surely not equivalent as floor returns double.
  • L220: The result is 0 rather than +0.0. Repeated two more times.
  • L224: A typo in "infintiy". Repeated once.

A side question: In my CLDC11.jar, there's long instead of int. How comes?

@shannah
Copy link
Collaborator

shannah commented Nov 5, 2019

The result is surely not equivalent as floor returns double.

Notice the cast to int: {@code (int) Math.floor(f+0.5)}

L220: The result is 0 rather than +0.0. Repeated two more times.

I added a cast now: 720d9b6

L224: A typo in "infintiy". Repeated once.

Fixed c07647b

A side question: In my CLDC11.jar, there's long instead of int. How comes?

There are two round methods: public long round(double) and public int round(float)

@shannah shannah closed this as completed Nov 5, 2019
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

No branches or pull requests

2 participants