]> git.ipfire.org Git - thirdparty/qemu.git/commit
softfloat: Fix factor 2 error for scalbn on denormal inputs
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 7 Jan 2014 17:17:50 +0000 (17:17 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 7 Jan 2014 19:18:07 +0000 (19:18 +0000)
commit0ace25a5676af233a9b5abf48599dbcc45f92dcf
tree729997b0a6e673f855ee77c3b531a6d327f1ee5d
parentf2e933d20d5fd6c38bda227359b79bcc81654f99
softfloat: Fix factor 2 error for scalbn on denormal inputs

If the input to float*_scalbn() is denormal then it represents
a number 0.[mantissabits] * 2^(1-exponentbias) (and the actual
exponent field is all zeroes). This means that when we convert
it to our unpacked encoding the unpacked exponent must be one
greater than for a normal number, which represents
1.[mantissabits] * 2^(e-exponentbias) for an exponent field e.

This meant we were giving answers too small by a factor of 2 for
all denormal inputs.

Note that the float-to-int routines also have this behaviour
of not adjusting the exponent for denormals; however there it is
harmless because denormals will all convert to integer zero anyway.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
fpu/softfloat.c