
(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 17 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 (sinh x))
double code(double x) {
return sinh(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = sinh(x)
end function
public static double code(double x) {
return Math.sinh(x);
}
def code(x): return math.sinh(x)
function code(x) return sinh(x) end
function tmp = code(x) tmp = sinh(x); end
code[x_] := N[Sinh[x], $MachinePrecision]
\begin{array}{l}
\\
\sinh x
\end{array}
Initial program 53.9%
sinh-defN/A
lower-sinh.f64100.0
Applied egg-rr100.0%
(FPCore (x) :precision binary64 (if (<= (- (exp x) (exp (- x))) 0.1) x (* x (* x x))))
double code(double x) {
double tmp;
if ((exp(x) - exp(-x)) <= 0.1) {
tmp = x;
} else {
tmp = x * (x * x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((exp(x) - exp(-x)) <= 0.1d0) then
tmp = x
else
tmp = x * (x * x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((Math.exp(x) - Math.exp(-x)) <= 0.1) {
tmp = x;
} else {
tmp = x * (x * x);
}
return tmp;
}
def code(x): tmp = 0 if (math.exp(x) - math.exp(-x)) <= 0.1: tmp = x else: tmp = x * (x * x) return tmp
function code(x) tmp = 0.0 if (Float64(exp(x) - exp(Float64(-x))) <= 0.1) tmp = x; else tmp = Float64(x * Float64(x * x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((exp(x) - exp(-x)) <= 0.1) tmp = x; else tmp = x * (x * x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[Exp[x], $MachinePrecision] - N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 0.1], x, N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{x} - e^{-x} \leq 0.1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 x) (exp.f64 (neg.f64 x))) < 0.10000000000000001Initial program 38.6%
Taylor expanded in x around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6495.0
Simplified95.0%
Taylor expanded in x around 0
Simplified68.8%
*-rgt-identity68.8
Applied egg-rr68.8%
if 0.10000000000000001 < (-.f64 (exp.f64 x) (exp.f64 (neg.f64 x))) Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6479.2
Simplified79.2%
Taylor expanded in x around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6485.1
Simplified85.1%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6474.9
Simplified74.9%
Taylor expanded in x around inf
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6468.8
Simplified68.8%
(FPCore (x) :precision binary64 (if (<= (- (exp x) (exp (- x))) 0.1) x (* x x)))
double code(double x) {
double tmp;
if ((exp(x) - exp(-x)) <= 0.1) {
tmp = x;
} else {
tmp = x * x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((exp(x) - exp(-x)) <= 0.1d0) then
tmp = x
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((Math.exp(x) - Math.exp(-x)) <= 0.1) {
tmp = x;
} else {
tmp = x * x;
}
return tmp;
}
def code(x): tmp = 0 if (math.exp(x) - math.exp(-x)) <= 0.1: tmp = x else: tmp = x * x return tmp
function code(x) tmp = 0.0 if (Float64(exp(x) - exp(Float64(-x))) <= 0.1) tmp = x; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((exp(x) - exp(-x)) <= 0.1) tmp = x; else tmp = x * x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[Exp[x], $MachinePrecision] - N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 0.1], x, N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{x} - e^{-x} \leq 0.1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (-.f64 (exp.f64 x) (exp.f64 (neg.f64 x))) < 0.10000000000000001Initial program 38.6%
Taylor expanded in x around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6495.0
Simplified95.0%
Taylor expanded in x around 0
Simplified68.8%
*-rgt-identity68.8
Applied egg-rr68.8%
if 0.10000000000000001 < (-.f64 (exp.f64 x) (exp.f64 (neg.f64 x))) Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6479.2
Simplified79.2%
Taylor expanded in x around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6485.1
Simplified85.1%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6474.9
Simplified74.9%
Taylor expanded in x around -inf
unpow2N/A
lower-*.f6458.4
Simplified58.4%
(FPCore (x)
:precision binary64
(*
x
(fma
(* x x)
(fma
x
(* 0.0001984126984126984 (* x (* x (* x (* x x)))))
0.16666666666666666)
1.0)))
double code(double x) {
return x * fma((x * x), fma(x, (0.0001984126984126984 * (x * (x * (x * (x * x))))), 0.16666666666666666), 1.0);
}
function code(x) return Float64(x * fma(Float64(x * x), fma(x, Float64(0.0001984126984126984 * Float64(x * Float64(x * Float64(x * Float64(x * x))))), 0.16666666666666666), 1.0)) end
code[x_] := N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(0.0001984126984126984 * N[(x * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.0001984126984126984 \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right), 0.16666666666666666\right), 1\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6492.6
Simplified92.6%
Taylor expanded in x around inf
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6494.2
Simplified94.2%
Final simplification94.2%
(FPCore (x)
:precision binary64
(*
x
(fma
(* x x)
(fma
x
(* x (fma 0.0001984126984126984 (* x (* x x)) 0.008333333333333333))
0.16666666666666666)
1.0)))
double code(double x) {
return x * fma((x * x), fma(x, (x * fma(0.0001984126984126984, (x * (x * x)), 0.008333333333333333)), 0.16666666666666666), 1.0);
}
function code(x) return Float64(x * fma(Float64(x * x), fma(x, Float64(x * fma(0.0001984126984126984, Float64(x * Float64(x * x)), 0.008333333333333333)), 0.16666666666666666), 1.0)) end
code[x_] := N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(0.0001984126984126984 * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(0.0001984126984126984, x \cdot \left(x \cdot x\right), 0.008333333333333333\right), 0.16666666666666666\right), 1\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6492.6
Simplified92.6%
Taylor expanded in x around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.4
Simplified72.4%
(FPCore (x) :precision binary64 (* x (fma (* x x) (fma x (* 0.0001984126984126984 (* x (* x (* x x)))) 0.16666666666666666) 1.0)))
double code(double x) {
return x * fma((x * x), fma(x, (0.0001984126984126984 * (x * (x * (x * x)))), 0.16666666666666666), 1.0);
}
function code(x) return Float64(x * fma(Float64(x * x), fma(x, Float64(0.0001984126984126984 * Float64(x * Float64(x * Float64(x * x)))), 0.16666666666666666), 1.0)) end
code[x_] := N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(0.0001984126984126984 * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.0001984126984126984 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right), 0.16666666666666666\right), 1\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6492.6
Simplified92.6%
Taylor expanded in x around inf
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6494.2
Simplified94.2%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6472.3
Simplified72.3%
Final simplification72.3%
(FPCore (x)
:precision binary64
(*
x
(fma
(* x x)
(fma
x
(* x (fma x (* x 0.0001984126984126984) 0.008333333333333333))
0.16666666666666666)
1.0)))
double code(double x) {
return x * fma((x * x), fma(x, (x * fma(x, (x * 0.0001984126984126984), 0.008333333333333333)), 0.16666666666666666), 1.0);
}
function code(x) return Float64(x * fma(Float64(x * x), fma(x, Float64(x * fma(x, Float64(x * 0.0001984126984126984), 0.008333333333333333)), 0.16666666666666666), 1.0)) end
code[x_] := N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(x * N[(x * 0.0001984126984126984), $MachinePrecision] + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, x \cdot 0.0001984126984126984, 0.008333333333333333\right), 0.16666666666666666\right), 1\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6492.6
Simplified92.6%
(FPCore (x) :precision binary64 (fma (* x x) (* x (fma x (* (* x (* x x)) 0.008333333333333333) 0.16666666666666666)) x))
double code(double x) {
return fma((x * x), (x * fma(x, ((x * (x * x)) * 0.008333333333333333), 0.16666666666666666)), x);
}
function code(x) return fma(Float64(x * x), Float64(x * fma(x, Float64(Float64(x * Float64(x * x)) * 0.008333333333333333), 0.16666666666666666)), x) end
code[x_] := N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x \cdot x, x \cdot \mathsf{fma}\left(x, \left(x \cdot \left(x \cdot x\right)\right) \cdot 0.008333333333333333, 0.16666666666666666\right), x\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6489.5
Simplified89.5%
Taylor expanded in x around inf
distribute-rgt-inN/A
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.4
Simplified92.4%
Final simplification92.4%
(FPCore (x) :precision binary64 (fma (* x x) (* x (* x (* (* x (* x x)) 0.008333333333333333))) x))
double code(double x) {
return fma((x * x), (x * (x * ((x * (x * x)) * 0.008333333333333333))), x);
}
function code(x) return fma(Float64(x * x), Float64(x * Float64(x * Float64(Float64(x * Float64(x * x)) * 0.008333333333333333))), x) end
code[x_] := N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x \cdot x, x \cdot \left(x \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 0.008333333333333333\right)\right), x\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6489.5
Simplified89.5%
Taylor expanded in x around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.0
Simplified92.0%
Final simplification92.0%
(FPCore (x) :precision binary64 (* x (fma (* x x) (fma x (* x x) 0.16666666666666666) 1.0)))
double code(double x) {
return x * fma((x * x), fma(x, (x * x), 0.16666666666666666), 1.0);
}
function code(x) return Float64(x * fma(Float64(x * x), fma(x, Float64(x * x), 0.16666666666666666), 1.0)) end
code[x_] := N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * x), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot x, 0.16666666666666666\right), 1\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6492.6
Simplified92.6%
Taylor expanded in x around inf
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6494.2
Simplified94.2%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6471.2
Simplified71.2%
(FPCore (x) :precision binary64 (fma (* x x) (* x (* x (* x x))) x))
double code(double x) {
return fma((x * x), (x * (x * (x * x))), x);
}
function code(x) return fma(Float64(x * x), Float64(x * Float64(x * Float64(x * x))), x) end
code[x_] := N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x \cdot x, x \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6489.5
Simplified89.5%
Taylor expanded in x around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.0
Simplified92.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6470.8
Simplified70.8%
(FPCore (x) :precision binary64 (fma (* x x) (* x (* x x)) x))
double code(double x) {
return fma((x * x), (x * (x * x)), x);
}
function code(x) return fma(Float64(x * x), Float64(x * Float64(x * x)), x) end
code[x_] := N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x \cdot x, x \cdot \left(x \cdot x\right), x\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6489.5
Simplified89.5%
Taylor expanded in x around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.0
Simplified92.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6489.1
Simplified89.1%
(FPCore (x) :precision binary64 (fma (* x x) (* x x) x))
double code(double x) {
return fma((x * x), (x * x), x);
}
function code(x) return fma(Float64(x * x), Float64(x * x), x) end
code[x_] := N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x \cdot x, x \cdot x, x\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6489.5
Simplified89.5%
Taylor expanded in x around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.0
Simplified92.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6469.0
Simplified69.0%
(FPCore (x) :precision binary64 (fma x (* (* x x) 0.16666666666666666) x))
double code(double x) {
return fma(x, ((x * x) * 0.16666666666666666), x);
}
function code(x) return fma(x, Float64(Float64(x * x) * 0.16666666666666666), x) end
code[x_] := N[(x * N[(N[(x * x), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \left(x \cdot x\right) \cdot 0.16666666666666666, x\right)
\end{array}
Initial program 53.9%
sinh-defN/A
lower-sinh.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6485.0
Simplified85.0%
Final simplification85.0%
(FPCore (x) :precision binary64 (fma x (* x x) x))
double code(double x) {
return fma(x, (x * x), x);
}
function code(x) return fma(x, Float64(x * x), x) end
code[x_] := N[(x * N[(x * x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, x \cdot x, x\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6489.5
Simplified89.5%
Taylor expanded in x around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.0
Simplified92.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6469.0
Simplified69.0%
Taylor expanded in x around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
distribute-lft-inN/A
*-rgt-identityN/A
rgt-mult-inverseN/A
distribute-lft-outN/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.9
Simplified84.9%
(FPCore (x) :precision binary64 (fma x x x))
double code(double x) {
return fma(x, x, x);
}
function code(x) return fma(x, x, x) end
code[x_] := N[(x * x + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, x, x\right)
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6489.5
Simplified89.5%
Taylor expanded in x around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.0
Simplified92.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6469.0
Simplified69.0%
Taylor expanded in x around -inf
unpow2N/A
associate-*l*N/A
distribute-lft-inN/A
*-rgt-identityN/A
rgt-mult-inverseN/A
distribute-lft-outN/A
*-rgt-identityN/A
lower-fma.f6464.0
Simplified64.0%
(FPCore (x) :precision binary64 x)
double code(double x) {
return x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = x
end function
public static double code(double x) {
return x;
}
def code(x): return x
function code(x) return x end
function tmp = code(x) tmp = x; end
code[x_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 53.9%
Taylor expanded in x around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6492.6
Simplified92.6%
Taylor expanded in x around 0
Simplified53.0%
*-rgt-identity53.0
Applied egg-rr53.0%
herbie shell --seed 2024214
(FPCore (x)
:name "Hyperbolic sine"
:precision binary64
(/ (- (exp x) (exp (- x))) 2.0))