-
Notifications
You must be signed in to change notification settings - Fork 113
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
understanding precision policies #551
Comments
the tests for z2, z3, z4, and z5 all fail in the above code. |
more testing reveals that if the default precision is less than the max of that of the two operands, we'll get the max precision of the two operands back. i think uniform precision environments are probably my goal, as anything else seems difficult to control. i'll wait for someone to reply before posting more. thanks for your attention!!! 🚀 |
OK there is a bug, but not the one you think. How this should work is that
Note the call to |
While I wait for a fix (and for it to get distributed), should I rely on the |
Yes the thread_* functions are actually working! But of course, uniform precision is the easiest model, it just requires a fair bit of discipline. |
some precision options tests are failing. i found a bug. see boostorg/multiprecision#551
I have a related question. When making a new variable and the default precision is not equal to that of any operand, what should be the precision of a new variable? Specifically, for the following code
what should the precision of z be? Does it depend on the precision options? I think APPoT is meaningless in this scenario because the target doesn't exist, in which case the precision should be one of:
|
The only thing the current default precision is used for for the precision of a new variable. In the case of an expression, the expression is always evaluated at the precision of it's largest component (albeit which components are selected is determined by the policies when they're not all floats), the policies then determine what happens next - preservation of that precision via for example
and
|
Ok, thank you. Your explanation was very helpful. |
I'm still working on understanding the policies implemented for mixed precision arithmetic. i'm at boost 1.81 as installed from homebrew on a mac M1.
I have the following code that I think doesn't produce expected results. Namely, I make two variables
x
andy
at precision 50 and 60 respectively. Then I make a variablez
at precision 70, and default precision is 70. Then I computex*y
with the various policies. For all of them,z=x*y
leavesz
with the precision it started with. Specifically, I think that for all policies exceptpreserve_target_precision
the precision ofz
should be60
after. But in all cases the precision ofz
is the current default precision; the precision of the target does not depend on the precision of the operands.Is this the expected behaviour? am I not correctly setting the policy? I used the doc page on variable precision as my guide, and I think what i have is correct.
test code:
The text was updated successfully, but these errors were encountered: