-
-
Notifications
You must be signed in to change notification settings - Fork 741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
small numbers a convert to zero if smaller than 1e-9, big numbers are strip to 1e68 when convert to string #1489
Comments
I think parsing floating point numbers works just fine. Custom double-to-string code was originally added because platform-specific versions pulled in large amounts of extra code - on some platforms it caused 1kB of RAM to be statically allocated. I believe JS may have some standards on how double to string code should behave as well (not that we currently adhere to those). So I'd like to keep the implementation inside Espruino if only because it aids testing to always use the same implementation - but you're welcome to contribute an updated |
hello Gordon,
I go en hollidays tomorrow. But when i come back at end of august i will be
happy to contribute to this project.
JB Gagnon
2018-08-10 15:49 GMT+02:00 Gordon Williams <notifications@github.com>:
… I think parsing floating point numbers works just fine. 0==1e-20 is false.
It's just converting to Strings.
Custom double-to-string code was originally added because
platform-specific versions pulled in large amounts of extra code - on some
platforms it caused 1kB of RAM to be statically allocated. I believe JS may
have some standards on how double to string code should behave as well (not
that we currently adhere to those).
So I'd like to keep the implementation inside Espruino if only because it
aids testing to always use the same implementation - but you're welcome to
contribute an updated ftoa_bounded_extra function that'll use e for
larger/smaller values if you want to.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1489 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AXPNl6RgTguUmhfn0CfmEpcnOr-u4Ne8ks5uPY-AgaJpZM4V4Mkr>
.
|
Any chance of doing this? |
I try several time to compile on windows with msys32, but each time there
is a error.
But I probably don't use the correct esp-idf version 3.04 and not 3.03 (i
think) or correct toolchain
but yesterday I find this https://github.com/espruino/EspruinoBuildTools
So I make the test one again
probably i will find assistance on forum ?
If I can compile: YES i ll do that and try to correct sources before report
a bug
I'd like too make enhancement
JB
Le jeu. 25 oct. 2018 à 10:59, Gordon Williams <notifications@github.com> a
écrit :
… Any chance of doing this?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1489 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AXPNl1O9h3e2w1p6hQlBkK5Ha8-Sr8Gkks5uoX1agaJpZM4V4Mkr>
.
|
Yes - best to ask on the forum. You'll have much better luck with Windows 10 Linux Subsystem or with a virtual machine running Linux though |
Ok I can compile now !
(making some change in provision.sh for path to access get_board_info.py,
and do a pacman for tar command ....)
so to train myself I correct this issue (the easy one)
#1488
I test it on my board, it's ok ! no "back to the future" at all
what is the good way to proceed (is-there a guide ?)
must a need to create a branch ?
must somebody make a code review before commiting ?
or just commit and make a pray to not have done a stupid mistake (newbe
mistake)
(I develop since many many year, but ... (we use svn not git))
JBG
Le jeu. 25 oct. 2018 à 11:26, Gordon Williams <notifications@github.com> a
écrit :
… Yes - best to ask on the forum. You'll have much better luck with Windows
10 Linux Subsystem or with a virtual machine running Linux though
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1489 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AXPNlxfVchuxiCuGvzq2F31JPANrKX-xks5uoYPWgaJpZM4V4Mkr>
.
|
Fixed with 1e6586a |
so we can't do any physics ...
to test:
console.log(1e-9) write 0
'x:" + 1e-9 write "x:0"
JSON.stringify({x:1e-9}) return ="{"a":0}"
Math.pow(2,-32) says 0
('' + 1e72).length says 69
JSON.stringify({x:1e80}) is also wrong so can't be communicate to an external service
console.log(1e100/3) write something not enough long ( or two long 3.333333333333333e+99 is the good answer)
the bug is in
file: jsutils.c
function: ftoa_bounded_extra
it must test if exponent must be added for example if
val < 1e-9 or val > 1e64 (I don't really know the actual limits)
but double value have 17 chars of precision so probably test val > 1e17 (it also depends of buffer length, normaly a buffer of 32 chars is good (sign + dot + 17 chars + e + sign + exponent max 3 char = 24 chars)
bug probably or some platform (esp32, esp8266, ...) we can use native library and smaller this code ... no ?
The text was updated successfully, but these errors were encountered: