
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
(FPCore (x y z) :precision binary64 (/ (/ (* (cosh x) y) x) z))
double code(double x, double y, double z) {
return ((cosh(x) * y) / x) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((cosh(x) * y) / x) / z
end function
public static double code(double x, double y, double z) {
return ((Math.cosh(x) * y) / x) / z;
}
def code(x, y, z): return ((math.cosh(x) * y) / x) / z
function code(x, y, z) return Float64(Float64(Float64(cosh(x) * y) / x) / z) end
function tmp = code(x, y, z) tmp = ((cosh(x) * y) / x) / z; end
code[x_, y_, z_] := N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\cosh x \cdot y}{x}}{z}
\end{array}
Initial program 89.8%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f6498.4
Applied egg-rr98.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cosh x) (/ y x))))
(if (<= t_0 INFINITY)
(/ t_0 z)
(* y (* (/ (* x (* x x)) z) 0.041666666666666664)))))
double code(double x, double y, double z) {
double t_0 = cosh(x) * (y / x);
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 / z;
} else {
tmp = y * (((x * (x * x)) / z) * 0.041666666666666664);
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = Math.cosh(x) * (y / x);
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 / z;
} else {
tmp = y * (((x * (x * x)) / z) * 0.041666666666666664);
}
return tmp;
}
def code(x, y, z): t_0 = math.cosh(x) * (y / x) tmp = 0 if t_0 <= math.inf: tmp = t_0 / z else: tmp = y * (((x * (x * x)) / z) * 0.041666666666666664) return tmp
function code(x, y, z) t_0 = Float64(cosh(x) * Float64(y / x)) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 / z); else tmp = Float64(y * Float64(Float64(Float64(x * Float64(x * x)) / z) * 0.041666666666666664)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = cosh(x) * (y / x); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 / z; else tmp = y * (((x * (x * x)) / z) * 0.041666666666666664); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 / z), $MachinePrecision], N[(y * N[(N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x \cdot \left(x \cdot x\right)}{z} \cdot 0.041666666666666664\right)\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < +inf.0Initial program 98.3%
if +inf.0 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 0.0%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f640.0
Simplified0.0%
Taylor expanded in x around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64100.0
Simplified100.0%
Taylor expanded in y around 0
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64100.0
Simplified100.0%
(FPCore (x y z)
:precision binary64
(if (<= (* (cosh x) (/ y x)) 1e+101)
(/ (/ y x) z)
(/
(/
(*
y
(fma
(fma x x 0.0)
(fma
x
(* x (fma (fma x x 0.0) 0.001388888888888889 0.041666666666666664))
0.5)
1.0))
z)
x)))
double code(double x, double y, double z) {
double tmp;
if ((cosh(x) * (y / x)) <= 1e+101) {
tmp = (y / x) / z;
} else {
tmp = ((y * fma(fma(x, x, 0.0), fma(x, (x * fma(fma(x, x, 0.0), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0)) / z) / x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(cosh(x) * Float64(y / x)) <= 1e+101) tmp = Float64(Float64(y / x) / z); else tmp = Float64(Float64(Float64(y * fma(fma(x, x, 0.0), fma(x, Float64(x * fma(fma(x, x, 0.0), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0)) / z) / x); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], 1e+101], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(y * N[(N[(x * x + 0.0), $MachinePrecision] * N[(x * N[(x * N[(N[(x * x + 0.0), $MachinePrecision] * 0.001388888888888889 + 0.041666666666666664), $MachinePrecision]), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq 10^{+101}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)}{z}}{x}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 9.9999999999999998e100Initial program 97.9%
Taylor expanded in x around 0
/-lowering-/.f6464.5
Simplified64.5%
if 9.9999999999999998e100 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 79.2%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f6499.1
Applied egg-rr99.1%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6489.6
Simplified89.6%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
Simplified69.0%
associate-*r/N/A
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
Applied egg-rr91.3%
(FPCore (x y z)
:precision binary64
(if (<= x 5.4e-14)
(/ (/ y x) z)
(if (<= x 2.8e+69)
(* y (/ (cosh x) (* x z)))
(/
(* y (/ (fma (* x x) (fma x (* x 0.041666666666666664) 0.5) 1.0) x))
z))))
double code(double x, double y, double z) {
double tmp;
if (x <= 5.4e-14) {
tmp = (y / x) / z;
} else if (x <= 2.8e+69) {
tmp = y * (cosh(x) / (x * z));
} else {
tmp = (y * (fma((x * x), fma(x, (x * 0.041666666666666664), 0.5), 1.0) / x)) / z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 5.4e-14) tmp = Float64(Float64(y / x) / z); elseif (x <= 2.8e+69) tmp = Float64(y * Float64(cosh(x) / Float64(x * z))); else tmp = Float64(Float64(y * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.041666666666666664), 0.5), 1.0) / x)) / z); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 5.4e-14], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[x, 2.8e+69], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.4 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+69}:\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.041666666666666664, 0.5\right), 1\right)}{x}}{z}\\
\end{array}
\end{array}
if x < 5.3999999999999997e-14Initial program 90.6%
Taylor expanded in x around 0
/-lowering-/.f6465.9
Simplified65.9%
if 5.3999999999999997e-14 < x < 2.79999999999999982e69Initial program 100.0%
associate-*r/N/A
associate-/l/N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
cosh-lowering-cosh.f64N/A
*-commutativeN/A
*-lowering-*.f6492.9
Applied egg-rr92.9%
if 2.79999999999999982e69 < x Initial program 82.1%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around 0
*-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
Simplified100.0%
(FPCore (x y z)
:precision binary64
(if (<= x 4.6e+42)
(/ (cosh x) (* z (/ x y)))
(/
(/
(*
y
(fma
(* x x)
(fma
(* x x)
(fma x (* x 0.001388888888888889) 0.041666666666666664)
0.5)
1.0))
x)
z)))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.6e+42) {
tmp = cosh(x) / (z * (x / y));
} else {
tmp = ((y * fma((x * x), fma((x * x), fma(x, (x * 0.001388888888888889), 0.041666666666666664), 0.5), 1.0)) / x) / z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 4.6e+42) tmp = Float64(cosh(x) / Float64(z * Float64(x / y))); else tmp = Float64(Float64(Float64(y * fma(Float64(x * x), fma(Float64(x * x), fma(x, Float64(x * 0.001388888888888889), 0.041666666666666664), 0.5), 1.0)) / x) / z); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 4.6e+42], N[(N[Cosh[x], $MachinePrecision] / N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.6 \cdot 10^{+42}:\\
\;\;\;\;\frac{\cosh x}{z \cdot \frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)}{x}}{z}\\
\end{array}
\end{array}
if x < 4.6e42Initial program 91.1%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
cosh-lowering-cosh.f64N/A
div-invN/A
clear-numN/A
*-lowering-*.f64N/A
/-lowering-/.f6485.6
Applied egg-rr85.6%
if 4.6e42 < x Initial program 83.3%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Final simplification87.9%
(FPCore (x y z)
:precision binary64
(/
(/
(*
y
(fma
(* x x)
(fma (* x x) (fma x (* x 0.001388888888888889) 0.041666666666666664) 0.5)
1.0))
x)
z))
double code(double x, double y, double z) {
return ((y * fma((x * x), fma((x * x), fma(x, (x * 0.001388888888888889), 0.041666666666666664), 0.5), 1.0)) / x) / z;
}
function code(x, y, z) return Float64(Float64(Float64(y * fma(Float64(x * x), fma(Float64(x * x), fma(x, Float64(x * 0.001388888888888889), 0.041666666666666664), 0.5), 1.0)) / x) / z) end
code[x_, y_, z_] := N[(N[(N[(y * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)}{x}}{z}
\end{array}
Initial program 89.8%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f6498.4
Applied egg-rr98.4%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6492.0
Simplified92.0%
Final simplification92.0%
(FPCore (x y z) :precision binary64 (/ (/ (fma (* x x) (* x (* x (* 0.001388888888888889 (* y (* x x))))) y) x) z))
double code(double x, double y, double z) {
return (fma((x * x), (x * (x * (0.001388888888888889 * (y * (x * x))))), y) / x) / z;
}
function code(x, y, z) return Float64(Float64(fma(Float64(x * x), Float64(x * Float64(x * Float64(0.001388888888888889 * Float64(y * Float64(x * x))))), y) / x) / z) end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(0.001388888888888889 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\mathsf{fma}\left(x \cdot x, x \cdot \left(x \cdot \left(0.001388888888888889 \cdot \left(y \cdot \left(x \cdot x\right)\right)\right)\right), y\right)}{x}}{z}
\end{array}
Initial program 89.8%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f6498.4
Applied egg-rr98.4%
Taylor expanded in x around 0
/-lowering-/.f64N/A
Simplified90.9%
Taylor expanded in x around inf
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6490.5
Simplified90.5%
Final simplification90.5%
(FPCore (x y z) :precision binary64 (/ (/ (* y (fma (* x x) (fma (* x x) 0.041666666666666664 0.5) 1.0)) x) z))
double code(double x, double y, double z) {
return ((y * fma((x * x), fma((x * x), 0.041666666666666664, 0.5), 1.0)) / x) / z;
}
function code(x, y, z) return Float64(Float64(Float64(y * fma(Float64(x * x), fma(Float64(x * x), 0.041666666666666664, 0.5), 1.0)) / x) / z) end
code[x_, y_, z_] := N[(N[(N[(y * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.041666666666666664 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.041666666666666664, 0.5\right), 1\right)}{x}}{z}
\end{array}
Initial program 89.8%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f6498.4
Applied egg-rr98.4%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6492.0
Simplified92.0%
Taylor expanded in x around 0
Simplified89.7%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (/ (* y (/ (fma (* x x) (fma x (* x 0.041666666666666664) 0.5) 1.0) x)) z))
double code(double x, double y, double z) {
return (y * (fma((x * x), fma(x, (x * 0.041666666666666664), 0.5), 1.0) / x)) / z;
}
function code(x, y, z) return Float64(Float64(y * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.041666666666666664), 0.5), 1.0) / x)) / z) end
code[x_, y_, z_] := N[(N[(y * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{y \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.041666666666666664, 0.5\right), 1\right)}{x}}{z}
\end{array}
Initial program 89.8%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f6498.4
Applied egg-rr98.4%
Taylor expanded in x around 0
*-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
Simplified89.7%
(FPCore (x y z) :precision binary64 (if (<= x 0.00028) (/ (/ y x) z) (/ (* y (* (* x (* x x)) 0.041666666666666664)) z)))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.00028) {
tmp = (y / x) / z;
} else {
tmp = (y * ((x * (x * x)) * 0.041666666666666664)) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 0.00028d0) then
tmp = (y / x) / z
else
tmp = (y * ((x * (x * x)) * 0.041666666666666664d0)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 0.00028) {
tmp = (y / x) / z;
} else {
tmp = (y * ((x * (x * x)) * 0.041666666666666664)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 0.00028: tmp = (y / x) / z else: tmp = (y * ((x * (x * x)) * 0.041666666666666664)) / z return tmp
function code(x, y, z) tmp = 0.0 if (x <= 0.00028) tmp = Float64(Float64(y / x) / z); else tmp = Float64(Float64(y * Float64(Float64(x * Float64(x * x)) * 0.041666666666666664)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 0.00028) tmp = (y / x) / z; else tmp = (y * ((x * (x * x)) * 0.041666666666666664)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 0.00028], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(y * N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00028:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 0.041666666666666664\right)}{z}\\
\end{array}
\end{array}
if x < 2.7999999999999998e-4Initial program 90.7%
Taylor expanded in x around 0
/-lowering-/.f6466.0
Simplified66.0%
if 2.7999999999999998e-4 < x Initial program 86.5%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6469.9
Simplified69.9%
Taylor expanded in x around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6479.6
Simplified79.6%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6479.6
Simplified79.6%
Final simplification68.8%
(FPCore (x y z) :precision binary64 (if (<= x 0.00028) (/ (/ y x) z) (* y (* (/ (* x (* x x)) z) 0.041666666666666664))))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.00028) {
tmp = (y / x) / z;
} else {
tmp = y * (((x * (x * x)) / z) * 0.041666666666666664);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 0.00028d0) then
tmp = (y / x) / z
else
tmp = y * (((x * (x * x)) / z) * 0.041666666666666664d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 0.00028) {
tmp = (y / x) / z;
} else {
tmp = y * (((x * (x * x)) / z) * 0.041666666666666664);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 0.00028: tmp = (y / x) / z else: tmp = y * (((x * (x * x)) / z) * 0.041666666666666664) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 0.00028) tmp = Float64(Float64(y / x) / z); else tmp = Float64(y * Float64(Float64(Float64(x * Float64(x * x)) / z) * 0.041666666666666664)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 0.00028) tmp = (y / x) / z; else tmp = y * (((x * (x * x)) / z) * 0.041666666666666664); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 0.00028], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00028:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x \cdot \left(x \cdot x\right)}{z} \cdot 0.041666666666666664\right)\\
\end{array}
\end{array}
if x < 2.7999999999999998e-4Initial program 90.7%
Taylor expanded in x around 0
/-lowering-/.f6466.0
Simplified66.0%
if 2.7999999999999998e-4 < x Initial program 86.5%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6469.9
Simplified69.9%
Taylor expanded in x around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6479.6
Simplified79.6%
Taylor expanded in y around 0
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6477.8
Simplified77.8%
(FPCore (x y z) :precision binary64 (if (<= x 0.00028) (/ (/ y x) z) (/ (* y (* x 0.5)) z)))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.00028) {
tmp = (y / x) / z;
} else {
tmp = (y * (x * 0.5)) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 0.00028d0) then
tmp = (y / x) / z
else
tmp = (y * (x * 0.5d0)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 0.00028) {
tmp = (y / x) / z;
} else {
tmp = (y * (x * 0.5)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 0.00028: tmp = (y / x) / z else: tmp = (y * (x * 0.5)) / z return tmp
function code(x, y, z) tmp = 0.0 if (x <= 0.00028) tmp = Float64(Float64(y / x) / z); else tmp = Float64(Float64(y * Float64(x * 0.5)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 0.00028) tmp = (y / x) / z; else tmp = (y * (x * 0.5)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 0.00028], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(y * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00028:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5\right)}{z}\\
\end{array}
\end{array}
if x < 2.7999999999999998e-4Initial program 90.7%
Taylor expanded in x around 0
/-lowering-/.f6466.0
Simplified66.0%
if 2.7999999999999998e-4 < x Initial program 86.5%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*l/N/A
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-/l*N/A
unpow2N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6457.6
Simplified57.6%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f6457.6
Simplified57.6%
(FPCore (x y z) :precision binary64 (if (<= x 0.00028) (/ y (* x z)) (/ (* y (* x 0.5)) z)))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.00028) {
tmp = y / (x * z);
} else {
tmp = (y * (x * 0.5)) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 0.00028d0) then
tmp = y / (x * z)
else
tmp = (y * (x * 0.5d0)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 0.00028) {
tmp = y / (x * z);
} else {
tmp = (y * (x * 0.5)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 0.00028: tmp = y / (x * z) else: tmp = (y * (x * 0.5)) / z return tmp
function code(x, y, z) tmp = 0.0 if (x <= 0.00028) tmp = Float64(y / Float64(x * z)); else tmp = Float64(Float64(y * Float64(x * 0.5)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 0.00028) tmp = y / (x * z); else tmp = (y * (x * 0.5)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 0.00028], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00028:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5\right)}{z}\\
\end{array}
\end{array}
if x < 2.7999999999999998e-4Initial program 90.7%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6463.2
Simplified63.2%
+-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f6463.2
Applied egg-rr63.2%
if 2.7999999999999998e-4 < x Initial program 86.5%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*l/N/A
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-/l*N/A
unpow2N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6457.6
Simplified57.6%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f6457.6
Simplified57.6%
Final simplification62.0%
(FPCore (x y z) :precision binary64 (/ y (* x z)))
double code(double x, double y, double z) {
return y / (x * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y / (x * z)
end function
public static double code(double x, double y, double z) {
return y / (x * z);
}
def code(x, y, z): return y / (x * z)
function code(x, y, z) return Float64(y / Float64(x * z)) end
function tmp = code(x, y, z) tmp = y / (x * z); end
code[x_, y_, z_] := N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{x \cdot z}
\end{array}
Initial program 89.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6452.1
Simplified52.1%
+-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f6452.1
Applied egg-rr52.1%
Final simplification52.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (/ y z) x) (cosh x))))
(if (< y -4.618902267687042e-52)
t_0
(if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((y / z) / x) * cosh(x)
if (y < (-4.618902267687042d-52)) then
tmp = t_0
else if (y < 1.038530535935153d-39) then
tmp = ((cosh(x) * y) / x) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * Math.cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((Math.cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y / z) / x) * math.cosh(x) tmp = 0 if y < -4.618902267687042e-52: tmp = t_0 elif y < 1.038530535935153e-39: tmp = ((math.cosh(x) * y) / x) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) / x) * cosh(x)) tmp = 0.0 if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = Float64(Float64(Float64(cosh(x) * y) / x) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y / z) / x) * cosh(x); tmp = 0.0; if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = ((cosh(x) * y) / x) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]}, If[Less[y, -4.618902267687042e-52], t$95$0, If[Less[y, 1.038530535935153e-39], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{z}}{x} \cdot \cosh x\\
\mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024198
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
:alt
(! :herbie-platform default (if (< y -2309451133843521/5000000000000000000000000000000000000000000000000000000000000000000) (* (/ (/ y z) x) (cosh x)) (if (< y 1038530535935153/1000000000000000000000000000000000000000000000000000000) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x)))))
(/ (* (cosh x) (/ y x)) z))