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

nf() not rounding correctly #5959

Closed
1 of 17 tasks
ChristerNilsson opened this issue Jan 17, 2023 · 9 comments
Closed
1 of 17 tasks

nf() not rounding correctly #5959

ChristerNilsson opened this issue Jan 17, 2023 · 9 comments
Assignees

Comments

@ChristerNilsson
Copy link

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build Process
  • Unit Testing
  • Internalization
  • Friendly Errors
  • Other (specify if possible)

p5.js version

v1.5.0 October 18, 2022

Web browser and version

Chrome: 109.0.5414.74

Operating System

W10 Home 19045.2486

Steps to reproduce this

console.log(Math.PI)
console.log(nf(Math.PI,1,4))

PI is approx   3.141592653589793
expect answer: 3.1416
actual answer: 3.1415

It seems a simple truncation is used instead of correct rounding.

@akp660
Copy link

akp660 commented Jan 17, 2023

I want to look into the problem and work on them.

@davepagurek
Copy link
Contributor

Thanks @akp660! I'll assign this to you.

@Qianqianye
Copy link
Contributor

Just link another nf() related issue here #5710: nf() produces problematic string-formatting of very large or small numbers.

@snehilchhabria
Copy link

Is this issue resolved already? I may be able to help if no one's working on this.

@Qianqianye
Copy link
Contributor

Qianqianye commented Jan 28, 2023

Is this issue resolved already? I may be able to help if no one's working on this.

Thanks @snehilchhabria for offering help. @aditya-shrivastavv is in the process of resolving it in this pull request #5973.

@snehilchhabria
Copy link

okay thanks for your reply.

@owais0017
Copy link

hey i want to work on this issue. where do i have to make the changes?

@Qianqianye
Copy link
Contributor

Thanks @owais0017 for offering help. @aditya-shrivastavv is in the process of resolving it in this pull request #5973. Please feel free to take a look at other open issues here. Thank you!

@limzykenneth
Copy link
Member

Closed with #5973

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

Successfully merging a pull request may close this issue.

7 participants