[Bug] 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. I am outputing float values to my HUD as part of the gameplay, but I want to restrict those to 14.7 for example and no longer. There doesn’t seem any BP function that allows for that.

So alternatively I then figured out if I do the following I should get what I want:

A*10 → Floor → Convert back to Float → Divide by 10 → I should now have one decimal.

1427.147854 * 10 = 14271.47854
To int is 14271
Back to float/10 is 1427.1

This works correctly some of the time, however very often Rocket decides to output a very long number still. 14271/10 results in 1427.100000001 or 1472.0999999998 for example most of the time.

Also another thing I tried which also did not work/not supported:

I figured if I can do search for character in a string, I could search for the . symbol, and then retrieve the position within the string . is at, and then I’d be able to do substring and only get that value+1 as string → I have no way of searching for a character in a string.

Hey Sjoerd,

Thanks for your report! We agree that having some control over level of precision for a float is something that could be useful in some scenarios and that we should expose that functionality. I have filed a feature request for that ability to be included in blueprints. Hopefully this will be added for a future Rocket Beta release.



#BP Node For You Sjoerd

I encountered precision errors with this part of the process “Back to float/10”

So I avoid dividing by the 10^precision,

my C++ algorithm is below:

I wrote a BP node to:

  1. get a float as a string
  2. with precision of your choosing
  3. the re-precisioned float is rounded appropriately

For example:

160123.699111 becomes

160123.7 with single digit precision,

160123.70 with 2 precision, and

160123.699 with 3 precision


My BP Function Library Plugin (no code compile required)



void UVictoryBPFunctionLibrary::StringConversion__GetFloatAsStringWithPrecision(float TheFloat, FString & TheString, uint8 Precision)
	TheFloat *= FMath::Pow(10, Precision);
	//Rounded Int32 version
	TheString = FString::FromInt(FGenericPlatformMath::Round(TheFloat));
	TheString = TheString.Left(TheString.Len() - Precision ) + "." + TheString.Right(Precision);


hi Sjoerd and Steve,

I had need to this post.
Steve, do you know if this feature has been add to the last release (4.3) ?

Many thanks,


Hi PierreMaux,

This is from an archive post that is no longer being tracked from our beta of UE4. Please ask this as a new question on the AnswerHub.

Thank you!