473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

aribitrary length arithmetic

Hi,

I'm a C++ newbie and wondered whether C or C++ have an 'arbitrary length'
arithmetic facility, similar to say JAVA's 'BigInteger', that will carry out
arithmetic operations symbolically on integers or decimals of any length.

I am currently developing maths programs in PHP, and PHP has a 'large
number' type facility, but have been considering a switch to C++ as its
faster.
Thanks
Jeremy Watts
Jul 23 '05 #1
5 1613
Jeremy Watts wrote:

Hi,

I'm a C++ newbie and wondered whether C or C++ have an 'arbitrary length'
arithmetic facility, similar to say JAVA's 'BigInteger', that will carry out
arithmetic operations symbolically on integers or decimals of any length.

I am currently developing maths programs in PHP, and PHP has a 'large
number' type facility, but have been considering a switch to C++ as its
faster.


Just search the web for 'Big Integer' or 'Big Number' Libraries.
There are plenty available.

Compared to Java (can't talk about PHP) the standard facilities of
C++ are 'poor'. C++ has only the bare minimum for safe programming.
Everything else is non standard.

--
Karl Heinz Buchegger
kb******@gascad .at
Jul 23 '05 #2
Karl Heinz Buchegger wrote:
Jeremy Watts wrote:

I'm a C++ newbie and wondered whether C or C++ have an 'arbitrary length' arithmetic facility, similar to say JAVA's 'BigInteger', that will carry out arithmetic operations symbolically on integers or decimals of any length.
I am currently developing maths programs in PHP, and PHP has a 'large number' type facility, but have been considering a switch to C++ as its faster.


Just search the web for 'Big Integer' or 'Big Number' Libraries.
There are plenty available.

Compared to Java (can't talk about PHP) the standard facilities of
C++ are 'poor'. C++ has only the bare minimum for safe programming.
Everything else is non standard.


It's not clear to me why nobody has written a large class
library for C++, so that 'out of the box' it will have as much
functionality as PHP or Java.

Such a library would mean you could pick up your C++ compiler
and write a web site just as easily as you can in PHP now,
for example.

Of course, such a library would be bloaty, but that is a
less important concern than speedy development time, for
many people (as evinced by the popularity of PHP).
PS. I have a question about Google groups formatting, since
I read and write via it I can't answer this question myself:
does it re-word-wrap the text I have quoted above? Or does
it look like long lines interspersed with one-word lines where
the last word has been wrapped around due to increased quote
indent?

Jul 23 '05 #3
Jeremy Watts schrieb:
[something about big integers]

Why do you ask that twice? In comp.lang.c++.m oderated (message ID:
<sa************ **@newsfe1-gui.ntli.net>) you have already been answered.
Jul 23 '05 #4
Old Wolf schrieb:
It's not clear to me why nobody has written a large class
library for C++, so that 'out of the box' it will have as much
functionality as PHP or Java.

Such a library would mean you could pick up your C++ compiler
and write a web site just as easily as you can in PHP now,
for example.
I don't think so. There are other and more important dependencies.
PS. I have a question about Google groups formatting, since
I read and write via it I can't answer this question myself:
does it re-word-wrap the text I have quoted above? Or does
it look like long lines interspersed with one-word lines where
the last word has been wrapped around due to increased quote
indent?


The second one.
Jul 23 '05 #5
Old Wolf wrote:

[ ... ]
It's not clear to me why nobody has written a large class
library for C++, so that 'out of the box' it will have as much
functionality as PHP or Java.


Presumably you mean something substantially different from boost and/or
C++ TR1?

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
5117
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. And K&R2 mentions "signed extension" everywhere. Reading some old clc posts, I've beginning to realize that these books are over-generalizing the topic. I am just wondering what the difference between the following pairs of terms are: 1)...
43
26496
by: Mehta Shailendrakumar | last post by:
Hello, Can anyone suggest me operator to perform arithmetic shift in C? May it be for a perticular compiler. Thank you in advance. Regards, Shailendra
4
1548
by: PDHB | last post by:
I'm sorry, but this is just the height of stupidity. I love the dot net framework. It has actually been sufficient to convert an anti-microsoft extremist (myself) to the windows camp. But not having numerical value types inherit from an interface to allow for arithmetic in generics, or in some other way allow arithmetic in generics without a performance killing or ugly work around is just the epitomy of idiocy. Yes, microsoft today is...
0
951
by: Jeremy Watts | last post by:
Hi, Does VB.net have an 'arbitrary length' arithmetic feature? Meaning can it handle very large real/integer number arithmetic symbolically like some other languages can? PHP for instance has the 'BC arithmetic' function that allows arithmetic involving very large numbers. Its just that I am considering switching languages from PHP to maybe C++ or VB.net
7
528
by: barikat | last post by:
int a; int *Ptr1, *Ptr2; Ptr1 = a; Ptr1++; Ptr2 = a; printf("Ptr1 : %p\n", Ptr1); printf("Ptr2 : %p\n\n", Ptr2);
4
2108
by: ranjeet.gupta | last post by:
Dear All Please check the below code: UINT8 MsgLength = 0; MsgLength = strlen((char *)msg); if ( MsgLength == 0 || MsgLength 64) {
26
3046
by: Bill Reid | last post by:
Bear with me, as I am not a "professional" programmer, but I was working on part of program that reads parts of four text files into a buffer which I re-allocate the size as I read each file. I read some of the items from the bottom up of the buffer, and some from the top down, moving the bottom items back to the new re-allocated bottom on every file read. Then when I've read all four files, I sort the top and bottom items separately...
11
1927
by: lak | last post by:
Hello firends. I want to know what is the variable length in c. I K&R they stated that atleast 31 character. But I give 1 lakhs length to a variable, but my compiler doesn't say any error. It accepts it.Then what is the maximum length to a variable.?
8
3242
by: Andrew Smallshaw | last post by:
I'm working on a data structure that began life as a skip list derivative, but has evolved to the point that it now only has a passing resemblance to them. Each node of this structure has a few constant size variables (ints and the like), an array holding the actual data (chars in this case) and a random number of pointers to other nodes in the structure. At the moment my code uses a fixed size array for the contents (which may or may...
0
8339
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8751
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2757
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.