Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to make power for fraction in C++?

Status
Not open for further replies.

fatma1000

Banned
Full Member level 2
Joined
Apr 30, 2006
Messages
147
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Location
eygpt
Activity points
0
help12 c++

the function pow like
pow(2,4)

is correct but whin the first number is fraction like

pow(0.5,4)

it is not correct why?

how can i make power for fraction like (0.5) powered to 4
0.5*0.5*0.5*0.5

regards
 

help12 c++

if my long forgotten maths serves me here:

pow(0.5,4) = 1/pow(2,4)
 

Re: help12 c++

The above method works but only for fractions less than 1. You can use the above and the pow(x,y) function in a recursive loop to solve the problem.

Cheers
Slayer
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top