Jump to content

Recommended Posts

Posted

Yes, but it is ALWAYS better to convert (called Cast) your Integer value to Float than covert a Float to an Int:

If ( iMyIntValue == (Object.GetValue(ThisAV) as Int) ) ; bad

If ( (iMyIntValue as Float) == Object.GetValue(ThisAV) ) ;good

Reason is that you are not changing the PRECISION of an Int, just padding decimal places. But you are forcing a float to round up or down.

 

I have encountered float calls that simply will not convert/round/cast to Int and the calculation keeps returning zero.

Posted

There are several ways.

 

Simplest is casting to Int:

 

Float f = 1.0

Int i = f as Int

 

Anything after the decimal point will be truncated.

 

You can also use Math.Floor or Math.Ceiling if truncation is not suitable.

 

EDIT: SKK was faster. What he says does also apply.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...