Comments (7)
Reading the provided code and the sagemath link, I think the following addition to the answer of @albinahlback might be useful for @rudolph-git-acc : observe what you get from the following piece of C,
printf("%.20f\n", 1.1);
It should yield 1.10000000000000008882
. This is what is meant by "inexact" (not representable etc.) above, and this has nothing to do with arb or flint or sagemath. (Sorry for the noise if that was already clear to you.)
from flint.
@vneiger Thanks for the clarification. Your example is very helpful and I had never appreciated the "inexact" issue.
It is good to be aware of this though and maybe it is worthwhile mentioning it in the documentation of arb_set_d. I have for instance seen it being used in setting integral limits and there it could make a big difference e.g. in a lower limit close to zero. Or for instance in this issue on the old ARB GitHub : flintlib/arb#451 Replacing arb_set_d by are_set_str has an immediate impact on the result.
I most certainly don't want to blame FLINT/ARB for having "bugs" or being "wrong" and will include a link to this thread in my AskSageMath question.
from flint.
I don't know what you specifically mean by "wrong" here, or a "bug".
arb_set_d
will only convert adouble
to anarb_t
. If thedouble
is "inexact" (meaning that the original decimal number is not representable as a dyadic rational), that's on the user -- FLINT/Arb is not a compiler.arb_set_d
will not impose some error bound since it doesn't know if the double is inexact or not. Once again, that's on the user.
As 1.1
is not representable as a dyadic rational, you should not expect Arb to give a "correct" number. It will only convert what is given to it, which is an approximation, which in turn an arb_t
can represent.
from flint.
Yes, this should be documented. Thanks for bringing this up!
from flint.
Fixed in 0c07030
from flint.
Sorry to be a pain, but the same issue could be induced by the following commands:
The latter is often used in setting integral limits. Probably good to update the documentation for these as well.
P.S.
I believe we should be good for fmpz-types:
from flint.
arf_set_d
does not have this issue, one is converting between two equivalent representations.
from flint.
Related Issues (20)
- Split Arb headers HOT 3
- Use error codes instead of string constants when throwing HOT 3
- Speed up fmpz_lucas_chain
- Branches `flint-3.1` and `main` have diverged HOT 14
- Implement `mpn_gcdinv` with precomputed powers of two modular inverses HOT 2
- `n_revbin` is used though some architectures has reverse binary instructions
- Bug in `fq_nmod_mpoly_factor` triggered by large test multiplier HOT 2
- arb_hypgeom_beta_lower gives weird results HOT 1
- `(_)arb_mat_entrywise_(not_)is_zero` doesn't make sense
- Apply `__attribute__((const))` where applicable HOT 5
- Global field accessor macros for matrices and polynomials
- More `is_canonical` functions for tests HOT 2
- Override gr_mat_eigenvalues HOT 1
- Could we release 3.1.3-p1? HOT 1
- fmpz_mpoly_pfrac_init: internal error HOT 7
- Worklist for nfloat HOT 3
- SIMD abstraction layers HOT 5
- Problems with Riemann theta functions HOT 41
- 3.1.3 isn't in the Downlioads section of the website: https://flintlib.org/downloads.html HOT 2
- Document need for libtool
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flint.