-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmathFunctions.c
47 lines (43 loc) · 1.07 KB
/
mathFunctions.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <stdio.h>
#include <math.h>
double exp(double p){
const double e = 2.71828182818281828;
double result = pow(e, p);
return result;
}
double log(double p){
p = printf("Enter a number to log with base 10 > ");
if(p > 0){
double result = log10(p);
return result;
}
else{_exception("You cannot log a number <= 0! \n");}
}
double loge(double x){
x = printf("Please enter a number to log with base e > ");
const double e = 2.71828182818281828;
if(x > 0){
double result = log(x) / log(e);
return result;
}
else{_exception("You cannot log a number <= 0! \n");}
}
int main(){
int po;
printf("Enter a number to use base e with: ");
scanf("%d", &po);
if (po > 0){
double result = exp(po);
printf("Result = %lf\n", result);
}
else if (po == 0){
printf("You'll get %lf\n", exp(0));
}
else if (po <= -1 && po >= -101){
printf("The value is %lf\n", exp(po));
}
else{
printf("Too small of a value to be feasible.\n");
}
return 0;
}