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
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to