lukewagner / polyfill-prototype-1

Experimental WebAssembly polyfill library and tools
Apache License 2.0
241 stars 42 forks source link

Double fixes #7

Closed kripken closed 9 years ago

kripken commented 9 years ago

This uses a new emscripten API to properly print doubles with full precision - since JS engines have that ability, it just hands off the problem to them.

This does not solve the problem when running the unpacker natively. See #5 for discussion.

BrendanEich commented 9 years ago

LOL, I tried using %g in the first JS ("Mocha") implementation, it didn't work then and it doesn't now. The dtoa.c code from David M. Gay (on ftplib in old days) lives on!

/be

kripken commented 9 years ago

Heh, funny that this issue goes so far back.

Emscripten's JS AST printer uses this code which tries a few snprintf approaches and picks the smallest out of the fully accurate. It's mostly pretty good, but not always the smallest. We should probably just import dtoa.c. Over 3,000 lines though...

lukewagner commented 9 years ago

Heh, yeah, I knew this was cheating :)