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 / BIG SERIOUS MATH BUG OR WHAT?

Author
Message
Richard Davey
Retired Moderator
24
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 12th May 2003 03:58
David:

"My largest problem is:
percent# = (health / max)*100
...
but that is too complex to be of any use!"

Erm.. wouldn't it be simpler to just do this?

percent# = (50.0 / 100.0)*100.0

You are mixing floats and ints in your original, it will therefore perform integer math. If you want a float result - give it floats.

The value is NOT cast at the end of the equation (as IanM has posted before in this thread).

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 12th May 2003 12:14
They're getting harder to please too...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 12th May 2003 15:28
MrTAToad, I can not get to work the math.dll plug-in that is in your web, I use:



It always says that it does not exist, although the dll loads.
Besides, a# = valD("12.45") does not compile for me, it says: "variable vald does not exist in program".

Please, can you help me? I think that the round function could give us a workaround is this issue.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 12th May 2003 17:04 Edited at: 12th May 2003 17:06
First of all, do you have DBPro or DB 'Classic' ?

If you've got DBPro, then its no wonder it doesn't work.
If you've got DB 'Classic', then its no wonder it doesn't work.

The answer is dependent on which version you've got...
If its DBPro, then you dont need the load dll command, and you just use the commands as they are, eg :

print strf$(23.2)

If you've got DB 'Classic', then I'll e-mail the function names to you later.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 12th May 2003 17:25 Edited at: 13th May 2003 15:12
Ok, thanks. I have both, but I was testing it on DBPro.
Now it works. I didn't put it in the plug-ins user folder, my fault.

The testing idea would be to round the decimals for big numbers, so the mantisa keeps below 9 digits, and ensure this way a minimun number of decimals, although it is tedious to analyze which functions take 'limit values', so I'm giving it up.

I did this workaround with my problem: First operate all big integer numbers, praying for a little integer result, then add the decimal places to that little integer.
If I don't do so, I loose all the decimals (if you add decimals to a big integer, you loose them).

I'm sure there are other places in my program that are affected too,
but as long as the user can't 'see' the error, I'll have to live with this.

Still waiting for an official response. (No hurry, good things take time.)

Login to post a reply

Server time is: 2026-07-11 13:59:02
Your offset time is: 2026-07-11 13:59:02