(very) simple math not working perhaps due to to large numbers?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2008
Posts: 206
Reputation: grumpier has a spectacular aura about grumpier has a spectacular aura about 
Solved Threads: 31
grumpier grumpier is offline Offline
Posting Whiz in Training

Re: (very) simple math not working perhaps due to to large numbers?

 
0
  #11
Jan 12th, 2009
Originally Posted by Bladtman242 View Post
can i just change those values? either just by editing limits.h or by changing the value for a specific program? or can i make a variable of unlimmited size?
Generally, you cannot. The contents of limits.h generally reflects technical limits on capability of your compiler on your target operating system. Most compilers will need to be rewritten/extended/modified to support a change of those values.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 111
Reputation: Bladtman242 is an unknown quantity at this point 
Solved Threads: 3
Bladtman242 Bladtman242 is offline Offline
Junior Poster

Re: (very) simple math not working perhaps due to to large numbers?

 
0
  #12
Jan 13th, 2009
okay, is there anything i can do?
Yo god, where do i report a bug?
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 206
Reputation: grumpier has a spectacular aura about grumpier has a spectacular aura about 
Solved Threads: 31
grumpier grumpier is offline Offline
Posting Whiz in Training

Re: (very) simple math not working perhaps due to to large numbers?

 
0
  #13
Jan 13th, 2009
You can implement a class type that has the attributes you want (or find such a class type that someone else has implemented). Internally, that type might use an array of integers or (as Freaky_Chris suggested) a string to represent larger values. You would need to define mathematical operations and also things like streaming (so you can read or write the data to a file stream).
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 111
Reputation: Bladtman242 is an unknown quantity at this point 
Solved Threads: 3
Bladtman242 Bladtman242 is offline Offline
Junior Poster

Re: (very) simple math not working perhaps due to to large numbers?

 
0
  #14
Jan 13th, 2009
well file i/o sounds fine, but about defining mathematical operations and.. still the string and class thing? i dont get it :-( i havent worked with structures and classes for a looong while, so i will re-read some documentation on the subject:-) what do you mean with defining mathematical operations?

would splitting up the large numbers and assigning them to an array of ints help anything??
Yo god, where do i report a bug?
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 206
Reputation: grumpier has a spectacular aura about grumpier has a spectacular aura about 
Solved Threads: 31
grumpier grumpier is offline Offline
Posting Whiz in Training

Re: (very) simple math not working perhaps due to to large numbers?

 
0
  #15
Jan 13th, 2009
Mathematical operations: operators like * (multiplication), + (addition), - (subtraction or negation), / (division), etc.

Splitting up large number and assigning them to an array of ints is one way: such things can be implemented using a class.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 670
Reputation: Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough 
Solved Threads: 113
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is offline Offline
Practically a Master Poster

Re: (very) simple math not working perhaps due to to large numbers?

 
0
  #16
Jan 13th, 2009
By defining mathematical operations he means you need to deal with things such as addition, multiplication etc.
You would do this by overloading the different operators such as operator+().
Also the you will want to overload the stream operators as grumpier suggested that would be the << and >> so that the data can be outputted into files and the standard output. Aswell as read into your data type.

Chris
Knowledge is power -- But experience is everything
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 111
Reputation: Bladtman242 is an unknown quantity at this point 
Solved Threads: 3
Bladtman242 Bladtman242 is offline Offline
Junior Poster

Re: (very) simple math not working perhaps due to to large numbers?

 
0
  #17
Jan 14th, 2009
I really dont mean to waste anyone's time, so i hope you will bare with me once again.

@Chris, you want me to save the data in files instead of in variables? and then make the calculation by changing the file instead of a variable?

@grumpier, thanks, at least that makes sence to me now ;-)

EDIT: If i use a file instead of a variable i would still have to asign the value to variable when i want to use it, right?
Last edited by Bladtman242; Jan 14th, 2009 at 12:27 pm.
Yo god, where do i report a bug?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC