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 / What is it with floats!

Author
Message
Squark
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United Kingdom
Posted: 4th Dec 2002 18:54
It is so hard to make a number with decimal places in DB even if you say a# = 5/10 then it still = 0 even with the hash. it still does it even if you say a# as float at the beggining. you have to say 5.0/10.0 to make it work even though it is a float type.
What is the point of having a life if you dont know what the meaning of one is?
Squark
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United Kingdom
Posted: 4th Dec 2002 19:02
And another thing is you put floats as start or end values of a for next loop it comes up with an unknown syntax error.

What is the point of having a life if you dont know what the meaning of one is?
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 4th Dec 2002 19:38
Well, with a#=5/10, then its not really surprising as its both 5 and 10 are integers, the calulation is done on integers and then the result is converted to float - this happens with C too...

I dont know about your second point - the following works okay :



Good news everybody! I really am THAT good...
heartbone
21
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 4th Dec 2002 20:45
It's a bad idea using floats in a for next loop.
I'm surprised that its even supported.

If one or both of the operands to a arithmetic operator is float then the result is a float.

Login to post a reply

Server time is: 2024-04-30 19:41:07
Your offset time is: 2024-04-30 19:41:07