[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Check for DENORMAL (subnormal) numbers failed (iee-utils/test
From: |
Stephan Petzchen |
Subject: |
[Help-gsl] Check for DENORMAL (subnormal) numbers failed (iee-utils/test.c (185)) |
Date: |
Wed, 14 Nov 2012 16:21:37 +0100 |
Hi,
I am checking gsl for IEEE denormal resp. subnormal numbers. I took the
test case from gsl in: iee-utils/test.c (185).
Unfortunately I do not get the expected results:
1. Exponent is -126 instead -127
2. Mantisse should be: 10000000000000000000000 instead of
00000000000000000000000
3. IEEE Type is Normal instead of denormal.
*Expected output:*
Run: 0
Float: FLT_MIN/2^1
Sign: +
Exponent: -127
Mantisse: 10000000000000000000000
Type: GSL_IEEE_TYPE_DENORMAL
*Actual output:*
Run: 0
Float: FLT_MIN/2^1: 5,877472E-39
Sign: +
Exponent: -126
Mantisse: 00000000000000000000000
Type: GSL_IEEE_TYPE_NORMAL
Maybe someone can give me a hint whats going wrong here.
I am working with the mono framework/C# and gsl 1.15. Testcases for normal
numbers passed as expected.
Thanks in advance.
best,
Stephan
Here is my code:
public const float GSL_FLT_MIN = 1.1754943508222875e-38f ;
float f = (float)gsl_machine.GSL_FLT_MIN;
char[] cmantissa = new
char[]{'1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
string mantissa="10000000000000000000000";
gsl_ieee_float_rep r = new gsl_ieee_float_rep ();
for (int i = 0; i < 23; i++) {
float x = (float)(f / (float)System.Math.Pow (2.0f, 1f + (float) i));
cmantissa[i] = '1';
mantissa=new String(cmantissa);
gsl_ieee_utils.gsl_ieee_float_to_rep (&f, ref r);
Assert.AreEqual (0, r.sign);
Assert.AreEqual (-127, r.exponent);
Assert.AreEqual (mantissa, r.mantissa);
Assert.AreEqual ((int)GSL_IEEE_TYPE.GSL_IEEE_TYPE_DENORMAL, r.type);
- [Help-gsl] Check for DENORMAL (subnormal) numbers failed (iee-utils/test.c (185)),
Stephan Petzchen <=