Can't get BP to accurately calculate my number/Missing a BP function

The problem that I am trying to solve is that I cannot find a way to control the number of decimals a float has.
for example I have 102.400002 and want to restrict those to 102.4, so I figured that if I do:
→ 102.400002*10 ->floor → Convert to float-> Divide by 10 → I should now have one decimal.

but when I convert back to float it’s still as at the beginning with all the decimals.

So, do you know if there is a solution in the last release (4.3) ?

Hmmm that is really bizarre, your method sounds good. I have done that before.

You could try this instead. A bit round-about but it will work. You can convert the float to ‘text’ and choose the number of integral and fractional digits as well as the rounding method. Then you could simply convert back to float.

I have used that once or twice when I needed a variable number of digits that was user controllable. This offers a simple way to do that.

Thank you for your answer, but look at my different tests:
with both tests, I have the same result, it work until the last conversion in float.
Do you have some idea?

I get this same thing too actually. I think this is just the limit of floating point precision. You cant even enter 102.4 and have it display as that. But 102.5 works, and 102.6 doesn’t.

Our of curiosity what are you doing that requires so much precision? normally these kinds of things aren’t really noticed in practice. Perhaps we can suggest something to work around any issue this causes.

ok so in my mind instead of counting on the “floor” value what about multiplying it by 10 and setting it to a temp int and than back and divide by 10

the conversions might be part of the prob it might be “optimizing” the straight conversions out (setting should fix that" and the *10 int should keep your precision without odd loss issues.

sry I don’t have an editor on this comp to test but i can later.

Sure you can try something like that if you really need to access the intermediate int value. You will just have to try and see if that changes the precision issue at all. Where are you sampling the values?

I see vague bits of what looks like rendertotexture blueprint variables… are you going for pixel accurate or something? For gameplay hit interaction type stuff 0.000002 won’t matter.