Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now
- - - - -

Implicit conversion of value is not exact

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 FDsagizi   Members   

514
Like
0Likes
Like

Posted 30 September 2013 - 03:10 AM

Hi. some times i have problem with float

AS work strange with this.

 

example, that code not work because he not understand '0', he think is a "int".

float ret = true ? 0 : 0.1; 

and ok, that code make warning! 

 

next code, work wrong

float f = 0.1;
float ret = 0.2;
ret += false ? 0 : f * 15 ; // ( 15 * 0.1 == 1.5 ) then 1.5 + 0.2 == 1.7 ok ?
output( "ret: " + ret ); // BUT result == 1.2

Edited by FDsagizi, 30 September 2013 - 03:18 AM.


#2 Andreas Jonsson   Moderators   

4630
Like
0Likes
Like

Posted 30 September 2013 - 10:24 AM

That is odd. I'll look into this.

 

Which version of AS are you currently using?


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 Andreas Jonsson   Moderators   

4630
Like
0Likes
Like

Posted 30 September 2013 - 06:59 PM

It was a bug that the compiler didn't implicitly convert the constant 0 to the type in the last expression.

 

I've fixed that bug in revision 1736. I also took the time to add a compiler warning about a truncated value when a float or double type is implicitly converted to an integer type.


Edited by Andreas Jonsson, 30 September 2013 - 07:00 PM.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#4 FDsagizi   Members   

514
Like
0Likes
Like

Posted 01 October 2013 - 09:09 AM

Ok!smile.png I'll look into this.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.