Dominique,

Thanks for that idea but now I have more questions?

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???

SELECT
                printf('%4.1000f',9.2+7.9+0+4.0+2.6+1.3),
                case when (9.2+7.9+0+4.0+2.6+1.3)=25.0 then "yes" else "no" end,
                printf('%4.1000f',9.2+7.8+0+3.0+1.3+1.7),
                case when (9.2+7.8+0+3.0+1.3+1.7)=23.0 then "yes" else "no" end,
                printf('%4.1000f',9.2+7.9+0+1.0+1.3+1.6),
                case when (9.2+7.9+0+1.0+1.3+1.6)=21.0 then "yes" else "no" end

Result
25.00000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000|no|22.999999999999990000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000|yes|21.00000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000|no

-----Original Message-----
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Dominique 
Devienne
Sent: Friday, October 23, 2015 8:54 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Simple Math Question

On Fri, Oct 23, 2015 at 3:45 PM, Rousselot, Richard A < Richard.A.Rousselot at 
centurylink.com> wrote:

> Anyhow, one last question.  If the case statements are evaluating
> something that is not a whole number (or better yet not exactly
> matching on both sides of the equation) .  Why is it that when
> displaying the results of the math sqlite does not produce something
> like 25.00000000000003 or 22.99999999999?  Shouldn't the result have all 
> significant digits showing?
> I guess that is why these results seem misleading.
>

The output is done by sqlite3.exe, the command line shell, and you'd have to 
look at its code to know for sure.
But instead, take control of the formatting, by using printf() from 
https://www.sqlite.org/lang_corefunc.html and use a format with more precision, 
and you should see the differences I think. --DD 
_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
This communication is the property of CenturyLink and may contain confidential 
or privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful. If you have received this communication in 
error, please immediately notify the sender by reply e-mail and destroy all 
copies of the communication and any attachments.

Reply via email to