#206·decimal

Context Support

Author: AncientHodlerCreated Jan 19, 2021Updated Apr 16, 2026

I wanted to ask if this library has something like a suport for a context. A constext would be somethin like, setting a certain precision, certain round up for,..

Like i want all my math to be computed to the 250th decimal and no more. If i set the div precision to 250, doing multiple division would yield larger decimal number, and further doing math on those numbers would become increasingly time consuming.

My solution now would be to truncate all results to my give precision, or truncate the division function to 250 precision.

Or i could implement the context feature myself, but i dont know for now how to handle errors.... need to look that up.

The easiest way would be to truncate the math operations to a precision higher 1 or two points less than the division precision.

Im asking because the Decimal implementation in python has the context mechanic, and the Cockroach apd decimal library also has it .... ill probably going to look there to see how they done it