Skip to content

Commit 0617986

Browse files
committed
Fix float constants
1 parent 287792a commit 0617986

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/backend/mode_gpu.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,12 @@
183183
if (opt.constants) {
184184
for (var name in opt.constants) {
185185
var value = opt.constants[name];
186-
constantsStr += 'const float constants_' + name + '=' + parseInt(value) + '.0;\n';
186+
187+
if (Number.isInteger(value)) {
188+
constantsStr += 'const float constants_' + name + '=' + parseInt(value) + '.0;\n';
189+
} else {
190+
constantsStr += 'const float constants_' + name + '=' + parseFloat(value) + ';\n';
191+
}
187192
}
188193
}
189194

0 commit comments

Comments
 (0)