https://www.sqlite.org/cgi/src/info/7fa8f16e586a52ac

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

https://www.sqlite.org/cgi/src/info/7fa8f16e586a52ac

Cezary H. Noweta
Hello,

> **     ieee754(4503599627370496,972)  ->   +Inf
> **     ieee754(4503599627370496,972)  ->   -Inf

Missing - in the second mantissa, and a next missing -:

>     }else if( m==0 && e>1000 && e<1000 ){
>       sqlite3_result_double(context, 0.0);
>       return;
>     }

gives:

> ieee754(0,0) == 4.5036e+015
> ieee754(0,-1) == 2.2518e+015
> ieee754(0,-10) == 4.39805e+012
> ieee754(0,-100) == 3.55271e-015
> ieee754(0,1) == 9.0072e+015
> ieee754(0,10) == 4.61169e+018
> ieee754(0,100) == 5.70899e+045
> ieee754(0,-1074) == 2.22507e-308
> ieee754(0,-1075) == 0
> ieee754(0,971) == 8.98847e+307
> ieee754(0,972) == 1.#INF
> ieee754(4503599627370496,972) == 1.#INF
> ieee754(-4503599627370496,972) == -1.#INF

BTW. What is a problem with not checking an exponent if a mantissa == 0?
What is this checking for? What results would be expected (other then 0)
if an exponent was out of (-1000;1000) range? That checking is from the
beginning, so I cannot deduce what rationale was for it. Info states that:

> **   ieee754(Y,Z)
> **    [...]
> ** In the second form, Y and Z are integers which are the mantissa and
> ** base-2 exponent of a new floating point number.  The function returns
> ** a floating-point value equal to Y*pow(2,Z).

0 * 2^?? == 0. Zero times positive, finite number gives zero always.
There is no Inf in i64 type to produce NaN from 0 * 2^Inf.

-- best regards

Cezary H. Noweta
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users