MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / powInt

Function powInt

src/CPnumerics.cpp:40–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 }
39}
40double powInt(double x, int y) {
41 // Raise a double to an integer power
42 // Overload not provided in math.h
43 int i = 0;
44 double product = 1.0;
45 double x_in = NAN;
46 int y_in = 0;
47
48 if (y == 0) {
49 return 1.0;
50 }
51
52 if (y < 0) {
53 x_in = 1 / x;
54 y_in = -y;
55 } else {
56 x_in = x;
57 y_in = y;
58 }
59
60 if (y_in == 1) {
61 return x_in;
62 }
63
64 product = x_in;
65 for (i = 1; i < y_in; i++) {
66 product = product * x_in;
67 }
68 return product;
69}
70
71void MatInv_2(double A[2][2], double B[2][2]) {
72 double Det = NAN;

Callers 11

allMethod · 0.85
visc_HelperFunction · 0.85
spinodal_densitiesMethod · 0.85
termMethod · 0.85
calc_all_termsMethod · 0.85
gE_RMethod · 0.85
d_gE_R_dxiMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected