
(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 12 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 (/ (* y (/ (cosh x) z)) x))
double code(double x, double y, double z) {
return (y * (cosh(x) / 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 * (cosh(x) / z)) / x
end function
public static double code(double x, double y, double z) {
return (y * (Math.cosh(x) / z)) / x;
}
def code(x, y, z): return (y * (math.cosh(x) / z)) / x
function code(x, y, z) return Float64(Float64(y * Float64(cosh(x) / z)) / x) end
function tmp = code(x, y, z) tmp = (y * (cosh(x) / z)) / x; end
code[x_, y_, z_] := N[(N[(y * N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y \cdot \frac{\cosh x}{z}}{x}
\end{array}
Initial program 87.5%
associate-*r/80.1%
associate-/r*76.7%
Simplified76.7%
associate-*r/81.0%
*-commutative81.0%
frac-times87.5%
associate-*l/98.7%
Applied egg-rr98.7%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.15e-157) (not (<= z 2.4e-246))) (* (cosh x) (/ y (* x z))) (+ (* 0.5 (/ y (/ z x))) (/ (/ y x) z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e-157) || !(z <= 2.4e-246)) {
tmp = cosh(x) * (y / (x * z));
} else {
tmp = (0.5 * (y / (z / x))) + ((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 <= (-1.15d-157)) .or. (.not. (z <= 2.4d-246))) then
tmp = cosh(x) * (y / (x * z))
else
tmp = (0.5d0 * (y / (z / x))) + ((y / x) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e-157) || !(z <= 2.4e-246)) {
tmp = Math.cosh(x) * (y / (x * z));
} else {
tmp = (0.5 * (y / (z / x))) + ((y / x) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.15e-157) or not (z <= 2.4e-246): tmp = math.cosh(x) * (y / (x * z)) else: tmp = (0.5 * (y / (z / x))) + ((y / x) / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.15e-157) || !(z <= 2.4e-246)) tmp = Float64(cosh(x) * Float64(y / Float64(x * z))); else tmp = Float64(Float64(0.5 * Float64(y / Float64(z / x))) + Float64(Float64(y / x) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.15e-157) || ~((z <= 2.4e-246))) tmp = cosh(x) * (y / (x * z)); else tmp = (0.5 * (y / (z / x))) + ((y / x) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.15e-157], N[Not[LessEqual[z, 2.4e-246]], $MachinePrecision]], N[(N[Cosh[x], $MachinePrecision] * N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-157} \lor \neg \left(z \leq 2.4 \cdot 10^{-246}\right):\\
\;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{z}{x}} + \frac{\frac{y}{x}}{z}\\
\end{array}
\end{array}
if z < -1.14999999999999994e-157 or 2.3999999999999998e-246 < z Initial program 88.5%
associate-*r/79.4%
associate-/r*76.4%
Simplified76.4%
if -1.14999999999999994e-157 < z < 2.3999999999999998e-246Initial program 83.1%
associate-*r/83.1%
associate-/r*78.2%
Simplified78.2%
Taylor expanded in x around 0 60.8%
associate-/l/80.3%
+-commutative80.3%
associate-/l*99.8%
Simplified99.8%
Final simplification80.7%
(FPCore (x y z) :precision binary64 (if (<= z -1.3e+106) (* (/ (cosh x) z) (/ y x)) (* (/ (cosh x) x) (/ y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e+106) {
tmp = (cosh(x) / z) * (y / x);
} else {
tmp = (cosh(x) / 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 (z <= (-1.3d+106)) then
tmp = (cosh(x) / z) * (y / x)
else
tmp = (cosh(x) / x) * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e+106) {
tmp = (Math.cosh(x) / z) * (y / x);
} else {
tmp = (Math.cosh(x) / x) * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.3e+106: tmp = (math.cosh(x) / z) * (y / x) else: tmp = (math.cosh(x) / x) * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.3e+106) tmp = Float64(Float64(cosh(x) / z) * Float64(y / x)); else tmp = Float64(Float64(cosh(x) / x) * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.3e+106) tmp = (cosh(x) / z) * (y / x); else tmp = (cosh(x) / x) * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.3e+106], N[(N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+106}:\\
\;\;\;\;\frac{\cosh x}{z} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x} \cdot \frac{y}{z}\\
\end{array}
\end{array}
if z < -1.3000000000000001e106Initial program 84.3%
associate-*l/84.4%
Simplified84.4%
if -1.3000000000000001e106 < z Initial program 88.1%
associate-/l*82.5%
Simplified82.5%
associate-/l*88.1%
associate-*r/98.2%
associate-/r*85.0%
times-frac95.8%
Applied egg-rr95.8%
Final simplification94.1%
(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 87.5%
associate-/l*79.6%
Simplified79.6%
associate-/l*87.5%
associate-*r/98.1%
associate-/r*81.0%
times-frac92.1%
Applied egg-rr92.1%
Final simplification92.1%
(FPCore (x y z) :precision binary64 (if (<= y 5e-17) (+ (* 0.5 (/ y (/ z x))) (/ (/ y x) z)) (/ (+ (/ y x) (* 0.5 (* y x))) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 5e-17) {
tmp = (0.5 * (y / (z / x))) + ((y / x) / z);
} else {
tmp = ((y / x) + (0.5 * (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 <= 5d-17) then
tmp = (0.5d0 * (y / (z / x))) + ((y / x) / z)
else
tmp = ((y / x) + (0.5d0 * (y * x))) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 5e-17) {
tmp = (0.5 * (y / (z / x))) + ((y / x) / z);
} else {
tmp = ((y / x) + (0.5 * (y * x))) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5e-17: tmp = (0.5 * (y / (z / x))) + ((y / x) / z) else: tmp = ((y / x) + (0.5 * (y * x))) / z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5e-17) tmp = Float64(Float64(0.5 * Float64(y / Float64(z / x))) + Float64(Float64(y / x) / z)); else tmp = Float64(Float64(Float64(y / x) + Float64(0.5 * Float64(y * x))) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5e-17) tmp = (0.5 * (y / (z / x))) + ((y / x) / z); else tmp = ((y / x) + (0.5 * (y * x))) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5e-17], N[(N[(0.5 * N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / x), $MachinePrecision] + N[(0.5 * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{-17}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{z}{x}} + \frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(y \cdot x\right)}{z}\\
\end{array}
\end{array}
if y < 4.9999999999999999e-17Initial program 85.0%
associate-*r/76.3%
associate-/r*74.6%
Simplified74.6%
Taylor expanded in x around 0 57.4%
associate-/l/62.3%
+-commutative62.3%
associate-/l*67.1%
Simplified67.1%
if 4.9999999999999999e-17 < y Initial program 95.4%
Taylor expanded in x around 0 71.8%
Final simplification68.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (/ y x) z)))
(if (<= y 2e-17)
(+ (* 0.5 (/ y (/ z x))) t_0)
(+ t_0 (/ 0.5 (/ z (* y x)))))))
double code(double x, double y, double z) {
double t_0 = (y / x) / z;
double tmp;
if (y <= 2e-17) {
tmp = (0.5 * (y / (z / x))) + t_0;
} else {
tmp = t_0 + (0.5 / (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) :: t_0
real(8) :: tmp
t_0 = (y / x) / z
if (y <= 2d-17) then
tmp = (0.5d0 * (y / (z / x))) + t_0
else
tmp = t_0 + (0.5d0 / (z / (y * x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y / x) / z;
double tmp;
if (y <= 2e-17) {
tmp = (0.5 * (y / (z / x))) + t_0;
} else {
tmp = t_0 + (0.5 / (z / (y * x)));
}
return tmp;
}
def code(x, y, z): t_0 = (y / x) / z tmp = 0 if y <= 2e-17: tmp = (0.5 * (y / (z / x))) + t_0 else: tmp = t_0 + (0.5 / (z / (y * x))) return tmp
function code(x, y, z) t_0 = Float64(Float64(y / x) / z) tmp = 0.0 if (y <= 2e-17) tmp = Float64(Float64(0.5 * Float64(y / Float64(z / x))) + t_0); else tmp = Float64(t_0 + Float64(0.5 / Float64(z / Float64(y * x)))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y / x) / z; tmp = 0.0; if (y <= 2e-17) tmp = (0.5 * (y / (z / x))) + t_0; else tmp = t_0 + (0.5 / (z / (y * x))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[y, 2e-17], N[(N[(0.5 * N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[(0.5 / N[(z / N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{x}}{z}\\
\mathbf{if}\;y \leq 2 \cdot 10^{-17}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{z}{x}} + t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 + \frac{0.5}{\frac{z}{y \cdot x}}\\
\end{array}
\end{array}
if y < 2.00000000000000014e-17Initial program 85.0%
associate-*r/76.2%
associate-/r*74.4%
Simplified74.4%
Taylor expanded in x around 0 57.2%
associate-/l/62.1%
+-commutative62.1%
associate-/l*66.9%
Simplified66.9%
if 2.00000000000000014e-17 < y Initial program 95.5%
associate-*r/92.3%
associate-/r*83.8%
Simplified83.8%
Taylor expanded in x around 0 76.7%
associate-/l/72.3%
+-commutative72.3%
associate-/l*64.8%
Simplified64.8%
clear-num64.8%
un-div-inv64.8%
associate-/l/72.3%
Applied egg-rr72.3%
Final simplification68.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4) (not (<= x 1.42))) (* 0.5 (* y (/ x z))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.42)) {
tmp = 0.5 * (y * (x / z));
} else {
tmp = (y / z) / 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 ((x <= (-1.4d0)) .or. (.not. (x <= 1.42d0))) then
tmp = 0.5d0 * (y * (x / z))
else
tmp = (y / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.42)) {
tmp = 0.5 * (y * (x / z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4) or not (x <= 1.42): tmp = 0.5 * (y * (x / z)) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4) || !(x <= 1.42)) tmp = Float64(0.5 * Float64(y * Float64(x / z))); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.4) || ~((x <= 1.42))) tmp = 0.5 * (y * (x / z)); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4], N[Not[LessEqual[x, 1.42]], $MachinePrecision]], N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \lor \neg \left(x \leq 1.42\right):\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -1.3999999999999999 or 1.4199999999999999 < x Initial program 81.4%
Taylor expanded in x around 0 40.8%
Taylor expanded in x around inf 40.8%
associate-*r/44.1%
Simplified44.1%
if -1.3999999999999999 < x < 1.4199999999999999Initial program 95.5%
associate-*r/95.6%
associate-/r*89.5%
Simplified89.5%
associate-*r/89.5%
*-commutative89.5%
frac-times95.4%
associate-*l/97.1%
Applied egg-rr97.1%
Taylor expanded in x around 0 96.9%
Final simplification67.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4) (not (<= x 1.42))) (* 0.5 (* y (/ x z))) (* (/ y z) (/ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.42)) {
tmp = 0.5 * (y * (x / z));
} else {
tmp = (y / z) * (1.0 / 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 ((x <= (-1.4d0)) .or. (.not. (x <= 1.42d0))) then
tmp = 0.5d0 * (y * (x / z))
else
tmp = (y / z) * (1.0d0 / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.42)) {
tmp = 0.5 * (y * (x / z));
} else {
tmp = (y / z) * (1.0 / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4) or not (x <= 1.42): tmp = 0.5 * (y * (x / z)) else: tmp = (y / z) * (1.0 / x) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4) || !(x <= 1.42)) tmp = Float64(0.5 * Float64(y * Float64(x / z))); else tmp = Float64(Float64(y / z) * Float64(1.0 / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.4) || ~((x <= 1.42))) tmp = 0.5 * (y * (x / z)); else tmp = (y / z) * (1.0 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4], N[Not[LessEqual[x, 1.42]], $MachinePrecision]], N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \lor \neg \left(x \leq 1.42\right):\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{1}{x}\\
\end{array}
\end{array}
if x < -1.3999999999999999 or 1.4199999999999999 < x Initial program 81.4%
Taylor expanded in x around 0 40.8%
Taylor expanded in x around inf 40.8%
associate-*r/44.1%
Simplified44.1%
if -1.3999999999999999 < x < 1.4199999999999999Initial program 95.5%
associate-*r/95.6%
associate-/r*89.5%
Simplified89.5%
Taylor expanded in x around 0 89.2%
associate-/r*96.9%
div-inv96.9%
Applied egg-rr96.9%
Final simplification67.0%
(FPCore (x y z) :precision binary64 (/ (+ (/ y x) (* 0.5 (* y x))) z))
double code(double x, double y, double z) {
return ((y / x) + (0.5 * (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) + (0.5d0 * (y * x))) / z
end function
public static double code(double x, double y, double z) {
return ((y / x) + (0.5 * (y * x))) / z;
}
def code(x, y, z): return ((y / x) + (0.5 * (y * x))) / z
function code(x, y, z) return Float64(Float64(Float64(y / x) + Float64(0.5 * Float64(y * x))) / z) end
function tmp = code(x, y, z) tmp = ((y / x) + (0.5 * (y * x))) / z; end
code[x_, y_, z_] := N[(N[(N[(y / x), $MachinePrecision] + N[(0.5 * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{x} + 0.5 \cdot \left(y \cdot x\right)}{z}
\end{array}
Initial program 87.5%
Taylor expanded in x around 0 64.5%
Final simplification64.5%
(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 87.5%
associate-*r/80.1%
associate-/r*76.7%
Simplified76.7%
Taylor expanded in x around 0 43.2%
Final simplification43.2%
(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(Float64(y / x) / z) end
function tmp = code(x, y, z) tmp = (y / x) / z; end
code[x_, y_, z_] := N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{x}}{z}
\end{array}
Initial program 87.5%
associate-*r/80.1%
associate-/r*76.7%
Simplified76.7%
Taylor expanded in x around 0 43.2%
associate-/l/45.9%
Simplified45.9%
Final simplification45.9%
(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 87.5%
associate-*r/80.1%
associate-/r*76.7%
Simplified76.7%
associate-*r/81.0%
*-commutative81.0%
frac-times87.5%
associate-*l/98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 52.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 2023274
(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))