Jump to content
  • Advertisement
Sign in to follow this  

Implicit conversion of value is not exact

This topic is 2118 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post

Link to post
Share on other sites

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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!