Skip to content

fix: mathematical precision#938

Closed
cptbtptpbcptdtptp wants to merge 4 commits intogalacean:mainfrom
cptbtptpbcptdtptp:fix/math
Closed

fix: mathematical precision#938
cptbtptpbcptdtptp wants to merge 4 commits intogalacean:mainfrom
cptbtptpbcptdtptp:fix/math

Conversation

@cptbtptpbcptdtptp
Copy link
Copy Markdown
Collaborator

@cptbtptpbcptdtptp cptbtptpbcptdtptp commented Aug 10, 2022

The number in JS uses the IEEE754 standard: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number

IEEE754 conversion rules: https://www.h-schmidt.net/FloatConverter/IEEE754.html

$2^{53}\rightarrow 10^{15.95}$

@GuoLei1990 GuoLei1990 added bug Something isn't working math Math library labels Aug 10, 2022
@GuoLei1990 GuoLei1990 added this to the 0.9 milestone Aug 10, 2022
@GuoLei1990
Copy link
Copy Markdown
Member

GuoLei1990 commented Aug 10, 2022

Encoding is: $2^{\left( 2-v0\right) }\times \left( 1+v1\right)$
Maybe is $2^{52}-1\rightarrow 10^{15.65}$
Math.floor(15.653559774527022)=15
?

@GuoLei1990
Copy link
Copy Markdown
Member

Should fix Math unit test

Comment thread packages/math/src/Vector3.ts Outdated
out._x = _x * len;
out._y = _y * len;
out._z = _z * len;
out._onValueChanged && out._onValueChanged();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use out.set(_x * len, _y * len, _z * len); is better?

@GuoLei1990 GuoLei1990 modified the milestones: 0.9, 1.0 Nov 14, 2022
@GuoLei1990 GuoLei1990 added the medium priority Medium priority issue label Nov 14, 2022
@GuoLei1990 GuoLei1990 modified the milestones: 1.0, 1.1 May 18, 2023
@GuoLei1990 GuoLei1990 modified the milestones: 1.1, 1.2 Oct 7, 2023
@cptbtptpbcptdtptp cptbtptpbcptdtptp modified the milestones: 1.2, Backlog Feb 21, 2024
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 26, 2026

Codecov Report

❌ Patch coverage is 55.88235% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.68%. Comparing base (c9b883b) to head (7c053e7).
⚠️ Report is 1860 commits behind head on main.

Files with missing lines Patch % Lines
packages/math/src/Quaternion.ts 45.45% 1 Missing and 5 partials ⚠️
packages/math/src/CollisionUtil.ts 63.63% 1 Missing and 3 partials ⚠️
packages/math/src/Matrix.ts 25.00% 0 Missing and 3 partials ⚠️
packages/core/src/Transform.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #938      +/-   ##
==========================================
- Coverage   28.68%   28.68%   -0.01%     
==========================================
  Files         331      331              
  Lines       14323    14316       -7     
  Branches     2181     2180       -1     
==========================================
- Hits         4109     4106       -3     
- Misses       9732     9734       +2     
+ Partials      482      476       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

bug Something isn't working math Math library medium priority Medium priority issue

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants