Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / problems with double floats

Author
Message
Avan Madisen
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 27th May 2003 03:04
Hi

Many probably haven't even heard of these, but DBP has the facility to use 64 bits for variables, double integers and double floats.

Supposedly, with a double float you can store any real number between something like, 10^+/-308 with 15 digits. Insane numbers, that not many people would want to use, or even find a need for.

I am one of those insane people, because I've tried to create a solar system with real gravity, unfortunately normal floats, 32bits, are not accurate enough as noticable glitchs appear in the object movements.

So I tried to use the double float variables, however after testing them I found that only hold about 7 or 8 digits, not 15. The 10^+/-308 works fine but it's the 15 digit capacity I'm after.

Anyone else had similar problems?

Thanks

Avan
The glass is half empty...
That way there's more room for improvement!
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 27th May 2003 03:27
Yeah I gave up trying to get double floats to work. They are not as accurate as they are made out to be (15 digits my a**e).

Gronda, Gronda
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 27th May 2003 04:21
they should be storing 16
S1.e15 remember that aside i've not had a problem with them in vector calculations ... i mean remember its 16 digits in total with atleast one digit on one side

so if you have say 596.1832648176283546 that will be culled to 596.1832648176283 which should still be more digits though.
oftenly i'll use singl float definitions and use double floats the total value holds when accuracy need to be great like with booleans.
but then i've never checked my values after calculating them.

if your only getting 7 then make sure that you are actually using a double float and not a single float

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
Avan Madisen
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 28th May 2003 02:35
Yeah, I'm definately using double floats, normal floats don't handle numbers as big as 10^+308, and I was getting numbers like that from this.

The biggest problem is, in a solar system the object positions are quite vast, something like +/- 900000 I'm planning to be working with, with normal floats I'm only getting an accuracy down to 0.1, 0.01 if I'm lucky. Now when the movement variables are something like 10^-6 and the planet's themselves are something like 1 unit in diametre, I kinda need those 15 digits.

Yes, I know I'm crazy for trying to work the physics to a true to life scale, but I'm just insane!

Thanks for letting me know I'm not alone with this problem.

Avan

The glass is half empty...
That way there's more room for improvement!

Login to post a reply

Server time is: 2026-07-11 09:30:16
Your offset time is: 2026-07-11 09:30:16