First off, while toFixed is now implemented, you can't cast to a number using Number(...) yet I'm afraid.
And no... Number(a.toFixed(0)).toString(16) is actually slower than parseInt(a).toString(16) on Espruino, because it'd involve the extra step of creating a number object.
To be honest if you wanted to be faster, you'd do (a|0).toString(16)
But it's a bit pointless now, because I just fixed the original bug. It'll be in 1v51 :)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
First off, while
toFixed
is now implemented, you can't cast to a number usingNumber(...)
yet I'm afraid.And no...
Number(a.toFixed(0)).toString(16)
is actually slower thanparseInt(a).toString(16)
on Espruino, because it'd involve the extra step of creating a number object.To be honest if you wanted to be faster, you'd do
(a|0).toString(16)
But it's a bit pointless now, because I just fixed the original bug. It'll be in 1v51 :)