* [9fans] plan 9 floating point representation
@ 2009-05-20 9:49 hugo rivera
0 siblings, 0 replies; 3+ messages in thread
From: hugo rivera @ 2009-05-20 9:49 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
Hi,
I am learning a bit about floating point representation and I am
wondering about how plan 9 does this.
According to IEEE 754 (I think) the convention used by C for single
precision floating point numbers is to use 24 of the 32 bits available
for the significand and 8 bits for the exponent. It seems to me that
plan 9 follows this convention but I am still kind of puzzled about
the base of the exponent. I've been experimenting (on a 386) a while
and it looks like a base 4 to me, which is kind of strange, since I
was expecting a base 2 or 10. I think I got something wrong, but I
would appreciate if someone can explain this to me to have a better
idea of how this works. It looks to me that this stuff is very machine
dependent (or language?), is it?
The point of all this is to classify raw data (4 byte length)
according to their magnitude, I don't really care about the
significant. This is just an exercise for me, since there are other
easier ways to do it.
Saludos
--
Hugo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] plan 9 floating point representation
2009-05-20 10:46 Jonas Amoson
@ 2009-05-20 12:38 ` hugo rivera
0 siblings, 0 replies; 3+ messages in thread
From: hugo rivera @ 2009-05-20 12:38 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
thanks, I'll study it with care.
Saludos
2009/5/20, Jonas Amoson <jonas.amoson@home.se>:
>
> Hello Hugo,
>
>
> Done some experiments with the indivudual
> bits in Lunix, and would be very surprised
> if it is not handled the same under Plan 9,
> given the same hardware architecture.
>
> The exponent is stored in base 2, but What
> might be a bit confusing, is that it is not
> stored using two's complement, but rather
> using a bias. If you have an exponent of 8
> bits (in a 32-bit IEEE float) an exponent of
> zero is represented by '10000000' or 127.
> Simply add the desired exponent, whether pos
> or neg. -1 will be 126, +1 will be 128.
>
> This link explains the whole thing in more detail:
> http://steve.hollasch.net/cgindex/coding/ieeefloat.html
>
> /jonas
>
> <-----Ursprungligt Meddelande----->
> From: hugo rivera [uair00@gmail.com]
> Sent: 20/5/2009 11:50:51 AM
> To: 9fans@9fans.net
> Subject: [9fans] plan 9 floating point representation
>
> Hi,
> I am learning a bit about floating point representation and I am
> wondering about how plan 9 does this.
> According to IEEE 754 (I think) the convention used by C for single
> precision floating point numbers is to use 24 of the 32 bits available
> for the significand and 8 bits for the exponent. It seems to me that
> plan 9 follows this convention but I am still kind of puzzled about
> the base of the exponent. I've been experimenting (on a 386) a while
> and it looks like a base 4 to me, which is kind of strange, since I
> was expecting a base 2 or 10. I think I got something wrong, but I
> would appreciate if someone can explain this to me to have a better
> idea of how this works. It looks to me that this stuff is very machine
> dependent (or language?), is it?
> The point of all this is to classify raw data (4 byte length)
> according to their magnitude, I don't really care about the
> significant. This is just an exercise for me, since there are other
> easier ways to do it.
>
> Saludos
> --
> Hugo
>
> .
>
>
>
>
> _______________________________________________________________
> Eniro Supersök - är vad det heter
>
>
--
Hugo
^ permalink raw reply [flat|nested] 3+ messages in thread
* [9fans] plan 9 floating point representation
@ 2009-05-20 10:46 Jonas Amoson
2009-05-20 12:38 ` hugo rivera
0 siblings, 1 reply; 3+ messages in thread
From: Jonas Amoson @ 2009-05-20 10:46 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 2204 bytes --]
Hello Hugo,
Done some experiments with the indivudual
bits in Lunix, and would be very surprised
if it is not handled the same under Plan 9,
given the same hardware architecture.
The exponent is stored in base 2, but What
might be a bit confusing, is that it is not
stored using two's complement, but rather
using a bias. If you have an exponent of 8
bits (in a 32-bit IEEE float) an exponent of
zero is represented by '10000000' or 127.
Simply add the desired exponent, whether pos
or neg. -1 will be 126, +1 will be 128.
This link explains the whole thing in more detail:
http://steve.hollasch.net/cgindex/coding/ieeefloat.html
/jonas
<-----Ursprungligt Meddelande----->
From: hugo rivera [uair00@gmail.com]
Sent: 20/5/2009 11:50:51 AM
To: 9fans@9fans.net
Subject: [9fans] plan 9 floating point representation
Hi,
I am learning a bit about floating point representation and I am
wondering about how plan 9 does this.
According to IEEE 754 (I think) the convention used by C for single
precision floating point numbers is to use 24 of the 32 bits available
for the significand and 8 bits for the exponent. It seems to me that
plan 9 follows this convention but I am still kind of puzzled about
the base of the exponent. I've been experimenting (on a 386) a while
and it looks like a base 4 to me, which is kind of strange, since I
was expecting a base 2 or 10. I think I got something wrong, but I
would appreciate if someone can explain this to me to have a better
idea of how this works. It looks to me that this stuff is very machine
dependent (or language?), is it?
The point of all this is to classify raw data (4 byte length)
according to their magnitude, I don't really care about the
significant. This is just an exercise for me, since there are other
easier ways to do it.
Saludos
--
Hugo
.
<P><p><font face="Arial, Helvetica, sans-serif" size="2" style="font-size:13.5px">_______________________________________________________________<BR><a style="font-family: Tahoma, sans-serif; font-size: 10px; color: #00f" href="http://www.eniro.se/?partnerid=spray_mail" target="_blank">Eniro Supers�k - �r vad det heter</a></font>
[-- Attachment #2: Type: text/html, Size: 2509 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-05-20 12:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-20 9:49 [9fans] plan 9 floating point representation hugo rivera
2009-05-20 10:46 Jonas Amoson
2009-05-20 12:38 ` hugo rivera
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).