f



Decimal bignum class

{ 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! ]

0
Arthur
10/6/2015 1:19:15 PM
comp.lang.c++.moderated 10738 articles. 1 followers. allnor (8509) is leader. Post Follow

2 Replies
407 Views

Similar Articles

[PageSpeed] 49

On Tue,  6 Oct 2015 13:19:15 CST, "Arthur Rubin
(ronnirubin@sprintmail.com)" <arthur.rubin.669@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


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

0
Barry
10/7/2015 7:05:33 AM
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
> (ronnirubin@sprintmail.com)" <arthur.rubin.669@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


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

0
Arthur
10/8/2015 7:14:31 AM
Reply:

Similar Artilces:

Class B using Class C, and Class A using both B and C
The following code illustrates a problem I have been trying to get around in c++. Can anyone explain how I can get this to work. The code compiles fine if I leave out the lines with the comments after them. Tnaks in advance for any help. jd //file test.cpp: #include "pair.h" #include "triple.h" int main(){ pair y= pair(2,4); triple z = triple (1,2,3); pair *x= new pair(1,2); triple *fg= new triple (4,5,6); y.print_value(); z.print_value(); x->print_value(); fg->print_value(); return 0; } ...

class C: vs class C(object):
Hi, I'm not an experienced developer, and I came across this statement by reading a code. I search for explanation, but can't find anything meaningful. I read the entire document written by python's creator about the features of version 2.2 The one named unifying types and classes. But This document only blew my head away. I ended here and think somebody can explain me more about this. The only thing I have noticed is that when you do dir(C) on a classic class you get a bunch of attributes; and when you do the same thing on a class defined using class C(object), you get less attr...

C++ problems and decimal bignum
I may be missing something obvious, but the following code compiles for me, but gives an unspecified linker error. Compiler is C++ Builder 10. (And, yes, the body is still a test program. There will be more.) Main program: #ifdef _WIN32 #include <tchar.h> #else typedef char _TCHAR; #define _tmain main #endif #include <vector> #include <iostream> #include "Decimal.hpp" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int i; Decimal D(9999u); cout << D[0] << D[1] << D[2] << D[3] << D[4]...

How do I tell the difference between a class C and the singleton class of an instance of C
Note: parts of this message were removed by the gateway to make it a legal Usenet post. Suppose that: class C; end c = C.new sing = (class << c; self; end) If a method is called with C and sing, but I don't know which is first and which is second in the parameter list, how do I tell them apart? Thanks, dean -- Dean Wampler http://www.objectmentor.com http://www.aspectprogramming.com http://aquarium.rubyforge.org http://www.contract4j.org Note: parts of this message were removed by the gateway to make it a legal Usenet post. I just figured out a way, if I also have the inst...

Decorating one method of a class C with another method of class C?
Is there a way of decorating method1 of class C using method2 of class C? It seems like there's a chicken-and-the-egg problem; the class doesn't seem to know what "self" is until later in execution so there's apparently no way to specify @self.method2 when def'ing method1. On Fri, 06 Jun 2014 17:14:54 -0700, Dan Stromberg wrote: > Is there a way of decorating method1 of class C using method2 of class > C? Yes. See below. > It seems like there's a chicken-and-the-egg problem; the class doesn't > seem to know what "self" i...

How to declare a C or C++ function in a Objective C class
Hi, I need to write few functions, which I need to pass to a method in Objective C class using the pointers to those functions. These functions use the instance variable of the class. Hence they must have access to the variables. I want to write functions in C or C++ because they are crucial to the efficiency of my code and I don't want to use selectors way of passing methods for the same reasons. Then where do I include the function declations and implementations in ..h and .mm files of the class. Ankush In article <1150755755.068251.207990@h76g2000cwa.googlegroups.com&g...

C++ struct same as C++ class
Hi, C++ struct is same as C++ class except for the default access specifier. you can do everything with C++ struct that you can with C++ class. I know this. what I want to know is, Is this the specification of C++ standard. If yes, was it always the part of specification? and could this behaviour be compiler specific? ( I am trying to convince a bunch of programmers, and these answers would help.) -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] herhighness wrote: > Hi, > > C++ struct ...

Class, Class, where is the Class
Is there a reference somewhere which lists which classes are in which ..jar files? For instance, if I want to use HTTPServlet, which jar file is it in (I know where it is, just an example...)? All the API docs give the package name, but where is the package? TKS!! Wojtek Bok wrote: > All the API docs give the package name, but where is the package? Maybe this is what you search: JWhich http://www.javaworld.com/javaworld/javatips/jw-javatip105.html --- Mario ...

class.class = class
I understand that when you define a new class it´s an instance of Class... class Test end So you can treat "Test" as an object and asks its class : Test.class Class Is this Class itself an object ? Because when i do Class.class, ruby gives me 'Class' So is Class an instance of itself? I don´t understand the logic behind this :( Thanks -- Posted via http://www.ruby-forum.com/. Hi, Am Freitag, 17. Jul 2009, 20:54:26 +0900 schrieb Rubynewbie Rubynewbie: > I understand that when you define a new class it=C2=B4s an instance of > Class... >=20 > c...

How to implement C++ class heritage properties in C using C struct?
hi,all, I have a C++ program need to convert to c language to be used in a emabedded system. the problem is that the original code was writtern in C++ language with Parent class and some child class. How can I invert these C++ code into pure c code by using struct in C language? Can somebody give me any ideas? thanks. For example, how to conver the following code into pure c code? class PARENT { public: virtual int Init(); virtual int Add(); virtual int Sub(); int Otherfunc(); private: int x; int y; int z; }; class CHILD1: public PARENT { public: int Init(); int Add(); int CH...

[Objective-C++] Objective-C wrappers around C++ classes and KVC
Suppose I have a C++ class named Bar, and an Objective-C wrapper for it called BarWrapper that I use so that BarWrapper has a few KVC-compliant methods (essentially, Bar is the model of something I need to link to an NSArrayController through BarWrapper). Now inside Bar I have a std::vector<Bar*> object, and of course I need to make indexed accessors of the BarWrapper* type. Now, I have two issues, both with the NSArrayController that the BarWrappers are connected to: - the first (and the easier one) is deleting BarWrappers: If I remove a BarWrapper from the master list, I ...

How to implement C++ class heritage properties in C using C struct?
hi,all, I have a C++ program need to convert to c language to be used in a emabedded system. the problem is that the original code was writtern in C++ language with Parent class and some child class. How can I invert these C++ code into pure c code by using struct in C language? Can somebody give me any ideas? thanks. For example, how to conver the following code into pure c code? class PARENT { public: virtual int Init(); virtual int Add(); virtual int Sub(); int Otherfunc(); private: int x; int y; int z; }; class CHILD1: publi...

Better C/C++ Than C/C++?
I am looking for a good systems programming language that can be used instead of C/C++. My qualifications for the language are: * mature compiler(s) that produce native-code binaries (for Windows) * open source - preferable, but not 100% necessary Thanks, Kevin "Kevin Albrecht" <kevin@albrecht.net> writes: > I am looking for a good systems programming language > that can be used instead of C/C++. My qualifications > for the language are: > > * mature compiler(s) that produce native-code > binaries (for Windows) Ocaml, D, cyclone, Eiffel, Beta >...

jython and C-c C-c
How do I get C-c C-c to work with jython? I have the jpython command set to jython, and I can start the interpreter with C-C ! and then use C-c C-c, but this is rather frustrating. If I try to use C-c C-c without first starting the interpreter in another window I get wrong type argument: sequencep, jpython Thanks, Dave Cook ...

Web resources about - Decimal bignum class - comp.lang.c++.moderated

Penny (Irish pre-decimal coin) - Wikipedia, the free encyclopedia
The penny (1d) ( Irish : pingin ) coin was the third smallest denomination of the pre-decimal Irish pound , worth 1/240 of a pound or 1/12 of ...

Dewey Decimal Classification - Wikipedia, the free encyclopedia
This highly organized system categorizes books on library shelves in an efficient, specific and repeatable order that makes it easy to find any ...

4th Grade Splash Math Worksheets to learn decimal numbers, multiplication, division & fractions for kids ...
Get 4th Grade Splash Math Worksheets to learn decimal numbers, multiplication, division & fractions for kids on the App Store. See screenshots ...

Dewey Decimal Tattoo - Flickr - Photo Sharing!
Children's librarians represent.

Math of the Day: Sesame Street’s The Count Reads Pi to 10,000 Decimal Places
... has created a true monster out of your favorite Sesame Street vampire, with audio of The Count reading every digit of Pi out 10,000 decimal ...

Paul Harapin heads Decimal Software after VCE ousting
Former VCE Asia-Pacific boss, Paul Harapin, has taken over as CEO of Decimal Software.

Feeling green: the dangers of decimal currency
The curious case of possibly toxic coins, via Austria and a devastatingly original idea for Canberra.

Jobless Rates With Another Decimal
The BLS reported a jobless rate of 8.3% for both January and February. Adding an extra decimal, the unemployment rates would actually be 8.26% ...

JPMorgan Sued by Trader Over $3 Million Decimal Point
JPMorgan Chase & Co. is being sued by a trader who says he accepted a contract from the investment bank because a typographical error made him ...

.Decimal Archive - Houston Gamer
It was only back in August when newly-formed Houston game studio Orb Interactive launched a Kickstarter campaign for “.Decimal”, a sci-fi take ...

Resources last updated: 1/25/2016 3:59:36 AM