View Full Version : Getting out of floating point
jcb344
- 5th August 2008, 18:48
I was wondering if anybody knows of a way to do this calculation without a floating point co processor.
(6.67*10-11)(50)(75)/(0.5)(0.5)
Any input would be greatly appreciated.
skimask
- 5th August 2008, 18:54
I was wondering if anybody knows of a way to do this calculation without a floating point co processor.
(6.67*10-11)(50)(75)/(0.5)(0.5)
Obviously, you can't do fractions with PBP...
6.67 - I assume this is 6 and 2/3 - is the same as 20 / 3
10-11 - I assume this is actually 10^-11, ten raised to the -11 power, can't really do anything with that in PBP other than keep track of the decimal point manually somewhere else.
.5 - a .5 divisor (on the bottom) is the same as a 2 dividend (on the top)
So, here's what I've got...
( 20 ) ( 50 ) ( 75 ) ( 2 ) ( 2 ) / 3
The 20 from multiplying up the 6.67
The 10-11 is kept somewhere else
The 50 and 75 are kept as usual
The 2's are from the .5's on the bottom
The 3 is from multiplying up the 6.67
So I get 100,000^-11 or 1^-5
Not PBP friendly at all...
What exactly is the root problem here?
jcb344
- 5th August 2008, 21:17
You got it right 6.67*10-11 is suppose to be 6.67*10^-11. I am attempting to create a particle simulation based on gravity between two partials. This involves using the simple gravity equation F = GMm/Rē. Where G = 6.67*10^-11. No this defiantly is not a picbasic friendly problem but it would be really cool if I could get this working because I could then easily scale this up to a large scale simulator. Cold anybody suggest a more user friendly floating point co-processor than the pricey uM-FPU, or a better way of going about this equation in code?
skimask
- 5th August 2008, 21:18
http://www.melabs.com/resources/fp.htm
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.