473,799 Members | 3,080 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calculating 2^601 results in "1.#INF00"

14 New Member
I am trying to find 2 at the power of 601, but my calculator doesn't have a large enough screen, so I decided to make a program for my computer to do this, but when I get to a high number the computer only prints : 1.#INF00. Is there any way to do it? My code is the fallowing:

Expand|Select|Wrap|Line Numbers
  1.  #include <iostream> 
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6. float a;
  7. float x;
  8. float y;
  9.  
  10. main()
  11. {
  12. x=2;
  13. y=601;
  14. a = pow(x,y);
  15. printf("%f",a);
  16. cin.get();
  17.  
May 23 '07 #1
22 6248
DeMan
1,806 Top Contributor
2^601 is (VERY) very very very large.....
I suspect this number is two big for any of the primitives (I suspect even 2^100 is probably too large)
May 23 '07 #2
DeMan
1,806 Top Contributor
Others have come accross this problem before, you may like to take a look at this
May 23 '07 #3
Alexandre Proulx
14 New Member
Others have come accross this problem before, you may like to take a look at this
I'm trying to compile the NTL program but this is the answer I get from the compiler:


[Linker error] undefined reference to `touch_double(d ouble*)'
[Linker error] undefined reference to `val_double(dou ble)'
[Linker error] undefined reference to `val_double(dou ble)'
[Linker error] undefined reference to `touch_double(d ouble*)'
[Linker error] undefined reference to `val_double(dou ble)'




and etc.., what do I have to do?
May 24 '07 #4
DeMan
1,806 Top Contributor
It sounds like you have included the appropriate header files, but the compiler can't find the code ( .cpp) files.

You need to specify the path to the source files as well as to the headers

If you are using an IDE, this is as easy as making sure that the src folder is in the search path for the compiler
May 24 '07 #5
Alexandre Proulx
14 New Member
I downloaded WinNTL 5.4.1 and unzipped it in C:\ and Now I'm trying to
Compile the Program but I have a hard time doing so (Even though I
fallow the Instructions) could you or anybody try Compiling it, and
after that guide me through the steps? I can use the IDE Dev-C++ and
MinGW(Minimal GNU for Windows) as Compilers.

Thanks,
Alex
May 24 '07 #6
DeMan
1,806 Top Contributor
Could you please list some of the errors you are getting, the files you are including....

You can actually add each file (including the .cpp) to your project, ro you can go to the directories option under project options and add the directories these files are in
May 24 '07 #7
Alexandre Proulx
14 New Member
The Installation instructions of the program told me to compile everyting
in the src directory, and create a static library, which I did with
Dev-C++ IDE, everything went well with the compilation, but It created
a ".a" file instead of a ".lib" file. So this is why I asked you to try
it if you want, and then show me how, or if you already know how.

Thanks
May 24 '07 #8
DeMan
1,806 Top Contributor
A .a is much the same thing as a .lib....

in Dev go to "Project Options", select the "Parameters " Tab, Click "Add Library or Object" (lower Right Hand Side), and browse through to find your .a
May 24 '07 #9
Alexandre Proulx
14 New Member
Thanks the compilation works fine,
I compiled my program with the fallowing codes:

Expand|Select|Wrap|Line Numbers
  1.  #include <iostream> 
  2. #include <stdio.h>
  3. #include <math.h>
  4. #include <NTL/ZZ.h>
  5. #define NTL_NO_MIN_MAX ;
  6.  
  7. using namespace std;
  8. float a;
  9. float x;
  10. float y;
  11.  
  12. main()
  13. {
  14. x=2;
  15. y=601;
  16. a = pow(x,y);
  17. printf("%f",a);
  18. cin.get();
  19. }
  20.  
With the "ntl.a" file included also in Project Options,
and the src folder in the search path,
but my program stills print "1.#INF00".
Do you know of any other way?
May 25 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4492
by: Hans Gruber | last post by:
Hi all, I have been struggling with a problem all day, I have been unable to come up with a working solution. I want to write a function which takes 2 unix timestamps and calculates the difference. I want it to return the difference in years, months, days, hours, minutes and seconds (a complete summary). Keeping into account of course that these are 2 real dates, I dont want it to work with 30.475 as an average number of days in a...
6
9485
by: Stephen Miller | last post by:
Firstly, sorry for the long post, but I've included a fair bit of sample data. Im doing a comparision of 10yr Bond prices and CPI adjustments, with an 18 week moving average of the CPI. I'm using a nested sub-query to calculate the moving average, but I'm having difficulty selecting exactly 18 data points (ie When I include the 'HAVING COUNT(C1.Closes) = 18' line, I get no results). Can anyone help?
0
2275
by: Kasp | last post by:
Hi there, I am trying to make an OLAP cube on a table having two columns (datetime, Number_of_times_an_event_occured). My dimension is time and I want to measure the Min and Max times an event occured over time. I have no problem in calculating Maximum occurance of events over time. However, I have some NULL values in my Number_of_times_an_event_occured column, due to which I don't see any result when I try to calculate
1
4310
by: Tony Williams | last post by:
I have a table with two fields, txtvalue (a number field) and txtmonth ( a date/time field). I want to create a report that shows the difference in value between the value in txtvalue in one value of txtmonth and the value of txtvalue in another value of txtmonth and the percentage increase . For example if I have the value 1000 in 30/03/03 and the value 1100 in 30/03/04 How do I calculate the difference as 100 and the increase as 10%. I...
3
5346
by: Miller | last post by:
Hi, Can someone tell me how to calculate MFLOPS for the following C# code (on a Pentium 4 2.0 Ghz)? for (i=0; i<n; i++) { for (j=0; j<n; j++) { for (k=0; k<n; k++)
12
9884
by: Larry Bates | last post by:
I'm trying to get the results of binascii.crc32 to match the results of another utility that produces 32 bit unsigned CRCs. binascii.crc32 returns results in the range of -2**31-1 and 2**21-1. Has anyone ever worked out any "bit twiddling" code to get a proper unsigned 32 bit result from binascii.crc32? Output snip from test on three files: binascii.crc32=-1412119273, oldcrc32= 2221277246
5
4175
by: Mr. Ken | last post by:
I am calculating the phase of an IQ signal, which are polluted by AWGN gaussian noise. Thus, near pi/2, direct division of atan(Q/I) may yield outputs either +pi/2 or -pi/2. How do I handle this situation? Thanks.
9
21385
by: clintonb | last post by:
I'm looking for a way to calculate the number of days between two dates using standard C++ functions. Would it be as simple as just using the difftime() function and then dividing that result by the number of seconds in a day? - Clint
6
1944
by: Avi | last post by:
I need to implement the following calculation: f = (a*b) + (c*d) where a,b,c,d are given double values and f is a double variable for the result I found out that using two different implementations gives two different results: 1) In the first implementation I compute the entire equation in memory 2) In the second implementation I store intermediate to variables, and then load them to compute the final result.
2
59840
jkmyoung
by: jkmyoung | last post by:
Calculating Large Exponents Background: This is a quick article as to how to calculate the exponents of large numbers quickly and efficiently. Starting with a basic multiplication algorithm, it gives subsequently faster algorithms and a few quick examples. The techniques used in this article can be used in general mathematics, encryption, among other things. In this article, the following conventions are used: ^ operator is to mean...
0
9541
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
10484
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
10251
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...
1
10228
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
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...
1
4141
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
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
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.