double type

Programming, for all ages and all languages.
Post Reply
Friend

double type

Post 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.
Tom

Re:double type

Post by Tom »

you mean hi dd 0?
you can do that if you use a extern long hi; if you use it in C.
ark

Re:double type

Post by ark »

this question is probably more suited to the OS Dev section...
Schol-R-LEA

Re:double type

Post 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.
grey wolf

Re:double type

Post 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
Schol-R-LEA

Re:double type

Post by Schol-R-LEA »

Thank you, you are correct.
Post Reply