Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\left(e^{x} - 2\right) + e^{-x}
\]
↓
\[\begin{array}{l}
t_0 := \left(e^{x} - 2\right) + e^{-x}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-11}:\\
\;\;\;\;{x}^{2}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
(FPCore (x) :precision binary64 (+ (- (exp x) 2.0) (exp (- x)))) ↓
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (- (exp x) 2.0) (exp (- x)))))
(if (<= t_0 5e-11) (pow x 2.0) t_0))) double code(double x) {
return (exp(x) - 2.0) + exp(-x);
}
↓
double code(double x) {
double t_0 = (exp(x) - 2.0) + exp(-x);
double tmp;
if (t_0 <= 5e-11) {
tmp = pow(x, 2.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (exp(x) - 2.0d0) + exp(-x)
end function
↓
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = (exp(x) - 2.0d0) + exp(-x)
if (t_0 <= 5d-11) then
tmp = x ** 2.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x) {
return (Math.exp(x) - 2.0) + Math.exp(-x);
}
↓
public static double code(double x) {
double t_0 = (Math.exp(x) - 2.0) + Math.exp(-x);
double tmp;
if (t_0 <= 5e-11) {
tmp = Math.pow(x, 2.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x):
return (math.exp(x) - 2.0) + math.exp(-x)
↓
def code(x):
t_0 = (math.exp(x) - 2.0) + math.exp(-x)
tmp = 0
if t_0 <= 5e-11:
tmp = math.pow(x, 2.0)
else:
tmp = t_0
return tmp
function code(x)
return Float64(Float64(exp(x) - 2.0) + exp(Float64(-x)))
end
↓
function code(x)
t_0 = Float64(Float64(exp(x) - 2.0) + exp(Float64(-x)))
tmp = 0.0
if (t_0 <= 5e-11)
tmp = x ^ 2.0;
else
tmp = t_0;
end
return tmp
end
function tmp = code(x)
tmp = (exp(x) - 2.0) + exp(-x);
end
↓
function tmp_2 = code(x)
t_0 = (exp(x) - 2.0) + exp(-x);
tmp = 0.0;
if (t_0 <= 5e-11)
tmp = x ^ 2.0;
else
tmp = t_0;
end
tmp_2 = tmp;
end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - 2.0), $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
↓
code[x_] := Block[{t$95$0 = N[(N[(N[Exp[x], $MachinePrecision] - 2.0), $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-11], N[Power[x, 2.0], $MachinePrecision], t$95$0]]
\left(e^{x} - 2\right) + e^{-x}
↓
\begin{array}{l}
t_0 := \left(e^{x} - 2\right) + e^{-x}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-11}:\\
\;\;\;\;{x}^{2}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}