thanks! is it because c++ double has 1 more significant figure than js, 
that cause the accuracy issue?

On Tuesday, June 25, 2019 at 8:19:18 PM UTC+8, Dan Elphick wrote:
>
> On Tuesday, June 25, 2019 at 10:24:56 AM UTC+1, Jerry Jin wrote:
>>
>> Hello, 
>> I'm new to v8-dev, sorry if this was already asked before.
>>
>> my problem is, i re-implemented a c++ numerical lib using typescript, and 
>> some test cases failed due to float number not having enough accuracy
>> (i debugged js/c++ code side by side with chrome devtool&msvc)
>> right now, my only option is to user third party lib like `decimal.js`
>>
>> i wonder is there any way to increase float number accuracy like c++ 
>> double type?
>>
>
>> example, is there anyway to store more than 15 decimal places in number
>>
>
> Javascript and V8 already use doubles to represent floating point numbers. 
> However double precision floating point numbers can have about 16 
> significant figures, so it's not possible to get any more accuracy using 
> C++ double. You may be able to print more than that (e.g. pi.ToFixed(30) 
> but they won't be accurate beyond 15 decimal places.
>   
>
>> ```
>> > let pi = 3.141592653589793238462643383280;
>> < undefined
>> > pi
>> < 3.141592653589793
>> ```
>>
>> not sure if this is possible in v8, if yes, where should i start?
>>
>> thanks!
>>
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/8f9081c5-28db-4e49-8381-d7f7e7132fc0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to