Table of Contents

Method MulDivRound

Namespace
DocWright.Core.Primitives
Assembly
DocWright.Core.dll

MulDivRound(long, long, long)

Computes value * multiplier / divisor entirely in 64-bit integer arithmetic, rounding the quotient half away from zero.

public static long MulDivRound(long value, long multiplier, long divisor)

Parameters

value long

The value to scale.

multiplier long

The multiplier.

divisor long

The divisor. Must not be zero.

Returns

long

The scaled, rounded value.

Exceptions

DivideByZeroException

divisor is zero.

OverflowException

An intermediate product overflows a long.