really small numbers

Started by
23 comments, last by Mulligan 21 years, 8 months ago
I have to store the number 0.00000000006670 in a data type. Which should I use?
Advertisement
use long double or unsigned double OR long unsigned double.

Knowledge is what you learn, wisdom is how you apply it.

Beginner in Game Development?  Read here. And read here.

 

er, you can''t do that.
Long is the biggest / smallest you can go. Its 64bits if i''m not mistaken


"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I''m reaching up and reaching out. I''m reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one''s been. We''ll ride the spiral to the end and may just go where no one''s been." - Maynard James Keenan [TheBlackJester ]
[Wildfire Studios ]

"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I'm reaching up and reaching out. I'm reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one's been. We'll ride the spiral to the end and may just go where no one's been." - Maynard James Keenan Name: [email=darkswordtbj@hotmail.com]TheBlackJester[/email]Team: Wildfire Games
Projects O A.D.The Last Alliance

quote:Original post by Mulligan
er, you can't do that.


According to the standard you can. But then again, MSVC isn't totally compliant, if that's what you're basing your assumptions on.

[edited by - zealouselixir on August 30, 2002 12:45:35 AM]

[twitter]warrenm[/twitter]

I think that float should be able to handle it, but if float doesn''t work try double . Thats in c++. In VB, I''m not sure, I believe the types are something like single and double .
oops, you can do that. Whats the smallest value possble when using a long unsigned double?
Floating point numbers only have precision loss on VERY little numbers - your one isn't very little

66.7f is as good as 0.00000000006670f
that's why it's called floating point...
even that number is nice for a float and won't have badder precision than the above:
0.000000000000000000000000000000000000006670f

Don't use "long double"! They are 80-bit numbers and the FPU can't handle loading them from memory in a calculation, so the compiler must add a load instruction before every one. "double" should be enough for everything, and even float is good enough for most things. "float" is also much faster.


[edited by - noVum on August 31, 2002 1:01:44 AM]
quote:Original post by TheBlackJester
Long is the biggest / smallest you can go. Its 64bits if i''m not mistaken


Uh, no. In Win32, a long is equivalent to a 32-bit integer. Doubles are 64-bits, and long doubles are 80-bits, according to the standard.

Later,
ZE.


//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[twitter]warrenm[/twitter]

Smallest possible value for a long unsigned double? Gee, I''m guessing around 1.2x10^-9863 maybe...

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[twitter]warrenm[/twitter]

This topic is closed to new replies.

Advertisement