Wednesday, May 28, 2014

Should this value be real or float?

can you split and store the significand (coefficient) and exponent in separate columns?



DECLARE @LargePrecision TABLE
(
[Significand] FLOAT(53),
[Exponent] INT
);

INSERT INTO @LargePrecision([Significand], [Exponent])
VALUES (5.36018671369611, -20)

SELECT *,
CASE WHEN [Exponent] > 0.0
THEN [Significand] * POWER(10.0, [Exponent])
ELSE [Significand] / POWER(10.0, ABS([Exponent]))
END
FROM @LargePrecision



HOWEVER, the result continues to be out of range.


No comments:

Post a Comment