mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-12 04:34:41 -04:00
Fix to minimize floating point noise
This commit is contained in:
parent
11611c8fe2
commit
c6de2f7f23
1 changed files with 3 additions and 4 deletions
|
@ -231,10 +231,9 @@ var Numerical = new function() {
|
|||
} else {
|
||||
// No real roots if D < 0
|
||||
if (D >= -MACHINE_EPSILON) {
|
||||
D = D < 0 ? 0 : D;
|
||||
var R = sqrt(D);
|
||||
// Try to minimise floating point noise.
|
||||
if (b >= MACHINE_EPSILON && b <= MACHINE_EPSILON) {
|
||||
var R = sqrt(D < 0 ? 0 : D);
|
||||
// Try to minimize floating point noise.
|
||||
if (b >= -MACHINE_EPSILON && b <= MACHINE_EPSILON) {
|
||||
x1 = abs(a) >= abs(c) ? R / a : -c / R;
|
||||
x2 = -x1;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue