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.

Author
Message
Cyborg ART
19
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 8th Mar 2014 11:35
This is rather embarrasing since I have been using DBPro for years.
But during the last year I have worked more with MEL and C# etc, so I may have forgotten how to do it (tough I have searched, and looked through my old codes)

The problem is I cant seem to get float variables to work

like:

var# = 640/100
print var#
wait key

The result I get is 6

It should be 6,4

So something is wrong.

Does anyone know what could be wrong?

Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 8th Mar 2014 11:45 Edited at: 8th Mar 2014 11:46
try:
var# = 640.0/100
var# = 640/100.0
var# = 640.0/100.0
with 2 ints, result is done with int type and then converted to float!!!
with at least one float, result is done with float type

Cyborg ART
19
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 8th Mar 2014 13:05
Thanks! That did the trick. Though I cant remember having to do this way before.
Well, good to know

Login to post a reply

Server time is: 2026-07-06 04:31:15
Your offset time is: 2026-07-06 04:31:15