Date: Sat, 5 Apr 2025 15:42:17 +0200
It would be good if your big num example would be a part of the standard in some form.
One could add a word so that the std::vector part avoids heap allocations for smaller values, but that would be an optimization, not a part of the type semantics. It does not seem possible otherwise to avoid conditionals for a type that dynamically can change allocations, since if, say, adding two numbers, one would need to determine which functions to use. If using double dispatch instead, one cannot optimize away the function calls, which might not be good in this low-level programming.
I have written a C++ wrap for multiprecision integer and rational numbers, if that would help. I could not compile your example, though. A working example for GCC or Clang on arm64 or x86_64 would help.
> On 3 Apr 2025, at 20:06, Tiago Freire <tmiguelf_at_[hidden]> wrote:
>
> I'm pretty sure, I don't understand your use case.
> But a reference implementation is available and linked in the paper.
> Perhaps you can send me a code sample of what you are trying to do and how you would think it would be different? Then I can come back to you.
One could add a word so that the std::vector part avoids heap allocations for smaller values, but that would be an optimization, not a part of the type semantics. It does not seem possible otherwise to avoid conditionals for a type that dynamically can change allocations, since if, say, adding two numbers, one would need to determine which functions to use. If using double dispatch instead, one cannot optimize away the function calls, which might not be good in this low-level programming.
I have written a C++ wrap for multiprecision integer and rational numbers, if that would help. I could not compile your example, though. A working example for GCC or Clang on arm64 or x86_64 would help.
> On 3 Apr 2025, at 20:06, Tiago Freire <tmiguelf_at_[hidden]> wrote:
>
> I'm pretty sure, I don't understand your use case.
> But a reference implementation is available and linked in the paper.
> Perhaps you can send me a code sample of what you are trying to do and how you would think it would be different? Then I can come back to you.
Received on 2025-04-05 13:42:33