# Does this Truncate formula seem efficient?

So I’ve been scripting a game that uses a Stat system.
I’ve been using mainly ints and a few floats for my numbers.
Recently, I had to add some more floats and change some ints to floats.
After fixing the compile errors associated with that mess, I found that I want to Truncate some of the floats. NOT ROUND, Truncate to 0 decimals. After an hour or 2 sifting through the forums for a truncate float method, I determined that I couldn’t find one for float, only doubles or by some casting to int method that just seemed like too much.
I decided to use the `Mathf.Round()` method to create stand-in Truncate formula.

I was wondering if this was efficient enough to not have to do any double conversion or int casting and just use this for truncating floats from now on. `Mathf.Round(N - 0.5f)`
I don’t see any problem with it so far, But I haven’t used any absurdly finite floats or delved into the arbitrary math expressions realm with it yet.

You mean `Mathf.Floor(N);` ?

First, you are not truncating, but flooring (rounding down), which is different for negative numbers.
Also, the Mathf.Round(N - 0.5f) won’t even floor correctly. Math.Round() and Mathf.Round() have the quirk that they round exact midpoints to the even number, as documented. That means, that Mathf.Round(N - 0.5f) will return 2.f for 2.f, but 0.f for 1.f.

For actual truncation, I guess that the cast to int and back to float would be most efficient, actually.