7
asm.jsモジュール内の整数部分と数値の小数部分を見つける必要がある場合はどうすればいいですか? standard operatorsのいずれもintish型とdoubleish型の間で変換しません。 Math.floorでさえdoubleを返し、その結果をintに強制することはできません。asm.jsのint [ish]とdouble [ish]の間の変換
var floor = stdlib.Math.floor;
function(n) {
n = +n;
var a = 0;
a = floor(n)|0; // fails: "Operands to bitwise ops must be intish"
var b = 0.0;
b = +(n-a); // would fail if compiler got to here
return;
}
注意が必要です '~~ +床(n)が'、または時々 '~~ +床(N)| 0 '。 – ZachB