
(FPCore (x) :precision binary64 (/ (- (exp x) (exp (- x))) 2.0))
double code(double x) {
return (exp(x) - exp(-x)) / 2.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (exp(x) - exp(-x)) / 2.0d0
end function
public static double code(double x) {
return (Math.exp(x) - Math.exp(-x)) / 2.0;
}
def code(x): return (math.exp(x) - math.exp(-x)) / 2.0
function code(x) return Float64(Float64(exp(x) - exp(Float64(-x))) / 2.0) end
function tmp = code(x) tmp = (exp(x) - exp(-x)) / 2.0; end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x} - e^{-x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (/ (- (exp x) (exp (- x))) 2.0))
double code(double x) {
return (exp(x) - exp(-x)) / 2.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (exp(x) - exp(-x)) / 2.0d0
end function
public static double code(double x) {
return (Math.exp(x) - Math.exp(-x)) / 2.0;
}
def code(x): return (math.exp(x) - math.exp(-x)) / 2.0
function code(x) return Float64(Float64(exp(x) - exp(Float64(-x))) / 2.0) end
function tmp = code(x) tmp = (exp(x) - exp(-x)) / 2.0; end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x} - e^{-x}}{2}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (- (exp x) (exp (- x)))))
(if (or (<= t_0 -0.5) (not (<= t_0 0.0002)))
(/ t_0 2.0)
(/
(+
(* x 2.0)
(+
(* 0.3333333333333333 (pow x 3.0))
(* 0.016666666666666666 (pow x 5.0))))
2.0))))
double code(double x) {
double t_0 = exp(x) - exp(-x);
double tmp;
if ((t_0 <= -0.5) || !(t_0 <= 0.0002)) {
tmp = t_0 / 2.0;
} else {
tmp = ((x * 2.0) + ((0.3333333333333333 * pow(x, 3.0)) + (0.016666666666666666 * pow(x, 5.0)))) / 2.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = exp(x) - exp(-x)
if ((t_0 <= (-0.5d0)) .or. (.not. (t_0 <= 0.0002d0))) then
tmp = t_0 / 2.0d0
else
tmp = ((x * 2.0d0) + ((0.3333333333333333d0 * (x ** 3.0d0)) + (0.016666666666666666d0 * (x ** 5.0d0)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.exp(x) - Math.exp(-x);
double tmp;
if ((t_0 <= -0.5) || !(t_0 <= 0.0002)) {
tmp = t_0 / 2.0;
} else {
tmp = ((x * 2.0) + ((0.3333333333333333 * Math.pow(x, 3.0)) + (0.016666666666666666 * Math.pow(x, 5.0)))) / 2.0;
}
return tmp;
}
def code(x): t_0 = math.exp(x) - math.exp(-x) tmp = 0 if (t_0 <= -0.5) or not (t_0 <= 0.0002): tmp = t_0 / 2.0 else: tmp = ((x * 2.0) + ((0.3333333333333333 * math.pow(x, 3.0)) + (0.016666666666666666 * math.pow(x, 5.0)))) / 2.0 return tmp
function code(x) t_0 = Float64(exp(x) - exp(Float64(-x))) tmp = 0.0 if ((t_0 <= -0.5) || !(t_0 <= 0.0002)) tmp = Float64(t_0 / 2.0); else tmp = Float64(Float64(Float64(x * 2.0) + Float64(Float64(0.3333333333333333 * (x ^ 3.0)) + Float64(0.016666666666666666 * (x ^ 5.0)))) / 2.0); end return tmp end
function tmp_2 = code(x) t_0 = exp(x) - exp(-x); tmp = 0.0; if ((t_0 <= -0.5) || ~((t_0 <= 0.0002))) tmp = t_0 / 2.0; else tmp = ((x * 2.0) + ((0.3333333333333333 * (x ^ 3.0)) + (0.016666666666666666 * (x ^ 5.0)))) / 2.0; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[Exp[x], $MachinePrecision] - N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.5], N[Not[LessEqual[t$95$0, 0.0002]], $MachinePrecision]], N[(t$95$0 / 2.0), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] + N[(N[(0.3333333333333333 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(0.016666666666666666 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x} - e^{-x}\\
\mathbf{if}\;t_0 \leq -0.5 \lor \neg \left(t_0 \leq 0.0002\right):\\
\;\;\;\;\frac{t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2 + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)}{2}\\
\end{array}
\end{array}
if (-.f64 (exp.f64 x) (exp.f64 (neg.f64 x))) < -0.5 or 2.0000000000000001e-4 < (-.f64 (exp.f64 x) (exp.f64 (neg.f64 x))) Initial program 100.0%
if -0.5 < (-.f64 (exp.f64 x) (exp.f64 (neg.f64 x))) < 2.0000000000000001e-4Initial program 7.5%
Taylor expanded in x around 0 100.0%
Final simplification100.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (exp x) (exp (- x)))))
(if (or (<= t_0 -0.004) (not (<= t_0 0.0002)))
(/ t_0 2.0)
(/ (* x (+ 2.0 (* x (* x 0.3333333333333333)))) 2.0))))
double code(double x) {
double t_0 = exp(x) - exp(-x);
double tmp;
if ((t_0 <= -0.004) || !(t_0 <= 0.0002)) {
tmp = t_0 / 2.0;
} else {
tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = exp(x) - exp(-x)
if ((t_0 <= (-0.004d0)) .or. (.not. (t_0 <= 0.0002d0))) then
tmp = t_0 / 2.0d0
else
tmp = (x * (2.0d0 + (x * (x * 0.3333333333333333d0)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.exp(x) - Math.exp(-x);
double tmp;
if ((t_0 <= -0.004) || !(t_0 <= 0.0002)) {
tmp = t_0 / 2.0;
} else {
tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0;
}
return tmp;
}
def code(x): t_0 = math.exp(x) - math.exp(-x) tmp = 0 if (t_0 <= -0.004) or not (t_0 <= 0.0002): tmp = t_0 / 2.0 else: tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0 return tmp
function code(x) t_0 = Float64(exp(x) - exp(Float64(-x))) tmp = 0.0 if ((t_0 <= -0.004) || !(t_0 <= 0.0002)) tmp = Float64(t_0 / 2.0); else tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x * 0.3333333333333333)))) / 2.0); end return tmp end
function tmp_2 = code(x) t_0 = exp(x) - exp(-x); tmp = 0.0; if ((t_0 <= -0.004) || ~((t_0 <= 0.0002))) tmp = t_0 / 2.0; else tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[Exp[x], $MachinePrecision] - N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.004], N[Not[LessEqual[t$95$0, 0.0002]], $MachinePrecision]], N[(t$95$0 / 2.0), $MachinePrecision], N[(N[(x * N[(2.0 + N[(x * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x} - e^{-x}\\
\mathbf{if}\;t_0 \leq -0.004 \lor \neg \left(t_0 \leq 0.0002\right):\\
\;\;\;\;\frac{t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x \cdot 0.3333333333333333\right)\right)}{2}\\
\end{array}
\end{array}
if (-.f64 (exp.f64 x) (exp.f64 (neg.f64 x))) < -0.0040000000000000001 or 2.0000000000000001e-4 < (-.f64 (exp.f64 x) (exp.f64 (neg.f64 x))) Initial program 99.9%
if -0.0040000000000000001 < (-.f64 (exp.f64 x) (exp.f64 (neg.f64 x))) < 2.0000000000000001e-4Initial program 6.8%
Taylor expanded in x around 0 100.0%
unpow3100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
+-commutative100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
fma-udef100.0%
associate-*r*100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x)
:precision binary64
(if (<= x -5.0)
(/ (* 0.016666666666666666 (pow x 5.0)) 2.0)
(if (<= x 5e+41)
(/ (* x (+ 2.0 (* x (* x 0.3333333333333333)))) 2.0)
(sqrt (* (pow x 6.0) 0.027777777777777776)))))
double code(double x) {
double tmp;
if (x <= -5.0) {
tmp = (0.016666666666666666 * pow(x, 5.0)) / 2.0;
} else if (x <= 5e+41) {
tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0;
} else {
tmp = sqrt((pow(x, 6.0) * 0.027777777777777776));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-5.0d0)) then
tmp = (0.016666666666666666d0 * (x ** 5.0d0)) / 2.0d0
else if (x <= 5d+41) then
tmp = (x * (2.0d0 + (x * (x * 0.3333333333333333d0)))) / 2.0d0
else
tmp = sqrt(((x ** 6.0d0) * 0.027777777777777776d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -5.0) {
tmp = (0.016666666666666666 * Math.pow(x, 5.0)) / 2.0;
} else if (x <= 5e+41) {
tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0;
} else {
tmp = Math.sqrt((Math.pow(x, 6.0) * 0.027777777777777776));
}
return tmp;
}
def code(x): tmp = 0 if x <= -5.0: tmp = (0.016666666666666666 * math.pow(x, 5.0)) / 2.0 elif x <= 5e+41: tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0 else: tmp = math.sqrt((math.pow(x, 6.0) * 0.027777777777777776)) return tmp
function code(x) tmp = 0.0 if (x <= -5.0) tmp = Float64(Float64(0.016666666666666666 * (x ^ 5.0)) / 2.0); elseif (x <= 5e+41) tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x * 0.3333333333333333)))) / 2.0); else tmp = sqrt(Float64((x ^ 6.0) * 0.027777777777777776)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -5.0) tmp = (0.016666666666666666 * (x ^ 5.0)) / 2.0; elseif (x <= 5e+41) tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0; else tmp = sqrt(((x ^ 6.0) * 0.027777777777777776)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -5.0], N[(N[(0.016666666666666666 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+41], N[(N[(x * N[(2.0 + N[(x * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[Sqrt[N[(N[Power[x, 6.0], $MachinePrecision] * 0.027777777777777776), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\frac{0.016666666666666666 \cdot {x}^{5}}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+41}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x \cdot 0.3333333333333333\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{x}^{6} \cdot 0.027777777777777776}\\
\end{array}
\end{array}
if x < -5Initial program 100.0%
Taylor expanded in x around 0 82.6%
Taylor expanded in x around inf 82.6%
if -5 < x < 5.00000000000000022e41Initial program 18.8%
Taylor expanded in x around 0 88.6%
unpow388.6%
associate-*r*88.6%
distribute-rgt-out88.6%
*-commutative88.6%
+-commutative88.6%
associate-*l*88.6%
fma-def88.6%
Simplified88.6%
fma-udef88.6%
associate-*r*88.6%
Applied egg-rr88.6%
Taylor expanded in x around 0 88.6%
unpow288.6%
*-commutative88.6%
associate-*l*88.6%
*-commutative88.6%
Simplified88.6%
if 5.00000000000000022e41 < x Initial program 100.0%
Taylor expanded in x around 0 76.9%
unpow376.9%
associate-*r*76.9%
distribute-rgt-out76.9%
*-commutative76.9%
+-commutative76.9%
associate-*l*76.9%
fma-def76.9%
Simplified76.9%
Taylor expanded in x around inf 76.9%
unpow276.9%
Simplified76.9%
associate-/l*76.9%
div-inv76.9%
associate-/r*76.9%
metadata-eval76.9%
Applied egg-rr76.9%
clear-num76.9%
div-inv76.9%
metadata-eval76.9%
associate-*l*76.9%
cube-mult76.9%
add-sqr-sqrt76.9%
sqrt-unprod96.8%
swap-sqr96.8%
pow-prod-up96.8%
metadata-eval96.8%
metadata-eval96.8%
Applied egg-rr96.8%
Final simplification89.0%
(FPCore (x) :precision binary64 (if (or (<= x -5.0) (not (<= x 5.0))) (/ (* 0.016666666666666666 (pow x 5.0)) 2.0) (/ (* x (+ 2.0 (* x (* x 0.3333333333333333)))) 2.0)))
double code(double x) {
double tmp;
if ((x <= -5.0) || !(x <= 5.0)) {
tmp = (0.016666666666666666 * pow(x, 5.0)) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-5.0d0)) .or. (.not. (x <= 5.0d0))) then
tmp = (0.016666666666666666d0 * (x ** 5.0d0)) / 2.0d0
else
tmp = (x * (2.0d0 + (x * (x * 0.3333333333333333d0)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -5.0) || !(x <= 5.0)) {
tmp = (0.016666666666666666 * Math.pow(x, 5.0)) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0;
}
return tmp;
}
def code(x): tmp = 0 if (x <= -5.0) or not (x <= 5.0): tmp = (0.016666666666666666 * math.pow(x, 5.0)) / 2.0 else: tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0 return tmp
function code(x) tmp = 0.0 if ((x <= -5.0) || !(x <= 5.0)) tmp = Float64(Float64(0.016666666666666666 * (x ^ 5.0)) / 2.0); else tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x * 0.3333333333333333)))) / 2.0); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -5.0) || ~((x <= 5.0))) tmp = (0.016666666666666666 * (x ^ 5.0)) / 2.0; else tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0; end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -5.0], N[Not[LessEqual[x, 5.0]], $MachinePrecision]], N[(N[(0.016666666666666666 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(2.0 + N[(x * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \lor \neg \left(x \leq 5\right):\\
\;\;\;\;\frac{0.016666666666666666 \cdot {x}^{5}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x \cdot 0.3333333333333333\right)\right)}{2}\\
\end{array}
\end{array}
if x < -5 or 5 < x Initial program 100.0%
Taylor expanded in x around 0 79.6%
Taylor expanded in x around inf 79.6%
if -5 < x < 5Initial program 9.1%
Taylor expanded in x around 0 98.7%
unpow398.7%
associate-*r*98.7%
distribute-rgt-out98.7%
*-commutative98.7%
+-commutative98.7%
associate-*l*98.7%
fma-def98.7%
Simplified98.7%
fma-udef98.7%
associate-*r*98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 98.7%
unpow298.7%
*-commutative98.7%
associate-*l*98.7%
*-commutative98.7%
Simplified98.7%
Final simplification88.4%
(FPCore (x) :precision binary64 (if (or (<= x -2.45) (not (<= x 2.4))) (* x (* x (* x 0.16666666666666666))) (/ (* x 2.0) 2.0)))
double code(double x) {
double tmp;
if ((x <= -2.45) || !(x <= 2.4)) {
tmp = x * (x * (x * 0.16666666666666666));
} else {
tmp = (x * 2.0) / 2.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-2.45d0)) .or. (.not. (x <= 2.4d0))) then
tmp = x * (x * (x * 0.16666666666666666d0))
else
tmp = (x * 2.0d0) / 2.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -2.45) || !(x <= 2.4)) {
tmp = x * (x * (x * 0.16666666666666666));
} else {
tmp = (x * 2.0) / 2.0;
}
return tmp;
}
def code(x): tmp = 0 if (x <= -2.45) or not (x <= 2.4): tmp = x * (x * (x * 0.16666666666666666)) else: tmp = (x * 2.0) / 2.0 return tmp
function code(x) tmp = 0.0 if ((x <= -2.45) || !(x <= 2.4)) tmp = Float64(x * Float64(x * Float64(x * 0.16666666666666666))); else tmp = Float64(Float64(x * 2.0) / 2.0); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -2.45) || ~((x <= 2.4))) tmp = x * (x * (x * 0.16666666666666666)); else tmp = (x * 2.0) / 2.0; end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -2.45], N[Not[LessEqual[x, 2.4]], $MachinePrecision]], N[(x * N[(x * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \lor \neg \left(x \leq 2.4\right):\\
\;\;\;\;x \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{2}\\
\end{array}
\end{array}
if x < -2.4500000000000002 or 2.39999999999999991 < x Initial program 100.0%
Taylor expanded in x around 0 66.1%
unpow366.1%
associate-*r*66.1%
distribute-rgt-out66.1%
*-commutative66.1%
+-commutative66.1%
associate-*l*66.1%
fma-def66.1%
Simplified66.1%
Taylor expanded in x around inf 66.1%
unpow266.1%
Simplified66.1%
associate-/l*66.1%
div-inv66.1%
associate-/r*66.1%
metadata-eval66.1%
Applied egg-rr66.1%
associate-/r/66.1%
metadata-eval66.1%
associate-*r*66.1%
Applied egg-rr66.1%
if -2.4500000000000002 < x < 2.39999999999999991Initial program 9.1%
Taylor expanded in x around 0 98.0%
Final simplification80.7%
(FPCore (x) :precision binary64 (/ (* x (+ 2.0 (* x (* x 0.3333333333333333)))) 2.0))
double code(double x) {
return (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x * (2.0d0 + (x * (x * 0.3333333333333333d0)))) / 2.0d0
end function
public static double code(double x) {
return (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0;
}
def code(x): return (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0
function code(x) return Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x * 0.3333333333333333)))) / 2.0) end
function tmp = code(x) tmp = (x * (2.0 + (x * (x * 0.3333333333333333)))) / 2.0; end
code[x_] := N[(N[(x * N[(2.0 + N[(x * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(2 + x \cdot \left(x \cdot 0.3333333333333333\right)\right)}{2}
\end{array}
Initial program 58.4%
Taylor expanded in x around 0 81.0%
unpow381.0%
associate-*r*81.0%
distribute-rgt-out81.0%
*-commutative81.0%
+-commutative81.0%
associate-*l*81.0%
fma-def81.0%
Simplified81.0%
fma-udef81.0%
associate-*r*81.0%
Applied egg-rr81.0%
Taylor expanded in x around 0 81.0%
unpow281.0%
*-commutative81.0%
associate-*l*81.0%
*-commutative81.0%
Simplified81.0%
Final simplification81.0%
(FPCore (x) :precision binary64 (/ (* x 2.0) 2.0))
double code(double x) {
return (x * 2.0) / 2.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x * 2.0d0) / 2.0d0
end function
public static double code(double x) {
return (x * 2.0) / 2.0;
}
def code(x): return (x * 2.0) / 2.0
function code(x) return Float64(Float64(x * 2.0) / 2.0) end
function tmp = code(x) tmp = (x * 2.0) / 2.0; end
code[x_] := N[(N[(x * 2.0), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot 2}{2}
\end{array}
Initial program 58.4%
Taylor expanded in x around 0 47.7%
Final simplification47.7%
(FPCore (x) :precision binary64 -1.0)
double code(double x) {
return -1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = -1.0d0
end function
public static double code(double x) {
return -1.0;
}
def code(x): return -1.0
function code(x) return -1.0 end
function tmp = code(x) tmp = -1.0; end
code[x_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 58.4%
Applied egg-rr2.9%
Final simplification2.9%
(FPCore (x) :precision binary64 0.0)
double code(double x) {
return 0.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.0d0
end function
public static double code(double x) {
return 0.0;
}
def code(x): return 0.0
function code(x) return 0.0 end
function tmp = code(x) tmp = 0.0; end
code[x_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 58.4%
Applied egg-rr3.3%
Final simplification3.3%
herbie shell --seed 2023244
(FPCore (x)
:name "Hyperbolic sine"
:precision binary64
(/ (- (exp x) (exp (- x))) 2.0))