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.

AppGameKit Classic Chat / Compiler issue

Author
Message
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 2nd Oct 2016 09:53 Edited at: 2nd Oct 2016 09:57
Please take a look to the following piece of code:


The output is 2.0 but it should be 3.0
Since the Ceil function accepts a floating point number, as an argument, then both of the operands of the calculation should be treated as floating point numbers (or at least the result of the calculation)
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 3rd Oct 2016 21:11
No-one from TGC team?
Harlequin
14
Years of Service
User Offline
Joined: 22nd Mar 2010
Location: Melbourne (AU)
Posted: 3rd Oct 2016 23:27
Hi George++
you need to have at least one of the dividing/divided numbers as a float for it to work it would appear.

I updated your example (changed 1 to 1.0) and it works.


cheers
It\'s late, I\'m tired, out of coffee and now I\'m wet.
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 4th Oct 2016 14:43
Hi Harlequin,
Thank you for your response and for the tip. I know how to face this issue.
I would like to see if the TGC, agrees that this is a compiler issue or not. If the TGC agrees then this could be treated as a future update.
As far as I know, any C++ compiler does not behaves like the AGK
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th Oct 2016 16:22
If both sides of a division are integers then the result will be an integer, this is the same as C++
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Oct 2016 17:04
instead of automatically convert int to float or float to int i like to have it optional and convert via a command.
example:
local a as float
local b as integer
local c as integer
a = Float(b+c)
or
b=c+Int(a)

AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 7th Oct 2016 09:01
I agree, this is not a compiler issue, but a casting issue.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Oct 2016 09:08
Not even an issue. Expected behavior.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign

Login to post a reply

Server time is: 2024-09-29 19:27:12
Your offset time is: 2024-09-29 19:27:12