
(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) z) y) x))
double code(double x, double y, double z) {
return ((cosh(x) / z) * y) / x;
}
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) / z) * y) / x
end function
public static double code(double x, double y, double z) {
return ((Math.cosh(x) / z) * y) / x;
}
def code(x, y, z): return ((math.cosh(x) / z) * y) / x
function code(x, y, z) return Float64(Float64(Float64(cosh(x) / z) * y) / x) end
function tmp = code(x, y, z) tmp = ((cosh(x) / z) * y) / x; end
code[x_, y_, z_] := N[(N[(N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\cosh x}{z} \cdot y}{x}
\end{array}
Initial program 81.5%
associate-*l/81.5%
Simplified81.5%
associate-*r/98.3%
Applied egg-rr98.3%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (* (/ (cosh x) x) (/ y z)))
double code(double x, double y, double z) {
return (cosh(x) / x) * (y / 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) / x) * (y / z)
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) / x) * (y / z);
}
def code(x, y, z): return (math.cosh(x) / x) * (y / z)
function code(x, y, z) return Float64(Float64(cosh(x) / x) * Float64(y / z)) end
function tmp = code(x, y, z) tmp = (cosh(x) / x) * (y / z); end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x}{x} \cdot \frac{y}{z}
\end{array}
Initial program 81.5%
associate-*l/81.5%
Simplified81.5%
expm1-log1p-u46.1%
expm1-udef38.6%
associate-*l/38.6%
div-inv38.6%
associate-*l*36.7%
div-inv36.7%
Applied egg-rr36.7%
expm1-def44.2%
expm1-log1p77.6%
associate-/r*79.2%
associate-*r/83.5%
times-frac92.5%
Simplified92.5%
Final simplification92.5%
(FPCore (x y z) :precision binary64 (if (<= y 2e-39) (/ (- (- y) (* y (* x (* x 0.5)))) (* z (- x))) (/ (+ -1.0 (/ (* -0.5 (* y (* x x))) y)) (* (/ z y) (- x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e-39) {
tmp = (-y - (y * (x * (x * 0.5)))) / (z * -x);
} else {
tmp = (-1.0 + ((-0.5 * (y * (x * x))) / y)) / ((z / y) * -x);
}
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 (y <= 2d-39) then
tmp = (-y - (y * (x * (x * 0.5d0)))) / (z * -x)
else
tmp = ((-1.0d0) + (((-0.5d0) * (y * (x * x))) / y)) / ((z / y) * -x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e-39) {
tmp = (-y - (y * (x * (x * 0.5)))) / (z * -x);
} else {
tmp = (-1.0 + ((-0.5 * (y * (x * x))) / y)) / ((z / y) * -x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e-39: tmp = (-y - (y * (x * (x * 0.5)))) / (z * -x) else: tmp = (-1.0 + ((-0.5 * (y * (x * x))) / y)) / ((z / y) * -x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e-39) tmp = Float64(Float64(Float64(-y) - Float64(y * Float64(x * Float64(x * 0.5)))) / Float64(z * Float64(-x))); else tmp = Float64(Float64(-1.0 + Float64(Float64(-0.5 * Float64(y * Float64(x * x))) / y)) / Float64(Float64(z / y) * Float64(-x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e-39) tmp = (-y - (y * (x * (x * 0.5)))) / (z * -x); else tmp = (-1.0 + ((-0.5 * (y * (x * x))) / y)) / ((z / y) * -x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e-39], N[(N[((-y) - N[(y * N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * (-x)), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 + N[(N[(-0.5 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / N[(N[(z / y), $MachinePrecision] * (-x)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-39}:\\
\;\;\;\;\frac{\left(-y\right) - y \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)}{z \cdot \left(-x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 + \frac{-0.5 \cdot \left(y \cdot \left(x \cdot x\right)\right)}{y}}{\frac{z}{y} \cdot \left(-x\right)}\\
\end{array}
\end{array}
if y < 1.99999999999999986e-39Initial program 79.6%
associate-*l/79.6%
Simplified79.6%
Taylor expanded in x around 0 62.2%
associate-/r*61.7%
*-un-lft-identity61.7%
associate-*l/61.7%
associate-*r/64.8%
div-inv64.8%
associate-*l/64.8%
*-un-lft-identity64.8%
Applied egg-rr64.8%
un-div-inv64.8%
Applied egg-rr64.8%
+-commutative64.8%
frac-2neg64.8%
associate-*r/64.8%
frac-add59.7%
distribute-neg-frac59.7%
*-commutative59.7%
Applied egg-rr59.7%
associate-*l/53.0%
associate-/l*61.3%
*-rgt-identity61.3%
associate-*r/61.3%
rgt-mult-inverse61.3%
distribute-neg-frac61.3%
/-rgt-identity61.3%
distribute-lft-neg-out61.3%
sub-neg61.3%
associate-*r*61.3%
*-commutative61.3%
associate-*r*66.4%
distribute-lft-neg-out66.4%
distribute-rgt-neg-out66.4%
Simplified66.4%
if 1.99999999999999986e-39 < y Initial program 86.4%
associate-*l/86.4%
Simplified86.4%
Taylor expanded in x around 0 76.6%
associate-/r*64.6%
*-un-lft-identity64.6%
associate-*l/64.6%
associate-*r/76.6%
div-inv76.5%
associate-*l/76.5%
*-un-lft-identity76.5%
Applied egg-rr76.5%
un-div-inv76.6%
Applied egg-rr76.6%
associate-*r/76.6%
associate-/l/76.6%
clear-num76.6%
associate-*l/66.3%
associate-/l/66.3%
frac-2neg66.3%
frac-add67.5%
*-commutative67.5%
distribute-neg-frac67.5%
distribute-neg-frac67.5%
metadata-eval67.5%
distribute-neg-frac67.5%
Applied egg-rr67.5%
+-commutative67.5%
*-commutative67.5%
associate-*l/67.5%
neg-mul-167.5%
distribute-frac-neg67.5%
*-rgt-identity67.5%
associate-*r/67.5%
rgt-mult-inverse67.5%
metadata-eval67.5%
associate-*r/73.0%
distribute-rgt-neg-out73.0%
associate-*l*73.0%
distribute-lft-neg-in73.0%
metadata-eval73.0%
associate-*l*73.0%
associate-*r/76.1%
associate-*l/83.2%
Simplified83.2%
Final simplification71.0%
(FPCore (x y z)
:precision binary64
(if (<= x 6.2e-58)
(/ (/ y z) x)
(if (<= x 2.6e+187)
(/ (* y (+ (* x 0.5) (/ 1.0 x))) z)
(* y (* x (/ 0.5 z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 6.2e-58) {
tmp = (y / z) / x;
} else if (x <= 2.6e+187) {
tmp = (y * ((x * 0.5) + (1.0 / 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 <= 6.2d-58) then
tmp = (y / z) / x
else if (x <= 2.6d+187) then
tmp = (y * ((x * 0.5d0) + (1.0d0 / 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 <= 6.2e-58) {
tmp = (y / z) / x;
} else if (x <= 2.6e+187) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z;
} else {
tmp = y * (x * (0.5 / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 6.2e-58: tmp = (y / z) / x elif x <= 2.6e+187: tmp = (y * ((x * 0.5) + (1.0 / x))) / z else: tmp = y * (x * (0.5 / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 6.2e-58) tmp = Float64(Float64(y / z) / x); elseif (x <= 2.6e+187) tmp = Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z); else tmp = Float64(y * Float64(x * Float64(0.5 / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 6.2e-58) tmp = (y / z) / x; elseif (x <= 2.6e+187) tmp = (y * ((x * 0.5) + (1.0 / x))) / z; else tmp = y * (x * (0.5 / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 6.2e-58], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 2.6e+187], N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(x * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.2 \cdot 10^{-58}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+187}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{0.5}{z}\right)\\
\end{array}
\end{array}
if x < 6.1999999999999998e-58Initial program 80.4%
associate-*l/80.4%
Simplified80.4%
associate-*r/97.6%
Applied egg-rr97.6%
Taylor expanded in x around 0 67.4%
if 6.1999999999999998e-58 < x < 2.5999999999999999e187Initial program 92.7%
Taylor expanded in x around 0 46.2%
Taylor expanded in y around 0 46.3%
if 2.5999999999999999e187 < x Initial program 64.0%
associate-*l/64.0%
Simplified64.0%
Taylor expanded in x around 0 54.3%
Taylor expanded in x around inf 54.3%
associate-*r/54.3%
associate-*r*54.3%
*-commutative54.3%
associate-*r/65.3%
associate-/l*65.3%
Simplified65.3%
associate-/r/65.3%
Applied egg-rr65.3%
Final simplification62.6%
(FPCore (x y z) :precision binary64 (if (<= y 4e+158) (/ (- (- y) (* y (* x (* x 0.5)))) (* z (- x))) (+ (* 0.5 (/ (* x y) z)) (/ y (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 4e+158) {
tmp = (-y - (y * (x * (x * 0.5)))) / (z * -x);
} else {
tmp = (0.5 * ((x * y) / z)) + (y / (x * 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 (y <= 4d+158) then
tmp = (-y - (y * (x * (x * 0.5d0)))) / (z * -x)
else
tmp = (0.5d0 * ((x * y) / z)) + (y / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4e+158) {
tmp = (-y - (y * (x * (x * 0.5)))) / (z * -x);
} else {
tmp = (0.5 * ((x * y) / z)) + (y / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4e+158: tmp = (-y - (y * (x * (x * 0.5)))) / (z * -x) else: tmp = (0.5 * ((x * y) / z)) + (y / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4e+158) tmp = Float64(Float64(Float64(-y) - Float64(y * Float64(x * Float64(x * 0.5)))) / Float64(z * Float64(-x))); else tmp = Float64(Float64(0.5 * Float64(Float64(x * y) / z)) + Float64(y / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4e+158) tmp = (-y - (y * (x * (x * 0.5)))) / (z * -x); else tmp = (0.5 * ((x * y) / z)) + (y / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4e+158], N[(N[((-y) - N[(y * N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * (-x)), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{+158}:\\
\;\;\;\;\frac{\left(-y\right) - y \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)}{z \cdot \left(-x\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{z} + \frac{y}{x \cdot z}\\
\end{array}
\end{array}
if y < 3.99999999999999981e158Initial program 80.9%
associate-*l/80.9%
Simplified80.9%
Taylor expanded in x around 0 63.3%
associate-/r*61.2%
*-un-lft-identity61.2%
associate-*l/61.3%
associate-*r/65.4%
div-inv65.4%
associate-*l/65.5%
*-un-lft-identity65.5%
Applied egg-rr65.5%
un-div-inv65.5%
Applied egg-rr65.5%
+-commutative65.5%
frac-2neg65.5%
associate-*r/65.5%
frac-add62.4%
distribute-neg-frac62.4%
*-commutative62.4%
Applied egg-rr62.4%
associate-*l/57.2%
associate-/l*63.8%
*-rgt-identity63.8%
associate-*r/63.7%
rgt-mult-inverse63.8%
distribute-neg-frac63.8%
/-rgt-identity63.8%
distribute-lft-neg-out63.8%
sub-neg63.8%
associate-*r*63.8%
*-commutative63.8%
associate-*r*68.0%
distribute-lft-neg-out68.0%
distribute-rgt-neg-out68.0%
Simplified68.0%
if 3.99999999999999981e158 < y Initial program 85.3%
associate-*l/85.2%
Simplified85.2%
Taylor expanded in x around 0 86.0%
Final simplification70.2%
(FPCore (x y z) :precision binary64 (if (<= x 7e-151) (/ (/ y z) x) (* y (+ (* 0.5 (/ x z)) (/ 1.0 (* x z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 7e-151) {
tmp = (y / z) / x;
} else {
tmp = y * ((0.5 * (x / z)) + (1.0 / (x * 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 <= 7d-151) then
tmp = (y / z) / x
else
tmp = y * ((0.5d0 * (x / z)) + (1.0d0 / (x * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 7e-151) {
tmp = (y / z) / x;
} else {
tmp = y * ((0.5 * (x / z)) + (1.0 / (x * z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 7e-151: tmp = (y / z) / x else: tmp = y * ((0.5 * (x / z)) + (1.0 / (x * z))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 7e-151) tmp = Float64(Float64(y / z) / x); else tmp = Float64(y * Float64(Float64(0.5 * Float64(x / z)) + Float64(1.0 / Float64(x * z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 7e-151) tmp = (y / z) / x; else tmp = y * ((0.5 * (x / z)) + (1.0 / (x * z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 7e-151], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(y * N[(N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-151}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{z} + \frac{1}{x \cdot z}\right)\\
\end{array}
\end{array}
if x < 6.99999999999999991e-151Initial program 80.1%
associate-*l/80.1%
Simplified80.1%
associate-*r/97.9%
Applied egg-rr97.9%
Taylor expanded in x around 0 63.4%
if 6.99999999999999991e-151 < x Initial program 83.5%
associate-*l/83.5%
Simplified83.5%
Taylor expanded in x around 0 59.3%
Taylor expanded in y around 0 60.3%
Final simplification62.2%
(FPCore (x y z) :precision binary64 (if (<= z 2e-72) (* y (+ (* 0.5 (/ x z)) (/ 1.0 (* x z)))) (+ (* 0.5 (/ (* x y) z)) (/ y (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2e-72) {
tmp = y * ((0.5 * (x / z)) + (1.0 / (x * z)));
} else {
tmp = (0.5 * ((x * y) / z)) + (y / (x * 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 (z <= 2d-72) then
tmp = y * ((0.5d0 * (x / z)) + (1.0d0 / (x * z)))
else
tmp = (0.5d0 * ((x * y) / z)) + (y / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 2e-72) {
tmp = y * ((0.5 * (x / z)) + (1.0 / (x * z)));
} else {
tmp = (0.5 * ((x * y) / z)) + (y / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2e-72: tmp = y * ((0.5 * (x / z)) + (1.0 / (x * z))) else: tmp = (0.5 * ((x * y) / z)) + (y / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2e-72) tmp = Float64(y * Float64(Float64(0.5 * Float64(x / z)) + Float64(1.0 / Float64(x * z)))); else tmp = Float64(Float64(0.5 * Float64(Float64(x * y) / z)) + Float64(y / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 2e-72) tmp = y * ((0.5 * (x / z)) + (1.0 / (x * z))); else tmp = (0.5 * ((x * y) / z)) + (y / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2e-72], N[(y * N[(N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-72}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{z} + \frac{1}{x \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{z} + \frac{y}{x \cdot z}\\
\end{array}
\end{array}
if z < 1.9999999999999999e-72Initial program 81.4%
associate-*l/81.4%
Simplified81.4%
Taylor expanded in x around 0 68.8%
Taylor expanded in y around 0 72.8%
if 1.9999999999999999e-72 < z Initial program 81.6%
associate-*l/81.6%
Simplified81.6%
Taylor expanded in x around 0 61.2%
Final simplification68.8%
(FPCore (x y z) :precision binary64 (if (<= x 7.5e+187) (+ (* 0.5 (/ (* x y) z)) (/ (/ y z) x)) (* y (* x (/ 0.5 z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 7.5e+187) {
tmp = (0.5 * ((x * y) / z)) + ((y / z) / x);
} 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 <= 7.5d+187) then
tmp = (0.5d0 * ((x * y) / z)) + ((y / z) / x)
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 <= 7.5e+187) {
tmp = (0.5 * ((x * y) / z)) + ((y / z) / x);
} else {
tmp = y * (x * (0.5 / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 7.5e+187: tmp = (0.5 * ((x * y) / z)) + ((y / z) / x) else: tmp = y * (x * (0.5 / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 7.5e+187) tmp = Float64(Float64(0.5 * Float64(Float64(x * y) / z)) + Float64(Float64(y / z) / x)); else tmp = Float64(y * Float64(x * Float64(0.5 / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 7.5e+187) tmp = (0.5 * ((x * y) / z)) + ((y / z) / x); else tmp = y * (x * (0.5 / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 7.5e+187], N[(N[(0.5 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.5 \cdot 10^{+187}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{z} + \frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{0.5}{z}\right)\\
\end{array}
\end{array}
if x < 7.5000000000000002e187Initial program 83.4%
associate-*l/83.4%
Simplified83.4%
Taylor expanded in x around 0 67.4%
associate-/r*63.4%
*-un-lft-identity63.4%
associate-*l/63.4%
associate-*r/69.5%
div-inv69.5%
associate-*l/69.5%
*-un-lft-identity69.5%
Applied egg-rr69.5%
un-div-inv69.6%
Applied egg-rr69.6%
if 7.5000000000000002e187 < x Initial program 64.0%
associate-*l/64.0%
Simplified64.0%
Taylor expanded in x around 0 54.3%
Taylor expanded in x around inf 54.3%
associate-*r/54.3%
associate-*r*54.3%
*-commutative54.3%
associate-*r/65.3%
associate-/l*65.3%
Simplified65.3%
associate-/r/65.3%
Applied egg-rr65.3%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ (/ y z) x) (* 0.5 (/ x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / z) / x;
} else {
tmp = 0.5 * (x / (z / y));
}
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 <= 1.4d0) then
tmp = (y / z) / x
else
tmp = 0.5d0 * (x / (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / z) / x;
} else {
tmp = 0.5 * (x / (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = (y / z) / x else: tmp = 0.5 * (x / (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y / z) / x); else tmp = Float64(0.5 * Float64(x / Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = (y / z) / x; else tmp = 0.5 * (x / (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(0.5 * N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 81.7%
associate-*l/81.7%
Simplified81.7%
associate-*r/97.7%
Applied egg-rr97.7%
Taylor expanded in x around 0 69.1%
if 1.3999999999999999 < x Initial program 80.9%
associate-*l/80.9%
Simplified80.9%
Taylor expanded in x around 0 39.0%
Taylor expanded in x around inf 39.0%
associate-/l*34.8%
Simplified34.8%
Final simplification60.0%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ (/ y z) x) (* 0.5 (/ (* x y) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / z) / x;
} else {
tmp = 0.5 * ((x * y) / 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 <= 1.4d0) then
tmp = (y / z) / x
else
tmp = 0.5d0 * ((x * y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / z) / x;
} else {
tmp = 0.5 * ((x * y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = (y / z) / x else: tmp = 0.5 * ((x * y) / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y / z) / x); else tmp = Float64(0.5 * Float64(Float64(x * y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = (y / z) / x; else tmp = 0.5 * ((x * y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(0.5 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{z}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 81.7%
associate-*l/81.7%
Simplified81.7%
associate-*r/97.7%
Applied egg-rr97.7%
Taylor expanded in x around 0 69.1%
if 1.3999999999999999 < x Initial program 80.9%
associate-*l/80.9%
Simplified80.9%
Taylor expanded in x around 0 39.0%
Taylor expanded in x around inf 39.0%
Final simplification61.1%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ (/ y z) x) (* y (* x (/ 0.5 z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y / z) / x;
} 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 <= 1.4d0) then
tmp = (y / z) / x
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 <= 1.4) {
tmp = (y / z) / x;
} else {
tmp = y * (x * (0.5 / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = (y / z) / x else: tmp = y * (x * (0.5 / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y / z) / x); else tmp = Float64(y * Float64(x * Float64(0.5 / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = (y / z) / x; else tmp = y * (x * (0.5 / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(y * N[(x * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{0.5}{z}\right)\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 81.7%
associate-*l/81.7%
Simplified81.7%
associate-*r/97.7%
Applied egg-rr97.7%
Taylor expanded in x around 0 69.1%
if 1.3999999999999999 < x Initial program 80.9%
associate-*l/80.9%
Simplified80.9%
Taylor expanded in x around 0 39.0%
Taylor expanded in x around inf 39.0%
associate-*r/39.0%
associate-*r*39.0%
*-commutative39.0%
associate-*r/41.7%
associate-/l*41.7%
Simplified41.7%
associate-/r/41.7%
Applied egg-rr41.7%
Final simplification61.8%
(FPCore (x y z) :precision binary64 (if (<= z 5e-20) (/ (/ y x) z) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 5e-20) {
tmp = (y / x) / z;
} else {
tmp = y / (x * 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 (z <= 5d-20) then
tmp = (y / x) / z
else
tmp = y / (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 5e-20) {
tmp = (y / x) / z;
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 5e-20: tmp = (y / x) / z else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 5e-20) tmp = Float64(Float64(y / x) / z); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 5e-20) tmp = (y / x) / z; else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 5e-20], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if z < 4.9999999999999999e-20Initial program 82.8%
Taylor expanded in x around 0 50.9%
if 4.9999999999999999e-20 < z Initial program 78.1%
associate-*l/78.1%
Simplified78.1%
Taylor expanded in x around 0 43.6%
Final simplification48.9%
(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 81.5%
associate-*l/81.5%
Simplified81.5%
Taylor expanded in x around 0 49.2%
Final simplification49.2%
(FPCore (x y z) :precision binary64 (/ (/ y z) x))
double code(double x, double y, double z) {
return (y / z) / x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y / z) / x
end function
public static double code(double x, double y, double z) {
return (y / z) / x;
}
def code(x, y, z): return (y / z) / x
function code(x, y, z) return Float64(Float64(y / z) / x) end
function tmp = code(x, y, z) tmp = (y / z) / x; end
code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{z}}{x}
\end{array}
Initial program 81.5%
associate-*l/81.5%
Simplified81.5%
associate-*r/98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 56.0%
Final simplification56.0%
(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 2024041
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))