Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,938 questions

51,875 answers

573 users

How to calculate power with a large exponent in C

1 Answer

0 votes
#include <stdio.h>
#include <math.h>

int main(void) {
    double base = 2.0;
    double exponent = 1000.0;

    double result = pow(base, exponent);

    printf("%lf\n", result);
    printf("%e\n", result);

    return 0;
}
 

 
/*
run:
 
10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376.000000
1.071509e+301
 
*/

 

 



answered Nov 9, 2023 by avibootz
...