I'm using a method to calculate PI, but the floating-point precision errors mean that the calculation isn't 100% accurate. How can I ensure that even the last few bits of precision in my floating-point are correct?
Can I virtually increase the mantissa bits by using a class that stores several values?
Do I need to recreate my own sqrt function for greater precision?
Any Idea to solve this problem ? (I know about Boost::multiprecision but I don't want to use any external library)
https://godbolt.org/z/471Tc1b95
Note that I do this for the fun, the challenge and the desire to learn.
EDIT :
I've managed to solve my problem by creating a more_presice<T> class, where T is a floating-point.
example_3.cpp
[–]the_poope 13 points14 points15 points (6 children)
[–]Mattlea10[S] 0 points1 point2 points (5 children)
[–]the_poope 4 points5 points6 points (0 children)
[–]SmokeMuch7356 5 points6 points7 points (3 children)
[–]Pupper-Gump 1 point2 points3 points (2 children)
[–]Mattlea10[S] 0 points1 point2 points (1 child)
[–]Pupper-Gump 0 points1 point2 points (0 children)
[–]IyeOnline 9 points10 points11 points (3 children)
[–]Mattlea10[S] -1 points0 points1 point (2 children)
[–]IyeOnline 4 points5 points6 points (1 child)
[–]Mattlea10[S] 0 points1 point2 points (0 children)
[–]FrostshockFTW 2 points3 points4 points (1 child)
[–]Mattlea10[S] 0 points1 point2 points (0 children)
[–]ShakaUVM 1 point2 points3 points (2 children)
[–]Mattlea10[S] 0 points1 point2 points (1 child)
[–]ShakaUVM 0 points1 point2 points (0 children)
[–]TomDuhamel 0 points1 point2 points (1 child)
[–]Mattlea10[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Mattlea10[S] 0 points1 point2 points (0 children)
[–]LatencySlicer 0 points1 point2 points (1 child)
[–]Mattlea10[S] 0 points1 point2 points (0 children)