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;
}
注意近期建立FF(夜间通道)的要求'~~ +地板(N)',或者有时'~~ +地板(N)| 0'。 – ZachB