numeric_limits<double>::epsilon() gives the error of (double)1.0
in the sense that 1+epsilon is the next double value which is represented.
But how can we calculate the error of arbitrary double number?
merse
0
Junior Poster
Recommended Answers
Jump to PostGiven a number x, you want to find epsilon with the following two properties:
1) x + epsilon != x
2) If 0 <= y < epsilon, x + y == x.
It should not be terribly hard to find the value of epsilon by binary search.
Jump to PostIf you use the known representation of double numbers, your program will work only on machines that use that representation. If you use the binary-search technique I suggested, it will run anywhere.
Admittedly the binary search is slower. What is it about this particular operation that you need to …
All 6 Replies
arkoenig
340
Practically a Master Poster
merse
0
Junior Poster
arkoenig
340
Practically a Master Poster
merse
0
Junior Poster
merse
0
Junior Poster
merse
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.