RealDocs

UKismetMathLibrary::Divide_ByteByte

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Divides byte A by byte B and returns the integer quotient. Fractional remainder is discarded (truncation toward zero).

Caveats & Gotchas

  • Dividing by zero (B=0) triggers a Blueprint runtime error and returns 0; in C++ it is undefined behaviour unless the engine's safe-divide path is used.
  • Result is always truncated, not rounded — dividing 7 by 2 yields 3, not 4. If you need rounding, convert to float first.

Signature

static UE_INL_API uint8 Divide_ByteByte(uint8 A, uint8 B = 1);

Parameters

Name Type Description Default
A uint8 Dividend.
B uint8 Divisor. 1

Return Type

uint8

Example

Byte division C++
uint8 HalfHealth = UKismetMathLibrary::Divide_ByteByte(CurrentHealth, 2);
// CurrentHealth=100 -> HalfHealth=50

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.