• Advertisement

Archived

This topic is now archived and is closed to further replies.

really small numbers

This topic is 5709 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have to store the number 0.00000000006670 in a data type. Which should I use?

Share this post


Link to post
Share on other sites
Advertisement
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 ]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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 .

Share this post


Link to post
Share on other sites
oops, you can do that. Whats the smallest value possble when using a long unsigned double?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement