The platforms exhibiting the behavior have so far been MSVC Windows 10 64-bit 
(both 32 and 64 bit processes), and Android x86.  iOS 64-bit was not affected 
and iOS 32-bit was not testable due to outside factors but my guess is that it 
is not affected.  macOS 64-bit was not affected.

I tried to come up with a simpler test case than the one I had but I was unsure 
of how to trigger a path that entered 'codeReal'.  For reference here was the 
query that I was working with:

SELECT fl_result(prediction('EchoModel', dict_of('max_double', 
1.7976931348623153e+308))) FROM kv_default AS _doc WHERE (_doc.flags & 1 = 0);

Between here and when dict_of was called, the value became a false infinity 
(i.e. sqlite3_value_double returned inf).  I couldn't reproduce this by just 
selecting a literal from a query, which made me think it might be taking 
another path.  Since I couldn't figure out how to trigger it that way, I just 
put in a call to strtod alongside the call to sqlite3AtoF inside of codeReal 
and compared the results.


Jim Borden

On 2019/02/28 8:50, "drhsql...@gmail.com on behalf of Richard Hipp" 
<drhsql...@gmail.com on behalf of d...@sqlite.org> wrote:

    On 2/27/19, Jim Borden <jim.bor...@couchbase.com> wrote:
    >
    > My theory as to why this varies by platform is because of the use of long
    > double during this calculation, which can vary in size.  On the failing
    > platforms they are the same size as regular double.  This results in a
    > rounding error of the "scale" portion of the calculation (via 
sqlite3Pow10)
    > which results in a false infinity.

    Just out of curiosity, what platforms are you having trouble with.  I
    tried the script below on each of Linux (Ubuntu with gcc 5.4.0), Mac
    (LLVM 10.0.0), and Win10 (MSVC) and got the answer you expect in all
    three cases, namely 1.79769313486231522322e+308,
    8.98846567431157611547e+307, Inf.

    SELECT quote(1.7976931348623153E+308);
    SELECT quote(1.7976931348623153E+308/2.0);
    SELECT quote(1.7976931348623153E+308*2.0);

    --
    D. Richard Hipp
    d...@sqlite.org



Privacy Policy<http://www.couchbase.com/privacy-policy>
Marketing 
Preferences<http://info.couchbase.com/unsubscribe-or-manage-preferences>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to