help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Check for DENORMAL (subnormal) numbers failed (iee-utils/


From: Stephan Petzchen
Subject: Re: [Help-gsl] Check for DENORMAL (subnormal) numbers failed (iee-utils/test.c (185))
Date: Wed, 14 Nov 2012 17:01:36 +0100

SOLVED! AS so often tiny typo big effect...sorry for disturbing.....

Here is now the correct result:

Run: 0
Float: FLT_MIN/2^1: 5,877472E-39
Sign: +
Exponent: -127
Mantisse: 10000000000000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 1
Float: FLT_MIN/2^2: 2,938736E-39
Sign: +
Exponent: -127
Mantisse: 01000000000000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 2
Float: FLT_MIN/2^3: 1,469368E-39
Sign: +
Exponent: -127
Mantisse: 00100000000000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 3
Float: FLT_MIN/2^4: 7,34684E-40
Sign: +
Exponent: -127
Mantisse: 00010000000000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 4
Float: FLT_MIN/2^5: 3,67342E-40
Sign: +
Exponent: -127
Mantisse: 00001000000000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 5
Float: FLT_MIN/2^6: 1,83671E-40
Sign: +
Exponent: -127
Mantisse: 00000100000000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 6
Float: FLT_MIN/2^7: 9,18355E-41
Sign: +
Exponent: -127
Mantisse: 00000010000000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 7
Float: FLT_MIN/2^8: 4,591775E-41
Sign: +
Exponent: -127
Mantisse: 00000001000000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 8
Float: FLT_MIN/2^9: 2,295887E-41
Sign: +
Exponent: -127
Mantisse: 00000000100000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 9
Float: FLT_MIN/2^10: 1,147944E-41
Sign: +
Exponent: -127
Mantisse: 00000000010000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 10
Float: FLT_MIN/2^11: 5,739719E-42
Sign: +
Exponent: -127
Mantisse: 00000000001000000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 11
Float: FLT_MIN/2^12: 2,869859E-42
Sign: +
Exponent: -127
Mantisse: 00000000000100000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 12
Float: FLT_MIN/2^13: 1,43493E-42
Sign: +
Exponent: -127
Mantisse: 00000000000010000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 13
Float: FLT_MIN/2^14: 7,174648E-43
Sign: +
Exponent: -127
Mantisse: 00000000000001000000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 14
Float: FLT_MIN/2^15: 3,587324E-43
Sign: +
Exponent: -127
Mantisse: 00000000000000100000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 15
Float: FLT_MIN/2^16: 1,793662E-43
Sign: +
Exponent: -127
Mantisse: 00000000000000010000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 16
Float: FLT_MIN/2^17: 8,96831E-44
Sign: +
Exponent: -127
Mantisse: 00000000000000001000000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 17
Float: FLT_MIN/2^18: 4,484155E-44
Sign: +
Exponent: -127
Mantisse: 00000000000000000100000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 18
Float: FLT_MIN/2^19: 2,242078E-44
Sign: +
Exponent: -127
Mantisse: 00000000000000000010000
Type: GSL_IEEE_TYPE_DENORMAL
Run: 19
Float: FLT_MIN/2^20: 1,121039E-44
Sign: +
Exponent: -127
Mantisse: 00000000000000000001000
Type: GSL_IEEE_TYPE_DENORMAL

Run: 20
Float: FLT_MIN/2^21: 5,605194E-45
Sign: +
Exponent: -127
Mantisse: 00000000000000000000100
Type: GSL_IEEE_TYPE_DENORMAL

Run: 21
Float: FLT_MIN/2^22: 2,802597E-45
Sign: +
Exponent: -127
Mantisse: 00000000000000000000010
Type: GSL_IEEE_TYPE_DENORMAL

Run: 22
Float: FLT_MIN/2^23: 1,401298E-45
Sign: +
Exponent: -127
Mantisse: 00000000000000000000001
Type: GSL_IEEE_TYPE_DENORMAL



On Wed, Nov 14, 2012 at 4:21 PM, Stephan Petzchen <
address@hidden> wrote:

>
> 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);
>
>
>
>


-- 

Gesius GmbH
Beim Strohhause 31
20097 Hamburg, Germany
Tel.    +49 (40) 6094673-10
Mobil +49 (172) 1977014
Fax   +49 (40) 6094673-99
email: address@hidden <address@hidden>
www.gesius.de <http://gesius.de>

gesius. engineering excellence

Sitz der Gesellschaft/Registered office: Hamburg

Handelsregister/Commercial register:  HRB 117558

Geschäftsführung/executive board: Stephan Petzchen

---
This communication contains confidential information. If you are not the
intended recipient please return this email to the sender and delete it
from your records.
Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der
beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den
Absender zurück und löschen Sie die E-mail aus Ihrem System.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]