-
• #27
So that I may understand how floating point calculations are made under the hood
I pointed you to
jsvMathsOp
in one of the other posts you'd made when I looked at my email this morning. It's in there. At the end of the day Espruino uses the entirely standard C libraries for double arithmetic and converting between doubles/ints - so you would hope there would be no differences.However conversion to/from Strings is done with Espruino's own functions (which happens in
jsutils.c
) - generally I can't use the built-in math functions for that because:- They don't abide by the JS spec in more serious ways (eg. parsing of invalid strings)
- They bring in other parts of the C library which total maybe 50k of extra used code space, which we can't afford on a lot of platforms.
- They don't abide by the JS spec in more serious ways (eg. parsing of invalid strings)
Mon 2019.07.29
Thank you @Gordon, that confirms (in summary) my closing comment in #22 and that will be the approach I shall use.
Actually, the equation helped @AkosLukacs locate the inconsistency as in the link to bug 1573 that you pointed to. It was code I just copied across for demonstration. Wasn't even needed as I was using constants. If there is a conversion issue (bug 1573) in question for constants, that could explain more than what our weekend exchange uncovered.
I'm after masking bits. The thread got side tracked with what the equation uncovered. Maybe there are two unique conflicting themes here.
So that I may understand how floating point calculations are made under the hood, where is the better place to start on it's inclusion in Espruino? Is it done with Log tables? Where would they be defined? It just surprises me that the inconsistency compared with other techniques actually exists.
I'd hate to think that bit masking in unreliable . . . .