4 ms·
That is when you would take advantage of C++ type system and use a class implementing multi-precision numbers and operator overloading.
by pjmlp 2y ago
That is when you would take advantage of C++ type system and use a class implementing multi-precision numbers and operator overloading.
- medo-bear 2y agoTake advantage of, or be forced to use :)
- signa11 2y agoall at compile time ? now _that_ would really blow my hair back :o)
- kartoffelsaft 2y agoI believe a restriction for `constexpr`/`consteval` is that you can do memory allocations but they must all be freed at the end of the evaluation. Arbitrary precision means arbitrary memory usage means allocation that's the runtime's responsibility. Maybe there's a trick that gets around that (define a type at compile time that's just big enough for this specific number and return that?), but I don't see it as possible without something weird.
- gpderetta 2y agoYou can allocate as much as you want, but the allocation cannot survive to runtime time. So the final result would have to be copied on a large enough static buffer.