Decimal.ContextSettings that control precision, rounding mode, exceptional behaviour, etc.
type round = | DownRound towards 0; truncate.
*)| UpRound away from 0.
*)| Half_upRound up if last significant digit is >= 5, else round down.
*)| Half_downRound up if last significant digit is > 5, else round down.
*)| Half_evenRound up if last significant digit is > 5 or next-to-last significant digit is odd, else round down.
*)| CeilingRound up if last significant digit is > 0, else no change.
*)| FloorRound down if last significant digit is > 0, else no change.
*)| Zero_five_upRound zero or five away from 0.
*)val string_of_round : round -> stringval default : t Stdlib.refdefault is a reference to the default thread-local context.
val make :
?prec:int ->
?round:round ->
?e_max:int ->
?e_min:int ->
?capitals:bool ->
?clamp:bool ->
unit ->
tmake ?prec ?round ?e_max ?e_min ?capitals ?clamp () is a new context value with the given settings and the following traps configured:
conversion_syntaxinvalid_operationdiv_by_zerooverflowThese may be overridden by using Signal.set (Context.traps context) id bool, or setting a new default context.
val copy :
orig:t ->
?prec:int ->
?round:round ->
?e_max:int ->
?e_min:int ->
?capitals:bool ->
?clamp:bool ->
?traps:Signal.array ->
?flags:Signal.array ->
unit ->
tcopy ~orig ?prec ?round ?e_max ?e_min ?capitals ?clamp ?traps ?flags is a deep copy of orig with the given settings. The optional settings default to the same values as those in orig.
val prec : t -> intval e_max : t -> intval e_min : t -> intval capitals : t -> boolval clamp : t -> boolval traps : t -> Signal.arraytraps t is the set of traps for context t. Traps may be set to true or false using Signal.set; a trap set to true raises a runtime exception when its signal is raised. One that's set to false causes the relevant calculation to silently handle the condition and return a result value (typically, NaN).
val flags : t -> Signal.arrayflags t is the set of flags for context t. Flags are set to true during a calculation in a context t, when the calculation encounters a condition that triggers the flag. E.g., overflow.
val e_tiny : t -> inte_tiny t is e_min t - prec t + 1, the minimum allowable exponent of context t.
val e_top : t -> inte_top t is the maximum exponent of context t.
val pp : Stdlib.Format.formatter -> t -> unitpp f t pretty-prints the context t.