Commit bebbd4b0 authored by Camil Staps's avatar Camil Staps 🍃

Fix trailing zeroes in JavaScript implementation of RtoAC (after df808685)

parent ece72875
Pipeline #26115 passed with stages
in 13 minutes and 6 seconds
......@@ -567,7 +567,7 @@ class ABCInterpreter {
me.log("'"+String.fromCharCode(v)+"'");
},
print_real: function (v) {
me.log(Number(0+v).toPrecision(15));
me.log(Number(0+v).toPrecision(15).replace(/\.?0*$/,''));
},
powR: Math.pow,
......@@ -581,11 +581,11 @@ class ABCInterpreter {
lnR: Math.log,
log10R: Math.log10,
RtoAC_words_needed: function(v) {
v=Number(0+v).toPrecision(15);
v=Number(0+v).toPrecision(15).replace(/\.?0*$/,'');
return 2+((v.length+7)>>3);
},
RtoAC: function (dest, v) {
v=Number(0+v).toPrecision(15);
v=Number(0+v).toPrecision(15).replace(/\.?0*$/,'');
me.memory_array[dest/4]=6*8+2; // __STRING__
me.memory_array[dest/4+1]=0;
me.memory_array[dest/4+2]=v.length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment