UKismetMathLibrary::Fraction
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the fractional (decimal) part of a float by computing A - floor(A). For example, 3.7 returns 0.7.
Caveats & Gotchas
- • For negative inputs the result is non-negative: Fraction(-1.7) returns 0.3, because floor(-1.7) == -2. This differs from simple truncation (frac of -1.7 via truncation would be -0.7).
- • Not suitable as a substitute for Percent_FloatFloat when you need the remainder relative to an arbitrary divisor — Fraction is always relative to 1.0.
Signature
static UE_INL_API double Fraction(double A); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | double | The input value. | — |
Return Type
double Example
Extract the sub-second portion of elapsed time C++
double Elapsed = GetWorld()->GetTimeSeconds(); // e.g. 12.345
double SubSecond = UKismetMathLibrary::Fraction(Elapsed); // 0.345 Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?