From the course: C Standard Library

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Powers and exponentials example

Powers and exponentials example - C Tutorial

From the course: C Standard Library

Start my 1-month free trial

Powers and exponentials example

- [Narrator] This will be another very simple example where I'll show you these functions. So I will do that in a series of printf statements. Let me first write, for example, three raised to the fourth power equals this value. So I will call the pow function which uses the base and the exponent as arguments. So I'll use 3.0 and 4.0. Let's break a line here, and let's see how this looks. And we get that three raised to the fourth power equals 81, which seems about right. Now, let's see some other functions. Let's now see the exponential function. And let's use something that we can identify. So let's use the exp2 function. So this one raises two to some power. So let's say, two raised to the tenth power equals this number. So again I will raise two to the tenth power. Let's see how it looks. And we got that two to the tenth power is 1,024. So notice how the power function is different from the exp2 function because exp2 uses two as the base and by the way, exp uses 10 as the base but…

Contents