IEEE754 is an extension that is located in the ext/misc of the standard distribution. Of course, before equality testing the numbers must be "normalized" so they have the same exponent ...
SQLite version 3.9.1 2015-10-22 18:06:40 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> SELECT ...> (9.2+7.9+0+4.0+2.6+1.3), ...> ieee754(9.2+7.9+0+4.0+2.6+1.3), ...> ieee754(25.0), ...> case when (9.2+7.9+0+4.0+2.6+1.3)=25.0 then "yes" else "no" end; 25.0|ieee754(7036874417766401,-48)|ieee754(25,0)|no >>> Decimal(7036874417766401) * Decimal(2**-48) Decimal('25.00000000000000355271367880') sqlite> SELECT ...> (9.2+7.8+0+3.0+1.3+1.7), ...> ieee754(9.2+7.8+0+3.0+1.3+1.7), ...> ieee754(23.0), ...> case when (9.2+7.8+0+3.0+1.3+1.7)=23.0 then "yes" else "no" end; 23.0|ieee754(23,0)|ieee754(23,0)|yes sqlite> SELECT ...> (9.2+7.9+0+1.0+1.3+1.6), ...> ieee754(9.2+7.9+0+1.0+1.3+1.6), ...> ieee754(21.0), ...> case when (9.2+7.9+0+1.0+1.3+1.6)=21.0 then "yes" else "no" end; 21.0|ieee754(5910974510923777,-48)|ieee754(21,0)|no >>> Decimal(5910974510923777) * Decimal(2**-48) Decimal('21.00000000000000355271367880') > -----Original Message----- > From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users- > bounces at mailinglists.sqlite.org] On Behalf Of Dominique Devienne > Sent: Friday, 23 October, 2015 08:39 > To: General Discussion of SQLite Database > Subject: Re: [sqlite] Simple Math Question > > On Fri, Oct 23, 2015 at 4:16 PM, Rousselot, Richard A < > Richard.A.Rousselot at centurylink.com> wrote: > > > So I decided to output 1000 digits, because why not? So now I am more > > perplexed with all these digits showing it is working the opposite of > how I > > expected it. Why is the second set of equations evaluating to a "yes" > when > > it is the only one that is obviously NOT equal to the expression??? > > > > Indeed, that's puzzling :) > > To know for sure, you'd need Keith's custom ieee754() function probably. > Until you can have a look at the actual bits of the computed double, to > see > the sign/exponent/mantissa at the binary level, hard to say. > Could be your use of 1000f too! 15 decimal digits is typical for double. > --DD > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users