А я брахаць ня ўмею, дык і завыў - April 13th, 2006

April 13th, 2006

April 13th, 2006
11:01 am
[User Picture]

[Link]

SQL Server stinks!
SELECT Round(59999.0 * 0.155,2)
9299.8500 - correct

SELECT Round(Cast(59999.0 as money) * Cast(0.155 as float),2)
9299.8400000000001 - wrong!

Fix:
SELECT Round(Cast(Cast(59999.0 as money) * Cast(0.155 as float) as money) ,2)

Tags: ,

(2 comments | Leave a comment)

Previous Day 2006/04/13
[Archive]
Next Day
Powered by LJ.Rossia.org