fixed an embarassing bug, X band 1 == 1 does not test whether X is even

This commit is contained in:
alisdair sullivan 2010-08-05 21:01:23 -07:00
parent 8e21ab9145
commit ab7f1c8353

View file

@ -114,7 +114,7 @@ float_to_decimal(Num) when is_float(Num) ->
{F, E} = extract(<<Num:64/float>>),
{R, S, MP, MM} = initial_vals(F, E),
K = ceiling(math:log10(abs(Num)) - 1.0e-10),
Round = F band 1 =:= 1,
Round = F band 1 =:= 0,
{Dpoint, Digits} = scale(R, S, MP, MM, K, Round),
if Num >= 0 -> format(Dpoint, Digits)
; Num < 0 -> "-" ++ format(Dpoint, Digits)