Page 1 of 1

double type

Posted: Tue Oct 29, 2002 4:41 pm
by Friend
Hi,

I was wondering if the type 'double' is a special type or not, can I use this in my own OS without anything special?

thanks.

Re:double type

Posted: Tue Oct 29, 2002 5:05 pm
by Tom
you mean hi dd 0?
you can do that if you use a extern long hi; if you use it in C.

Re:double type

Posted: Tue Oct 29, 2002 5:56 pm
by ark
this question is probably more suited to the OS Dev section...

Re:double type

Posted: Tue Oct 29, 2002 8:35 pm
by Schol-R-LEA
Friend wrote:I was wondering if the type 'double' is a special type or not, can I use this in my own OS without anything special?
That depends on a) the language you mean, b) the compiler or interpreter you are using, and c) how you've written you OS.

Assuming you mean the C/C++ 'double' type, and are compiling with gcc or some similar, then there shouldn't be a problem. The double type - usually implemented as 80-bit IEEE double precision floating point, IIRC - is a standard type in C and C++, and the compiler should generate the appropriate FPU code (or floating-point emulation if you aren't using the FPU for whatever reason). You may need to have certain CPU exception handlers in place ahead of time, but aside form that the OS shouldn't need to do much to support it.

For more information, try a few searches on a combination of keywords like
[tt]x86 FPU
double precision floating point
GNU compiler[/tt]

You may want to look up how your compiler actually implements floating point on the PC.

Re:double type

Posted: Wed Oct 30, 2002 12:35 am
by grey wolf
no, the double type is a 64-bit IEEE double-precision float. a long double is the 80-bit IEEE extended-precision float.

sorry to make a harsh correction, i just don't like seeing information misrepresented. ;D

Re:double type

Posted: Wed Oct 30, 2002 1:32 am
by Schol-R-LEA
Thank you, you are correct.