~sircmpwn/hare-users

5 5

Arbitrary precision arithmetic in hare

Details
Message ID
<143e9d42-c14a-479d-4b2c-cff3c7589d5f@disroot.org>
DKIM signature
missing
Download raw message
Hi,


For university I experimented with libtommath in C and wondered if and 
how Hare supports big integers.

There doesn't seem to be a official way of working with big numbers in 
the standard library.


Greetings

Simon
Details
Message ID
<CT48OOA1C8Q9.15YYA4HAU8S40@notmylaptop>
In-Reply-To
<143e9d42-c14a-479d-4b2c-cff3c7589d5f@disroot.org> (view parent)
DKIM signature
missing
Download raw message
On Sun Jun 4, 2023 at 2:11 PM EDT, Simon wrote:
> Hi,
>
>
> For university I experimented with libtommath in C and wondered if and 
> how Hare supports big integers.
>
> There doesn't seem to be a official way of working with big numbers in 
> the standard library.

bignum support is planned, but currently unimplemented.
Sebastiano Tronto <sebastiano@tronto.net>
Details
Message ID
<2N0F9EZXLELUX.20RQDD0L5JXS0@gazelle.home>
In-Reply-To
<CT48OOA1C8Q9.15YYA4HAU8S40@notmylaptop> (view parent)
DKIM signature
missing
Download raw message
"Sebastian" <sebastian@sebsite.pw> wrote:
> On Sun Jun 4, 2023 at 2:11 PM EDT, Simon wrote:
> > Hi,
> >
> >
> > For university I experimented with libtommath in C and wondered if and 
> > how Hare supports big integers.
> >
> > There doesn't seem to be a official way of working with big numbers in 
> > the standard library.
> 
> bignum support is planned, but currently unimplemented.

What about crypto::bigint?

https://git.sr.ht/~sircmpwn/hare/tree/master/item/crypto/bigint

I wanted to play with arbitrary precision arithmetic too and thought
this was the way to go (but I have not had time to work on it yet).
Details
Message ID
<ea1ef733-22b7-e42e-2558-1b954ecc848b@strohwolke.at>
In-Reply-To
<2N0F9EZXLELUX.20RQDD0L5JXS0@gazelle.home> (view parent)
DKIM signature
missing
Download raw message
On 6/5/23 11:22, Sebastiano Tronto wrote:
>> bignum support is planned, but currently unimplemented.
> 
> What about crypto::bigint?
> 
> https://git.sr.ht/~sircmpwn/hare/tree/master/item/crypto/bigint
> 
> I wanted to play with arbitrary precision arithmetic too and thought
> this was the way to go (but I have not had time to work on it yet).

crypto::bigint is very narrow in scope and hard to use, since it's made 
to work without dynamic allocations. It's also not very performant 
because of its constant time requirements.

yyp has started working on an general purpose bigint implementation, 
though the project is still unlisted. Dunno if it's ok to share the 
link. Maybe you can ping yyp on irc about it. Also autumnull! has done 
something in this direction afaik.
Details
Message ID
<CT4SRC1XC98N.1OA7B1KKBSA9O@desktop>
In-Reply-To
<143e9d42-c14a-479d-4b2c-cff3c7589d5f@disroot.org> (view parent)
DKIM signature
missing
Download raw message
I was working on a library that supports basic arbitrary precision:

https://git.sr.ht/~yerinalexey/hare-bigint

Unlike crypto::bigint, it automatically expands numbers on overflow,
but it has weak test coverage, uses too much memory and doesn't support
proper in-place operations (a = big::add(a, b) works, but it will create
a memory leak). I'll be working to resolve those issues in the near
future.
Details
Message ID
<84cac7a3-9f8b-b23b-9087-6854534a5141@disroot.org>
In-Reply-To
<CT4SRC1XC98N.1OA7B1KKBSA9O@desktop> (view parent)
DKIM signature
missing
Download raw message
Hi,

 > I was working on a library that supports basic arbitrary precision:

 > https://git.sr.ht/~yerinalexey/hare-bigint

This looks pretty cool and I will look into it. Thanks!
Reply to thread Export thread (mbox)