addaptic

Reference Decimal standard

lz_round

The number rounded in its own rounding mode, half-even by default.

long lz_round( CLZNumber* leftOperand, CLZNumber* targetNumber = nullptr );

Rounds at the number's own precision and in its own rounding mode, the ones it was made with: the working precision at the time, and half-even, unless set otherwise. A number already within its precision is unchanged; the last example is a number made at four places.

Examples

CallAnswer
lz_round( 2.5 )2.5
lz_round( 3.5 )3.5
lz_round( 1.23456789 ) 4 places1.2346

Each answer is what Addaptic printed for the call, at 36 places unless a setting is shown.

Returns

kNoError (0) when the answer is written. Otherwise an error code, with the answer flagged infinite or not-a-number; see Errors and flags.

See also