Skip to content

Fix/percentage precision error#1108

Merged
shamsmosowi merged 1 commit intodevelopfrom
fix/percentage-precision-error
Feb 6, 2023
Merged

Fix/percentage precision error#1108
shamsmosowi merged 1 commit intodevelopfrom
fix/percentage-precision-error

Conversation

@bofeiw
Copy link
Contributor

@bofeiw bofeiw commented Feb 3, 2023

Fixes the javascript floating point error in percentage field, as spotted in Discord support channel.

Screenshot 2023-02-04 at 04 20 47

The issue is that the native multiplication in javascript produces floating point error. e.g. 0.07*100 === 7.000000000000001.

Easy fix: moving the decimal point to left/right 2 places as a string while converting number and percentage, rather than using the native multiplication/divide operator.

@bofeiw bofeiw requested a review from shamsmosowi February 3, 2023 20:23
@vercel
Copy link

vercel bot commented Feb 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
rowy-os ✅ Ready (Inspect) Visit Preview Feb 3, 2023 at 8:23PM (UTC)
1 Ignored Deployment
Name Status Preview Updated
rowy-typedoc ⬜️ Ignored (Inspect) Feb 3, 2023 at 8:23PM (UTC)

@bofeiw bofeiw changed the base branch from main to develop February 3, 2023 20:23
@shamsmosowi shamsmosowi merged commit 9758cc2 into develop Feb 6, 2023
@bofeiw bofeiw deleted the fix/percentage-precision-error branch February 6, 2023 10:01
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.

2 participants