System::Decimal::Round‑metod

Decimal::Round(const Decimal&, int, MidpointRounding) method

Avrundar det angivna värdet till närmaste värde med det angivna antalet decimaler. En parameter anger funktionens beteende om det angivna värdet är lika nära två närmaste tal.

static Decimal System::Decimal::Round(const Decimal &d, int digits, MidpointRounding mode=MidpointRounding::ToEven)
ParameterTypeBeskrivning
dconst Decimal&Värdet att avrunda
decimalerintAntalet decimaler i det avrundade värdet
modeMidpointRoundingAnger hur avrundningen ska utföras om value är lika nära två närmaste tal.

ReturnValue

Numret med det angivna antalet siffror närmast value

Se även

Decimal::Round(const Decimal&, MidpointRounding) method

Avrundar det angivna värdet till närmaste heltal. En parameter anger funktionens beteende om det angivna värdet är lika nära två närmaste tal.

static Decimal System::Decimal::Round(const Decimal &d, MidpointRounding mode=MidpointRounding::ToEven)
ParameterTypeBeskrivning
dconst Decimal&Värdet att avrunda
modeMidpointRoundingAnger hur avrundningen ska utföras om value är lika nära två närmaste tal.

ReturnValue

d rounded to the nearest integral value

Se även