Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Decimal bignum class

118 views
Skip to first unread message

Arthur Rubin (ronnirubin@sprintmail.com)

unread,
Oct 6, 2015, 2:20:17 PM10/6/15
to
{ edited by mod to shorten lines to ~70 characters. -mod }

I apologize if this has been asked before, but I can't find it in the
archives.

Is there an implementation of an integer (or even unsigned integer)
bignum class where the decimal representation is available. I'm working
on a number representation puzzle (recreational mathematics), and doing
the problem by hand seems intractable.

--
Arthur Rubin


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Barry Schwarz

unread,
Oct 7, 2015, 8:10:19 AM10/7/15
to

On Tue, 6 Oct 2015 13:19:15 CST, "Arthur Rubin
(ronni...@sprintmail.com)" <arthur.r...@googlemail.com> wrote:

>{ edited by mod to shorten lines to ~70 characters. -mod }
>
>I apologize if this has been asked before, but I can't find it in the
>archives.
>
>Is there an implementation of an integer (or even unsigned integer)
>bignum class where the decimal representation is available. I'm working
>on a number representation puzzle (recreational mathematics), and doing
>the problem by hand seems intractable.

Didn't any of the sites google identified have what you needed? What
are you looking for that was missing?

--
Remove del for email

Arthur Rubin

unread,
Oct 8, 2015, 8:20:20 AM10/8/15
to

On Wednesday, October 7, 2015 at 5:10:19 AM UTC-7, Barry Schwarz wrote:
> On Tue, 6 Oct 2015 13:19:15 CST, "Arthur Rubin
> (ronni...@sprintmail.com)" <arthur.r...@googlemail.com> wrote:
>
> >{ edited by mod to shorten lines to ~70 characters. -mod }
> >
> >I apologize if this has been asked before, but I can't find it in the
> >archives.
> >
> >Is there an implementation of an integer (or even unsigned integer)
> >bignum class where the decimal representation is available. I'm working
> >on a number representation puzzle (recreational mathematics), and doing
> >the problem by hand seems intractable.
>
> Didn't any of the sites google identified have what you needed? What
> are you looking for that was missing?

There are a lot of bignum implementations; but none that I have
found on google use the actual digits internally.

For example, the specific puzzle requires that, for the
square of a d-digit number, I pick up the 10^(d-1) and
10^d digits reasonably quickly. I know I _could_ use a
conventional bignum representation for X and use

(X / PowerOfTen[d-1]) % 100

but that seems inelegant and could cause problems if d gets to
be large. For the particular puzzle, I don't anticipate needing
d > 12, but it depends on the results.

For this specific problem, I might even be able to get by with
uint_128, but I'd rather not have to rewrite for more elaborate
problems.

--
Arthur Rubin
ronnirubin [at] sprintmail.com


--
0 new messages