Re: représentation des réel simple précision

Jean-Pierre Rosen <[email protected]>
Newsgroups gmane.comp.lang.ada.france
Organization Adalog
Message-ID <[email protected]>
parsy jean-pierre a écrit :
> Le format de réels est expliqué dans la doc java
> 
> http://java.sun.com/j2se/1.4.2/docs/api/
> 
> dans les classes Float et Double du paquetage
> java.lang
> 
> La classe Float comporte les méthodes :
> 
> static float intBitsToFloat(int bits)
> 
>    Returns the float value corresponding to a given
> bit represention.
> 
> static int 	floatToRawIntBits(float value)
>    Returns a representation of the specified
> floating-point
>    value according to the IEEE 754 floating-point 
>    "single format" bit layout, 
>    preserving Not-a-Number (NaN) values.
Attention: remarquer IEEE ci-dessus

> ------------------------------------------   
> Un float (réel simple) peut se normaliser sous la
> forme
>      s * m * 2^e 
> avec la mantisse  1<=m<2 
> 
> Par exemple 10 s'écrit en binaire 1010 on obtient
> après 
> normalisation 1.010*2^3
> 
> Après cette opération de normalisation, le bit de
> poids fort est toujours à 1, pour gagner de la place
> il n'est pas stocké.
> 
> Un float (réel simple) est codé sur 4 octets
> bit  31      s
> bits 30-23   e + 0x7f
> bits 22-0    m ( sans le bit m-1)
C'est une représentation possible. Ce n'est pas la seule, et en 
particulier ce n'est pas la représentation IEEE.

-- 
---------------------------------------------------------
            J-P. Rosen ([email protected])
Visit Adalog's web site at http://www.adalog.fr
_______________________________________________
Site WWW de l'association Ada-France: http://www.ada-france.org/
[email protected]
http://www.ada-france.org/mailman/listinfo/ada-france
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.