Created
February 10, 2015 14:20
-
-
Save ryepup/53d677c4021ce46c16c7 to your computer and use it in GitHub Desktop.
fun with rounding and data types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @x money, @t money | |
SET @x = 15062.53 | |
SET @t = 51679.61 | |
SELECT | |
15062.53/51679.61, | |
-- 0.2914598233 | |
@x / @t, | |
-- 0.2914 | |
CAST(@x as decimal) / @t, | |
-- 0.2914667182662538699 | |
CAST(@x as decimal) / CAST(@t as decimal), | |
-- 0.2914689178188457 | |
CAST(@x as float) / @t, | |
-- 0.29145982332297 | |
CAST(@x as float) / CAST(@t as float) | |
-- 0.29145982332297 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment