-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context Support #206
Comments
Nope, right now this library only operates on global variables such as |
why would it make a breaking change ? anyway i was thinking on modifying the basic math functions to truncate to a certain decimal precision i want and need. The thing with the context precision in cockroachdb is that a 250 precision is the sum of the numbers before and after the decimal point. So if the number is 10 million which is 8 numbers big, your left with only "242" decimal precision.... Been trying yesterday for 9 hours straight to use the cockroach db, but their math syntax is somehow combersome, and couldnt make the sinus function work at all with it. as opposed to you library which implemented it correctly. They use a different structure for the decimal type, and their function uses the *Decimal type, as oposed to your using the Decimal type. Cant really understand the difference (im new to golang) but it seems to function a bit ackward... Go says their two different thing ... gonna have to write a function for logarithm though as there isnt any .... |
Right now I can't think of a clean way to introducing context support for a decimal lib without not changing any of the existing method signatures. I would have to introduce a new type with all math operations redefined, pass context var as a parameter to methods, or just add it as a decimal struct field. |
Being able to control |
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
The text was updated successfully, but these errors were encountered: