We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a6d934a commit 9ffab6aCopy full SHA for 9ffab6a
std/portable/index.js
@@ -136,12 +136,12 @@ if (typeof globalScope.ASC_TARGET === "undefined") {
136
137
globalScope["floor"] = Math.floor;
138
139
- // Adopt code from https://github.com/rfk/wasm-polyfill
140
globalScope["nearest"] = function nearest(value) {
141
- if (Math.abs(value - Math.trunc(value)) === 0.5) {
142
- return 2.0 * Math.round(value * 0.5);
143
- }
144
- return Math.round(value);
+ const INV_EPS64 = 4503599627370496.0;
+ const y = Math.abs(value);
+ return y < INV_EPS64
+ ? Math.abs(y + INV_EPS64 - INV_EPS64) * Math.sign(value)
+ : value;
145
};
146
147
globalScope["select"] = function select(ifTrue, ifFalse, condition) {
0 commit comments