\[\frac{e^{x} - 1}{x}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq -0.00125:\\
\;\;\;\;\frac{e^{x} - 1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot {x}^{2} + \left(0.16666666666666666 \cdot {x}^{3} + \left(x + 0.041666666666666664 \cdot {x}^{4}\right)\right)}{x}\\
\end{array}
\]
(FPCore (x) :precision binary64 (/ (- (exp x) 1.0) x))
↓
(FPCore (x)
:precision binary64
(if (<= x -0.00125)
(/ (- (exp x) 1.0) x)
(/
(+
(* 0.5 (pow x 2.0))
(+
(* 0.16666666666666666 (pow x 3.0))
(+ x (* 0.041666666666666664 (pow x 4.0)))))
x)))double code(double x) {
return (exp(x) - 1.0) / x;
}
↓
double code(double x) {
double tmp;
if (x <= -0.00125) {
tmp = (exp(x) - 1.0) / x;
} else {
tmp = ((0.5 * pow(x, 2.0)) + ((0.16666666666666666 * pow(x, 3.0)) + (x + (0.041666666666666664 * pow(x, 4.0))))) / x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (exp(x) - 1.0d0) / x
end function
↓
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-0.00125d0)) then
tmp = (exp(x) - 1.0d0) / x
else
tmp = ((0.5d0 * (x ** 2.0d0)) + ((0.16666666666666666d0 * (x ** 3.0d0)) + (x + (0.041666666666666664d0 * (x ** 4.0d0))))) / x
end if
code = tmp
end function
public static double code(double x) {
return (Math.exp(x) - 1.0) / x;
}
↓
public static double code(double x) {
double tmp;
if (x <= -0.00125) {
tmp = (Math.exp(x) - 1.0) / x;
} else {
tmp = ((0.5 * Math.pow(x, 2.0)) + ((0.16666666666666666 * Math.pow(x, 3.0)) + (x + (0.041666666666666664 * Math.pow(x, 4.0))))) / x;
}
return tmp;
}
def code(x):
return (math.exp(x) - 1.0) / x
↓
def code(x):
tmp = 0
if x <= -0.00125:
tmp = (math.exp(x) - 1.0) / x
else:
tmp = ((0.5 * math.pow(x, 2.0)) + ((0.16666666666666666 * math.pow(x, 3.0)) + (x + (0.041666666666666664 * math.pow(x, 4.0))))) / x
return tmp
function code(x)
return Float64(Float64(exp(x) - 1.0) / x)
end
↓
function code(x)
tmp = 0.0
if (x <= -0.00125)
tmp = Float64(Float64(exp(x) - 1.0) / x);
else
tmp = Float64(Float64(Float64(0.5 * (x ^ 2.0)) + Float64(Float64(0.16666666666666666 * (x ^ 3.0)) + Float64(x + Float64(0.041666666666666664 * (x ^ 4.0))))) / x);
end
return tmp
end
function tmp = code(x)
tmp = (exp(x) - 1.0) / x;
end
↓
function tmp_2 = code(x)
tmp = 0.0;
if (x <= -0.00125)
tmp = (exp(x) - 1.0) / x;
else
tmp = ((0.5 * (x ^ 2.0)) + ((0.16666666666666666 * (x ^ 3.0)) + (x + (0.041666666666666664 * (x ^ 4.0))))) / x;
end
tmp_2 = tmp;
end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - 1.0), $MachinePrecision] / x), $MachinePrecision]
↓
code[x_] := If[LessEqual[x, -0.00125], N[(N[(N[Exp[x], $MachinePrecision] - 1.0), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(0.5 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x + N[(0.041666666666666664 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\frac{e^{x} - 1}{x}
↓
\begin{array}{l}
\mathbf{if}\;x \leq -0.00125:\\
\;\;\;\;\frac{e^{x} - 1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot {x}^{2} + \left(0.16666666666666666 \cdot {x}^{3} + \left(x + 0.041666666666666664 \cdot {x}^{4}\right)\right)}{x}\\
\end{array}