In a Blueprint I’d like to access the constant value for “the highest float value”. The C++ equivalent is
std::numeric_limits<float>::max()
or
std::numeric_limits<double>::max()
depending on your precision, and the old-school C equivalent is
FLT_MAX
or
DBL_MAX
(And similar for min, of course.)
Does Blueprint offer a way to access those constant values, or a syntax in value fields? I’d rather not hard-code the value over and over again since a) that presumes a certain precision; and b) it’s poor form to repeat a universal constant like that.
(No, I’m not worried about precision out on the limits of floating point space. I want this as a boundary/sentinel value that will do the right thing under min/max comparisons.)
Thanks!
–
Hi tlokovic,
It doesn’t look like any numeric limits are exposed to Blueprints right now. For right now you could type in a very large number instead (maybe even try typing in the actual value), and you can use scientific notation in the editor fields. I’ve filed a TTP for exposing them in UKismetMathLibrary.
Cheers,
Michael Noland
Michael,
Thank you much for your reply.
I can’t get any part of the editor’s UI to accept scientific notation. Value entry widgets in any details panel prevent me from typing an “e” or an “E”, and value entry widgets on the input side of a Blueprint node allow me to type the “e” but discard the value once I hit enter. Similar if I try a math-y form like 2*10^4.
In any case, thank you for filing the request re: numeric limits. Is that ticket/bug something I can track somewhere? Just curious.
Regards,
–
–
Hi ,
Sorry about that. I’m sure that used to work, guessing someone added input validation code that is a little too strict, as the underlying parse method handles it fine. I filed those as bugs as well.
I’ll list the TTPs below but I added a note to them indicating that we should post in this thread when they are fixed. Our bug tracking isn’t public right now. We’d like to move to a public tracker in the future but it’ll probably involve moving to a different package like Jira and isn’t a fast endeavor.
343525 PROPERTY PANEL: Cannot enter floats in scientific notation
343524 K2: Cannot enter floats in scientific notation
343474 K2: Expose numeric limits to Blueprints
Cheers,
Michael Noland
Michael,
Thanks again, I appreciate your help!
–