From 478ebde5f924b8b61d8d25cd7fd1abe78cee4868 Mon Sep 17 00:00:00 2001 From: Dan Rose Date: Wed, 27 Oct 2021 17:25:21 -0500 Subject: [PATCH] Fix divWithIntCheck for floats larger than max int The integer accuracy fix could previously return a wrong result when its operands were bigger than max int. --- src/backend/web-gl/kernel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/web-gl/kernel.js b/src/backend/web-gl/kernel.js index ffea4705..2d30c463 100644 --- a/src/backend/web-gl/kernel.js +++ b/src/backend/web-gl/kernel.js @@ -1086,7 +1086,7 @@ class WebGLKernel extends GLKernel { _getDivideWithIntegerCheckString() { return this.fixIntegerDivisionAccuracy ? `float divWithIntCheck(float x, float y) { - if (floor(x) == x && floor(y) == y && integerMod(x, y) == 0.0) { + if (int(x) == x && int(y) == y && integerMod(x, y) == 0.0) { return float(int(x) / int(y)); } return x / y; @@ -1604,4 +1604,4 @@ float integerCorrectionModulo(float number, float divisor) { module.exports = { WebGLKernel -}; \ No newline at end of file +};