Skip to main content
gamedev.net
🔒 Locked

Arbitrary floating-point precision

Started by Dave007 7 replies 950+ views
Original Post
Dave007
Dave007
I would like to know if there is a practical use for computing with high (say more than 5000 digits) floating point precision? Thnx ------ Dave Math Studio
--------Dave[ Math Studio ] A Computer Algebra System
cyn
cyn
Define practical. For gaming, that much precision is overkill. For scientific fields, it may not be enough. It just depends on the target application.

Personally, I think it is a great learning exercise, as I am currently working on an arbitrary length integer class for use on the RSA challenge numbers. Originally they weren''t very fast, but the more I work with them, the more I understand how to improve them.

cyn
YoshiN
YoshiN
What if you want to calculate PI to one million digits? There it would be practicle to use floats with arbitrary lengths.
-YoshiXGXCX ''99
Dave007
Dave007
quote:

Define practical. For gaming, that much precision is overkill. For scientific fields, it may not be enough. It just depends on the target application.

Personally, I think it is a great learning exercise, as I am currently working on an arbitrary length integer class for use on the RSA challenge numbers. Originally they weren't very fast, but the more I work with them, the more I understand how to improve them.

cyn



Well, I'm working on a CAS (Computer Algebra System) and I just want to know how much time should I spend on doing arbitrary precision library. So it's from scientific point of view. I know I can learn a lot, but unfortunately I can't do everything...
Can you give me an example where I need a lot floating point digits?

quote:
What if you want to calculate PI to one million digits? There it would be practicle to use floats with arbitrary lengths.


That's what am I asking for .. why would you need millions of digits for pi?

--------
Dave

[edited by - Dave007 on November 19, 2003 2:38:24 PM]
--------Dave[ Math Studio ] A Computer Algebra System
eighty
eighty
You only need pi to 36 decimal places to calculate the circumference of the known universe to subatomic precision.
justo
justo
wow you guys are really helpful. i''m sure the op is thrilled with your responses.

anyway, one method you could use is to create a really large int datatype that will hold ints as large as you want (like there''s _int64 in VC++, but you want muuuuch bigger).

then there are methods for calculating a fixed point version of pi...just google for them. that''ll be the easy part, managing carries and actually printing a decimal version of the number will be the hard part.

you could also make a larger floating point type, but i''ve never tried it...don''t know how much harder it would be.

hope that helps,
justo
Dave007
Dave007
So computing something to millions (or just even) of floating point digits is more an intelectual challenge than an usefull thing?
The situation with big integers is a bit different ... you need to have all the digits valid.
I''m talking only floating point numbers.

Say I write arbitrary float library with maximum of 3-5 usigned int mantissa digits and an integer exponent. Is this be enough for most of the practical (understand scientific) computations??
--------Dave[ Math Studio ] A Computer Algebra System
LousyPhreak
LousyPhreak
not sure if it helps you (maybe you want to try writing your own for educational purposes) but afaik the gnu mp library was made just for those issues (scientific, big numbers).
i also don''t think that it uses floating point numbers (and don''t think fp is used much in scientific apps) because fp will loose precision at some point.
http://mitglied.lycos.de/lousyphreak/
LilBudyWizer
LilBudyWizer
I don''t know. High precision calculations with floating point numbers seems a bit suspect. It just seems to scream wild ass guess as to the effect of the errors I introduced to this process. Golly, I used a million decimal places every step of the way, I don''t know why I''m an order of magnitude off since I should be right to a million places. Maybe there is a bug in the software.
Keys to success: Ability, ambition and opportunity.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.