3 ms·
If 64 bit doubles aren't enough, why not use libquadmath? It gives you 113 bits of mantissa, and should be around 10x faster than arbitrary precision.
by adgjlsfhk1 5y ago
If 64 bit doubles aren't enough, why not use libquadmath? It gives you 113 bits of mantissa, and should be around 10x faster than arbitrary precision.
- ChrisLomont 5y ago113 bits will still fail on iterative processes. If you dig into probably any of the robust kernels of things like parametric modelers, they all need these methods. The above example I gave is terribly naive: things get vastly worse. Above was only position. Now build in Bezier surfaces, or better yet, NURBs so you can do true conics as well as crazy freeform surfaces. Now compute the intersection of such objects. These intersections require very high degree polynomial representations. Now repeat. If you quantize points on the intersection curves too much, you'll get all sorts of pathologies, things doubling back, near singularities .. The way to deal with this flawlessly is to allow whatever precision is needed to prove necessary constraints are met. A good lib would use each representation as needed: double, libdouble, liquid, liboct, etc. as needed, and eventually arbitrary precision. I've written several systems that do such over my career. It's a cool space A nice simple place to try this is to make an arbitrary precision Mandelbrot zoomer that switches underlying types as needed for precision. It's much more fun to make these work on various AVX flavors, or on GPUs. All are doable.