Raise Numbers to Power 4/5 Quickly w/C Program

  • Thread starter Madou
  • Start date
  • Tags
    Power
In summary, the speaker is looking for a way to quickly raise multiple numbers to the power of 4/5. They have considered using an online calculator or writing a C program, but are open to other suggestions. They are grateful for the suggestion to use a formula in Excel for this task.
  • #1
Madou
42
0
raise to power (4/5) !

i need to raise a dozen of numbers to the power 4/5 . i can use any online calculator but i didn't find any yet... or i can write a simple C program. but i don't know how. (i can write simple C programs). any ideas? or how would you do it on my place?
and i need to do it fast ;)
 
Physics news on Phys.org
  • #3


If it's a lot of numbers, I would do this in Excel.

Use a formula like
=A1^0.8
for example.
 
  • #4


thank you ;)
 

1. How do I raise a number to the power of 4 or 5 quickly using a C program?

To raise a number to the power of 4 or 5 quickly using a C program, you can use the pow() function from the math library. This function takes two arguments - the base number and the exponent. For example, to raise the number 2 to the power of 4, you would use the code pow(2, 4). This will return the result of 2 to the power of 4, which is 16.

2. Can I use any number as the base when raising to the power of 4 or 5?

Yes, you can use any number as the base when raising to the power of 4 or 5 in a C program. The pow() function supports both integer and floating-point numbers as the base.

3. Is there a faster way to raise a number to the power of 4 or 5 in a C program?

Yes, there is a faster way to raise a number to the power of 4 or 5 in a C program. You can use bit shifting operations to quickly compute the power of 4 or 5. For example, to raise the number 2 to the power of 4, you can use the code (2 << 2) << 2. This will shift the bits of 2 by 2 places twice, resulting in 16.

4. What happens if I raise a negative number to the power of 4 or 5 in a C program?

If you raise a negative number to the power of 4 or 5 in a C program, the result will depend on whether the exponent is an even or odd number. If the exponent is even, the result will be positive. If the exponent is odd, the result will be negative. For example, (-2)^4 will result in 16, while (-2)^5 will result in -32.

5. Can I raise a number to a non-integer power in a C program?

Yes, you can raise a number to a non-integer power in a C program. The pow() function supports floating-point numbers as the exponent, allowing you to raise a number to a non-integer power. For example, pow(2, 2.5) will result in 5.656854, which is 2 to the power of 2.5.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
203
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
957
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
22
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
912
Back
Top