[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sqlite-users
Subject:    Re: [sqlite] =?utf-8?q?Simple_Math_Question?=
From:       Tim Streater <tim () clothears ! org ! uk>
Date:       2015-10-22 22:09:00
Message-ID: E1ZpO3S-0003NX-7Y () mailscan0 ! hi ! local
[Download RAW message or body]

On 22 Oct 2015 at 21:25, Richard A Rousselot <Richard.A.Rousselot@centurylink.com> \
wrote: 

> I fully expected something like this from a fractional number like 1/3 but
> didn't realize that this would be the case if when the digits were explicitly
> stated and they summed to a whole number. I will use a Cast statement to
> resolve.

> On Thu, Oct 22, 2015 at 9:45 PM, Rousselot, Richard A <
> Richard.A.Rousselot@centurylink.com> wrote:
> 
> > Doing the following math, why is it that the results are not all
> > returning "yes"?
> > 
> > SELECT
> > (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,
> > (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,
> > (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

These numbers may be specifiable exactly in decimal to one place of decimals, but can \
they be expressed exactly in binary floating point? If not, then it's not gonna work. \
I first came across this issue 50 years ago when I wrote my first program - to \
calculate square roots using Newton's Method.

--
Cheers  --  Tim



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic