Skip to content
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

Is explicit reset of precision helpful? #27

Closed
JeffreySarnoff opened this issue Aug 21, 2023 · 4 comments
Closed

Is explicit reset of precision helpful? #27

JeffreySarnoff opened this issue Aug 21, 2023 · 4 comments

Comments

@JeffreySarnoff
Copy link
Member

Currently, the definitions use the precision set for BigFloat / MPFR as it happens to be when the package is usinged.
Does it make sense to include e.g. setprecision(BigFloat, max(precision(BigFloat), 256)) before the includes?

@devmotion
Copy link
Member

I'm not sure I understand. IrrationalConstants should use exactly the same behaviour as Base when defining irrationals (just a separate type system to avoid type piracy which IMO should be adopted by Base), so in case there are issues with this behaviour I think they should be fixed upstream first.

@JeffreySarnoff
Copy link
Member Author

That is (half of) the issue. Base uses setprecision(BigFloat, 256).
If I do this:

(somewhere else) setprecision(BigFloat, 128)
using IrrationalConstants

my irrational constants will be created with 128 BigFloats ..
so BigFloat(<irrationalconstant>) will have less precision than one gets with Base.

@devmotion
Copy link
Member

The irrational constants are not defined as BigFloats, so I don't know what exactly you refer to when you write "my irrational constants will be created with 128 BigFloats". Irrational constants can be converted to BigFloats explicitly, in which case the precision by default will be set to precision(BigFloat) but can be specified explicitly as keyword argument precision.

@JeffreySarnoff
Copy link
Member Author

ok --

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants