I've bitched about MS SQL Server before. This shows no sign of lessening...
Consider this simple little code example.
These are expected results. However, float is hiding something. It's hiding the sad fact that Microsoft's flagship Enterprise product is confused by simple addition.
Change one line like so:
create table #FloatTest (seq [int] IDENTITY(1,1), a float(24), b float(53) )
This is isn't a change to stored value a, but rather just the bucket size. The results should be identical. Of course, they're not.
I was, of course, made aware of this when attempting do something like "select * from #FloatTest where floor(b)=b" and getting no values. One fix, the one I'll probably have to go with, is a casting hack like "select * from #FloatTest where floor(cast(b as float(24)))=cast(b as float(24))".
Yeah, b is still 0.999999992549419, but that's what I have.
MS SQL Server sure is easy to maintain. That GUI is cool. Backup and restore is a no brainer. Too bad it's buggier than picnic potato salad at high noon.
Anyway, that's my Microsoft journey for today. For an easy, play at home version, try this: select cast(cast(0.1 as float(12)) as float(53))
Yep, still buggy.
Consider this simple little code example.
create table #FloatTest (seq [int] IDENTITY(1,1), a float(24), b float(24) )
insert into #FloatTest(a) values(0.1)
insert into #FloatTest(a) values(0.2)
insert into #FloatTest(a) values(0.7)
insert into #FloatTest(a) values(0.1)
update #FloatTest
set b = ( select sum(a) from #FloatTest b where b.Seq<=a.Seq )
from #FloatTest a
select a,b from #FloatTest order by seq
a b
------------- -----
0.1 0.1
0.2 0.3
0.7 1
0.1 1.1
These are expected results. However, float is hiding something. It's hiding the sad fact that Microsoft's flagship Enterprise product is confused by simple addition.
Change one line like so:
create table #FloatTest (seq [int] IDENTITY(1,1), a float(24), b float(53) )
This is isn't a change to stored value a, but rather just the bucket size. The results should be identical. Of course, they're not.
a b
------------- -----------------
0.1 0.100000001490116
0.2 0.300000004470348
0.7 0.999999992549419
0.1 1.09999999403954
I was, of course, made aware of this when attempting do something like "select * from #FloatTest where floor(b)=b" and getting no values. One fix, the one I'll probably have to go with, is a casting hack like "select * from #FloatTest where floor(cast(b as float(24)))=cast(b as float(24))".
Yeah, b is still 0.999999992549419, but that's what I have.
MS SQL Server sure is easy to maintain. That GUI is cool. Backup and restore is a no brainer. Too bad it's buggier than picnic potato salad at high noon.
Anyway, that's my Microsoft journey for today. For an easy, play at home version, try this: select cast(cast(0.1 as float(12)) as float(53))
Yep, still buggy.
From:
no subject
From:
no subject
Imagine my information is a shot of espresso. The cafe only sells small cups and large cups. The espresso doesn't fill the cups, so they are always topped up with milk. I order a small; shot, milk, fine. I order a large; shot, milk, fine. With me so far?
I order a small. Then decide a want a large. My small is poured into a large cup, but it's not full. Rather than topping it up with milk, my beleaguered barrista tops it up with what's left over from different cup. Now, instead of exactly one shot, I have a shot plus some unknown dregs from a different cup.
In a nutshell, that's the problem; poor service at the coffee shop. ;)
From:
no subject
Y'no...I really don't miss that damned DB....
(and ironically? It was dropped from usage shortly after my Dept was let go...seems the outsourced company considered it too cumbersome)