|
From: John R. <jr...@bi...> - 2015-12-07 12:39:53
|
> Duplicating the discussion from the V8 user group: > > https://groups.google.com/forum/#!topic/v8-users/qRorKvYNq24 > > On Fri, Dec 4, 2015 at 3:26 PM, Wilfried Gösgens <do...@gm...> wrote: > > Hi everyone > > Using the regular d8 shell: > > > > # ./d8 > > V8 version 4.8.271.5 > > d8> Math.pow(0, 0.1); > > 0 > > d8> > > > > gives proper results. > > But using d8 in valgrind gives: > > > > /usr/bin/valgrind.bin --log-file=/tmp/valgrindlog.%p > > --show-reachable=yes --leak-check=full ./d8 > > Math.pow(0, 0.1); > > V8 version 4.8.271.5 > > d8> NaN > > d8> > Does valgrind replace mathematical functions? No, but valgrind forces round-to-nearest 64-bit result for every floating-point operation: no extra precision nor exponent range for 80-bit extended opcodes, and no directed rounding (truncate, ceil, floor). This is well documented. Thus if the user code relies on 80-bit mode or rounding other than round-to-nearest, then "bad results" may ensue. The bug is in V8 not diagnosing the actual environment before proceeding. Never run a laboratory experiment for quantitative results without first calibrating the instruments. |