
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
double code(double x, double y, double z) {
return (x * (sin(y) / 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 = (x * (sin(y) / y)) / z
end function
public static double code(double x, double y, double z) {
return (x * (Math.sin(y) / y)) / z;
}
def code(x, y, z): return (x * (math.sin(y) / y)) / z
function code(x, y, z) return Float64(Float64(x * Float64(sin(y) / y)) / z) end
function tmp = code(x, y, z) tmp = (x * (sin(y) / y)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\sin y}{y}}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
double code(double x, double y, double z) {
return (x * (sin(y) / 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 = (x * (sin(y) / y)) / z
end function
public static double code(double x, double y, double z) {
return (x * (Math.sin(y) / y)) / z;
}
def code(x, y, z): return (x * (math.sin(y) / y)) / z
function code(x, y, z) return Float64(Float64(x * Float64(sin(y) / y)) / z) end
function tmp = code(x, y, z) tmp = (x * (sin(y) / y)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\sin y}{y}}{z}
\end{array}
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (* x (/ (sin y) y)) z))) (if (<= t_0 -1e-216) t_0 (/ x (* z (/ y (sin y)))))))
double code(double x, double y, double z) {
double t_0 = (x * (sin(y) / y)) / z;
double tmp;
if (t_0 <= -1e-216) {
tmp = t_0;
} else {
tmp = x / (z * (y / sin(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) :: t_0
real(8) :: tmp
t_0 = (x * (sin(y) / y)) / z
if (t_0 <= (-1d-216)) then
tmp = t_0
else
tmp = x / (z * (y / sin(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x * (Math.sin(y) / y)) / z;
double tmp;
if (t_0 <= -1e-216) {
tmp = t_0;
} else {
tmp = x / (z * (y / Math.sin(y)));
}
return tmp;
}
def code(x, y, z): t_0 = (x * (math.sin(y) / y)) / z tmp = 0 if t_0 <= -1e-216: tmp = t_0 else: tmp = x / (z * (y / math.sin(y))) return tmp
function code(x, y, z) t_0 = Float64(Float64(x * Float64(sin(y) / y)) / z) tmp = 0.0 if (t_0 <= -1e-216) tmp = t_0; else tmp = Float64(x / Float64(z * Float64(y / sin(y)))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x * (sin(y) / y)) / z; tmp = 0.0; if (t_0 <= -1e-216) tmp = t_0; else tmp = x / (z * (y / sin(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-216], t$95$0, N[(x / N[(z * N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \frac{\sin y}{y}}{z}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{-216}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (/.f64 (sin.f64 y) y)) z) < -1e-216Initial program 99.8%
if -1e-216 < (/.f64 (*.f64 x (/.f64 (sin.f64 y) y)) z) Initial program 96.3%
associate-/l*98.9%
Simplified98.9%
clear-num98.7%
associate-/r/98.8%
clear-num98.9%
Applied egg-rr98.9%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= y 2.15e-8) (/ x z) (* (sin y) (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.15e-8) {
tmp = x / z;
} else {
tmp = sin(y) * (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 (y <= 2.15d-8) then
tmp = x / z
else
tmp = sin(y) * (x / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.15e-8) {
tmp = x / z;
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.15e-8: tmp = x / z else: tmp = math.sin(y) * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.15e-8) tmp = Float64(x / z); else tmp = Float64(sin(y) * Float64(x / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.15e-8) tmp = x / z; else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.15e-8], N[(x / z), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.15 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 2.1500000000000001e-8Initial program 97.5%
associate-/l*98.3%
associate-/r/88.7%
associate-/l/82.6%
associate-/r/82.9%
associate-/r*81.6%
Simplified81.6%
Taylor expanded in y around 0 68.9%
if 2.1500000000000001e-8 < y Initial program 97.4%
associate-/l*94.4%
associate-/r/94.5%
associate-/l/97.7%
associate-/r/97.6%
associate-/r*94.4%
Simplified94.4%
Final simplification75.5%
(FPCore (x y z) :precision binary64 (if (<= y 9.2e+77) (* (/ (sin y) y) (/ x z)) (* (sin y) (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 9.2e+77) {
tmp = (sin(y) / y) * (x / z);
} else {
tmp = sin(y) * (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 (y <= 9.2d+77) then
tmp = (sin(y) / y) * (x / z)
else
tmp = sin(y) * (x / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 9.2e+77) {
tmp = (Math.sin(y) / y) * (x / z);
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 9.2e+77: tmp = (math.sin(y) / y) * (x / z) else: tmp = math.sin(y) * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 9.2e+77) tmp = Float64(Float64(sin(y) / y) * Float64(x / z)); else tmp = Float64(sin(y) * Float64(x / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 9.2e+77) tmp = (sin(y) / y) * (x / z); else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 9.2e+77], N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.2 \cdot 10^{+77}:\\
\;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 9.19999999999999979e77Initial program 97.5%
*-commutative97.5%
associate-*r/98.0%
Simplified98.0%
if 9.19999999999999979e77 < y Initial program 97.4%
associate-/l*96.3%
associate-/r/96.3%
associate-/l/97.5%
associate-/r/97.4%
associate-/r*96.4%
Simplified96.4%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (/ x (* z (/ y (sin y)))))
double code(double x, double y, double z) {
return x / (z * (y / sin(y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x / (z * (y / sin(y)))
end function
public static double code(double x, double y, double z) {
return x / (z * (y / Math.sin(y)));
}
def code(x, y, z): return x / (z * (y / math.sin(y)))
function code(x, y, z) return Float64(x / Float64(z * Float64(y / sin(y)))) end
function tmp = code(x, y, z) tmp = x / (z * (y / sin(y))); end
code[x_, y_, z_] := N[(x / N[(z * N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z \cdot \frac{y}{\sin y}}
\end{array}
Initial program 97.5%
associate-/l*97.3%
Simplified97.3%
clear-num97.2%
associate-/r/97.3%
clear-num97.3%
Applied egg-rr97.3%
Final simplification97.3%
(FPCore (x y z) :precision binary64 (if (<= y 7.3e+47) (* (/ x z) (+ 1.0 (* (* y y) -0.16666666666666666))) (/ 6.0 (* (* y y) (/ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 7.3e+47) {
tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = 6.0 / ((y * 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 (y <= 7.3d+47) then
tmp = (x / z) * (1.0d0 + ((y * y) * (-0.16666666666666666d0)))
else
tmp = 6.0d0 / ((y * y) * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 7.3e+47) {
tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = 6.0 / ((y * y) * (z / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 7.3e+47: tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666)) else: tmp = 6.0 / ((y * y) * (z / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 7.3e+47) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666))); else tmp = Float64(6.0 / Float64(Float64(y * y) * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 7.3e+47) tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666)); else tmp = 6.0 / ((y * y) * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 7.3e+47], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(N[(y * y), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.3 \cdot 10^{+47}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + \left(y \cdot y\right) \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{\left(y \cdot y\right) \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < 7.3000000000000001e47Initial program 97.4%
*-commutative97.4%
associate-*r/98.0%
Simplified98.0%
Taylor expanded in y around 0 64.9%
unpow264.9%
Simplified64.9%
if 7.3000000000000001e47 < y Initial program 97.7%
associate-/l*93.4%
Simplified93.4%
Taylor expanded in y around 0 33.5%
*-commutative33.5%
unpow233.5%
Simplified33.5%
Taylor expanded in y around inf 33.5%
unpow233.5%
associate-*r*33.6%
Simplified33.6%
clear-num33.6%
un-div-inv33.6%
Applied egg-rr33.6%
div-inv33.6%
associate-*r*33.5%
associate-*l*35.3%
div-inv35.3%
Applied egg-rr35.3%
Final simplification58.7%
(FPCore (x y z) :precision binary64 (if (<= y 17000.0) (/ x z) (/ 6.0 (* (* y y) (/ (- z) x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 17000.0) {
tmp = x / z;
} else {
tmp = 6.0 / ((y * 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 (y <= 17000.0d0) then
tmp = x / z
else
tmp = 6.0d0 / ((y * y) * (-z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 17000.0) {
tmp = x / z;
} else {
tmp = 6.0 / ((y * y) * (-z / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 17000.0: tmp = x / z else: tmp = 6.0 / ((y * y) * (-z / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 17000.0) tmp = Float64(x / z); else tmp = Float64(6.0 / Float64(Float64(y * y) * Float64(Float64(-z) / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 17000.0) tmp = x / z; else tmp = 6.0 / ((y * y) * (-z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 17000.0], N[(x / z), $MachinePrecision], N[(6.0 / N[(N[(y * y), $MachinePrecision] * N[((-z) / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 17000:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{\left(y \cdot y\right) \cdot \frac{-z}{x}}\\
\end{array}
\end{array}
if y < 17000Initial program 97.5%
associate-/l*98.3%
associate-/r/88.7%
associate-/l/82.6%
associate-/r/82.9%
associate-/r*81.6%
Simplified81.6%
Taylor expanded in y around 0 68.9%
if 17000 < y Initial program 97.4%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in y around 0 28.4%
*-commutative28.4%
unpow228.4%
Simplified28.4%
Taylor expanded in y around inf 28.4%
unpow228.4%
associate-*r*28.5%
Simplified28.5%
clear-num28.5%
un-div-inv28.5%
Applied egg-rr28.5%
add-sqr-sqrt14.0%
sqrt-unprod29.8%
sqr-neg29.8%
sqrt-unprod14.8%
add-sqr-sqrt28.6%
distribute-rgt-neg-in28.6%
distribute-rgt-neg-in28.6%
distribute-neg-frac28.6%
div-inv28.6%
associate-*r*28.6%
associate-*l*29.8%
div-inv29.8%
Applied egg-rr29.8%
Final simplification58.8%
(FPCore (x y z) :precision binary64 (if (<= y 6e+62) (/ x z) (* 6.0 (/ x (* y (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 6e+62) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (y * (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 (y <= 6d+62) then
tmp = x / z
else
tmp = 6.0d0 * (x / (y * (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 6e+62) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (y * (y * z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6e+62: tmp = x / z else: tmp = 6.0 * (x / (y * (y * z))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6e+62) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(x / Float64(y * Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 6e+62) tmp = x / z; else tmp = 6.0 * (x / (y * (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 6e+62], N[(x / z), $MachinePrecision], N[(6.0 * N[(x / N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{+62}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{x}{y \cdot \left(y \cdot z\right)}\\
\end{array}
\end{array}
if y < 6e62Initial program 97.5%
associate-/l*98.0%
associate-/r/89.2%
associate-/l/83.9%
associate-/r/84.2%
associate-/r*82.7%
Simplified82.7%
Taylor expanded in y around 0 64.3%
if 6e62 < y Initial program 97.5%
associate-/l*94.6%
Simplified94.6%
Taylor expanded in y around 0 35.1%
*-commutative35.1%
unpow235.1%
Simplified35.1%
Taylor expanded in y around inf 35.1%
unpow235.1%
associate-*r*35.2%
Simplified35.2%
Final simplification58.8%
(FPCore (x y z) :precision binary64 (if (<= y 6e+62) (/ x z) (* 6.0 (/ (/ x y) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 6e+62) {
tmp = x / z;
} else {
tmp = 6.0 * ((x / y) / (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 (y <= 6d+62) then
tmp = x / z
else
tmp = 6.0d0 * ((x / y) / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 6e+62) {
tmp = x / z;
} else {
tmp = 6.0 * ((x / y) / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6e+62: tmp = x / z else: tmp = 6.0 * ((x / y) / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6e+62) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(Float64(x / y) / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 6e+62) tmp = x / z; else tmp = 6.0 * ((x / y) / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 6e+62], N[(x / z), $MachinePrecision], N[(6.0 * N[(N[(x / y), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{+62}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{\frac{x}{y}}{y \cdot z}\\
\end{array}
\end{array}
if y < 6e62Initial program 97.5%
associate-/l*98.0%
associate-/r/89.2%
associate-/l/83.9%
associate-/r/84.2%
associate-/r*82.7%
Simplified82.7%
Taylor expanded in y around 0 64.3%
if 6e62 < y Initial program 97.5%
associate-/l*94.6%
Simplified94.6%
Taylor expanded in y around 0 35.1%
*-commutative35.1%
unpow235.1%
Simplified35.1%
Taylor expanded in y around inf 35.1%
unpow235.1%
associate-*r*35.2%
Simplified35.2%
Taylor expanded in x around 0 35.1%
unpow235.1%
associate-*r*35.2%
associate-/r*35.2%
*-commutative35.2%
Simplified35.2%
Final simplification58.8%
(FPCore (x y z) :precision binary64 (if (<= y 17000.0) (/ x z) (* -6.0 (/ x (* y (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 17000.0) {
tmp = x / z;
} else {
tmp = -6.0 * (x / (y * (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 (y <= 17000.0d0) then
tmp = x / z
else
tmp = (-6.0d0) * (x / (y * (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 17000.0) {
tmp = x / z;
} else {
tmp = -6.0 * (x / (y * (y * z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 17000.0: tmp = x / z else: tmp = -6.0 * (x / (y * (y * z))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 17000.0) tmp = Float64(x / z); else tmp = Float64(-6.0 * Float64(x / Float64(y * Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 17000.0) tmp = x / z; else tmp = -6.0 * (x / (y * (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 17000.0], N[(x / z), $MachinePrecision], N[(-6.0 * N[(x / N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 17000:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \frac{x}{y \cdot \left(y \cdot z\right)}\\
\end{array}
\end{array}
if y < 17000Initial program 97.5%
associate-/l*98.3%
associate-/r/88.7%
associate-/l/82.6%
associate-/r/82.9%
associate-/r*81.6%
Simplified81.6%
Taylor expanded in y around 0 68.9%
if 17000 < y Initial program 97.4%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in y around 0 28.4%
*-commutative28.4%
unpow228.4%
Simplified28.4%
Taylor expanded in y around inf 28.4%
unpow228.4%
associate-*r*28.5%
Simplified28.5%
clear-num28.5%
un-div-inv28.5%
Applied egg-rr28.5%
frac-2neg28.5%
div-inv28.5%
metadata-eval28.5%
distribute-neg-frac28.5%
distribute-rgt-neg-in28.5%
distribute-rgt-neg-in28.5%
add-sqr-sqrt14.5%
sqrt-unprod27.9%
sqr-neg27.9%
sqrt-unprod13.8%
add-sqr-sqrt28.6%
clear-num28.6%
*-commutative28.6%
*-commutative28.6%
associate-*l*28.6%
Applied egg-rr28.6%
*-commutative28.6%
associate-*r*28.6%
*-commutative28.6%
/-rgt-identity28.6%
associate-/l*28.6%
associate-*l/28.6%
associate-*r/28.6%
associate-/l*28.6%
/-rgt-identity28.6%
*-commutative28.6%
Simplified28.6%
Final simplification58.5%
(FPCore (x y z) :precision binary64 (if (<= y 17000.0) (/ x z) (* (/ x (* z (* y y))) -6.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= 17000.0) {
tmp = x / z;
} else {
tmp = (x / (z * (y * y))) * -6.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) :: tmp
if (y <= 17000.0d0) then
tmp = x / z
else
tmp = (x / (z * (y * y))) * (-6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 17000.0) {
tmp = x / z;
} else {
tmp = (x / (z * (y * y))) * -6.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 17000.0: tmp = x / z else: tmp = (x / (z * (y * y))) * -6.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= 17000.0) tmp = Float64(x / z); else tmp = Float64(Float64(x / Float64(z * Float64(y * y))) * -6.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 17000.0) tmp = x / z; else tmp = (x / (z * (y * y))) * -6.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 17000.0], N[(x / z), $MachinePrecision], N[(N[(x / N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -6.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 17000:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot \left(y \cdot y\right)} \cdot -6\\
\end{array}
\end{array}
if y < 17000Initial program 97.5%
associate-/l*98.3%
associate-/r/88.7%
associate-/l/82.6%
associate-/r/82.9%
associate-/r*81.6%
Simplified81.6%
Taylor expanded in y around 0 68.9%
if 17000 < y Initial program 97.4%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in y around 0 28.4%
*-commutative28.4%
unpow228.4%
Simplified28.4%
Taylor expanded in y around inf 28.4%
unpow228.4%
associate-*r*28.5%
Simplified28.5%
clear-num28.5%
un-div-inv28.5%
Applied egg-rr28.5%
frac-2neg28.5%
div-inv28.5%
metadata-eval28.5%
distribute-neg-frac28.5%
distribute-rgt-neg-in28.5%
distribute-rgt-neg-in28.5%
add-sqr-sqrt14.5%
sqrt-unprod27.9%
sqr-neg27.9%
sqrt-unprod13.8%
add-sqr-sqrt28.6%
clear-num28.6%
*-commutative28.6%
*-commutative28.6%
associate-*l*28.6%
Applied egg-rr28.6%
*-commutative28.6%
Simplified28.6%
Final simplification58.5%
(FPCore (x y z) :precision binary64 (/ x (* z (+ 1.0 (* y (* y 0.16666666666666666))))))
double code(double x, double y, double z) {
return x / (z * (1.0 + (y * (y * 0.16666666666666666))));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x / (z * (1.0d0 + (y * (y * 0.16666666666666666d0))))
end function
public static double code(double x, double y, double z) {
return x / (z * (1.0 + (y * (y * 0.16666666666666666))));
}
def code(x, y, z): return x / (z * (1.0 + (y * (y * 0.16666666666666666))))
function code(x, y, z) return Float64(x / Float64(z * Float64(1.0 + Float64(y * Float64(y * 0.16666666666666666))))) end
function tmp = code(x, y, z) tmp = x / (z * (1.0 + (y * (y * 0.16666666666666666)))); end
code[x_, y_, z_] := N[(x / N[(z * N[(1.0 + N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z \cdot \left(1 + y \cdot \left(y \cdot 0.16666666666666666\right)\right)}
\end{array}
Initial program 97.5%
associate-/l*97.3%
Simplified97.3%
clear-num97.2%
associate-/r/97.3%
clear-num97.3%
Applied egg-rr97.3%
Taylor expanded in y around 0 62.3%
unpow262.3%
*-commutative62.3%
associate-*l*62.3%
Simplified62.3%
Final simplification62.3%
(FPCore (x y z) :precision binary64 (/ x (+ z (* -0.16666666666666666 (* y (* y z))))))
double code(double x, double y, double z) {
return x / (z + (-0.16666666666666666 * (y * (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 = x / (z + ((-0.16666666666666666d0) * (y * (y * z))))
end function
public static double code(double x, double y, double z) {
return x / (z + (-0.16666666666666666 * (y * (y * z))));
}
def code(x, y, z): return x / (z + (-0.16666666666666666 * (y * (y * z))))
function code(x, y, z) return Float64(x / Float64(z + Float64(-0.16666666666666666 * Float64(y * Float64(y * z))))) end
function tmp = code(x, y, z) tmp = x / (z + (-0.16666666666666666 * (y * (y * z)))); end
code[x_, y_, z_] := N[(x / N[(z + N[(-0.16666666666666666 * N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z + -0.16666666666666666 \cdot \left(y \cdot \left(y \cdot z\right)\right)}
\end{array}
Initial program 97.5%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in y around 0 62.3%
*-commutative62.3%
unpow262.3%
Simplified62.3%
Taylor expanded in z around 0 62.3%
unpow262.3%
associate-*r*62.4%
Simplified62.4%
*-commutative62.4%
add-sqr-sqrt29.3%
sqrt-unprod57.9%
sqr-neg57.9%
sqrt-unprod33.6%
add-sqr-sqrt62.7%
distribute-rgt-neg-in62.7%
distribute-rgt-neg-in62.7%
cancel-sign-sub-inv62.7%
associate-*r*62.7%
associate-*l*62.7%
Applied egg-rr62.7%
associate-*r*62.7%
unpow262.7%
*-commutative62.7%
unpow262.7%
*-commutative62.7%
cancel-sign-sub-inv62.7%
metadata-eval62.7%
associate-*r*62.7%
*-commutative62.7%
/-rgt-identity62.7%
associate-/l*62.7%
associate-*l/62.7%
associate-*r/62.7%
associate-/l*62.7%
/-rgt-identity62.7%
*-commutative62.7%
Simplified62.7%
Final simplification62.7%
(FPCore (x y z) :precision binary64 (/ x (- z (* 0.16666666666666666 (* z (* y y))))))
double code(double x, double y, double z) {
return x / (z - (0.16666666666666666 * (z * (y * y))));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x / (z - (0.16666666666666666d0 * (z * (y * y))))
end function
public static double code(double x, double y, double z) {
return x / (z - (0.16666666666666666 * (z * (y * y))));
}
def code(x, y, z): return x / (z - (0.16666666666666666 * (z * (y * y))))
function code(x, y, z) return Float64(x / Float64(z - Float64(0.16666666666666666 * Float64(z * Float64(y * y))))) end
function tmp = code(x, y, z) tmp = x / (z - (0.16666666666666666 * (z * (y * y)))); end
code[x_, y_, z_] := N[(x / N[(z - N[(0.16666666666666666 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z - 0.16666666666666666 \cdot \left(z \cdot \left(y \cdot y\right)\right)}
\end{array}
Initial program 97.5%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in y around 0 62.3%
*-commutative62.3%
unpow262.3%
Simplified62.3%
Taylor expanded in z around 0 62.3%
unpow262.3%
associate-*r*62.4%
Simplified62.4%
*-commutative62.4%
add-sqr-sqrt29.3%
sqrt-unprod57.9%
sqr-neg57.9%
sqrt-unprod33.6%
add-sqr-sqrt62.7%
distribute-rgt-neg-in62.7%
distribute-rgt-neg-in62.7%
cancel-sign-sub-inv62.7%
associate-*r*62.7%
associate-*l*62.7%
Applied egg-rr62.7%
associate-*r*62.7%
unpow262.7%
*-commutative62.7%
unpow262.7%
*-commutative62.7%
Simplified62.7%
Final simplification62.7%
(FPCore (x y z) :precision binary64 (/ x z))
double code(double x, double y, double z) {
return 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 = x / z
end function
public static double code(double x, double y, double z) {
return x / z;
}
def code(x, y, z): return x / z
function code(x, y, z) return Float64(x / z) end
function tmp = code(x, y, z) tmp = x / z; end
code[x_, y_, z_] := N[(x / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z}
\end{array}
Initial program 97.5%
associate-/l*97.3%
associate-/r/90.2%
associate-/l/86.5%
associate-/r/86.7%
associate-/r*84.9%
Simplified84.9%
Taylor expanded in y around 0 54.6%
Final simplification54.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (sin y))) (t_1 (/ (* x (/ 1.0 t_0)) z)))
(if (< z -4.2173720203427147e-29)
t_1
(if (< z 4.446702369113811e+64) (/ x (* z t_0)) t_1))))
double code(double x, double y, double z) {
double t_0 = y / sin(y);
double t_1 = (x * (1.0 / t_0)) / z;
double tmp;
if (z < -4.2173720203427147e-29) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x / (z * t_0);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = y / sin(y)
t_1 = (x * (1.0d0 / t_0)) / z
if (z < (-4.2173720203427147d-29)) then
tmp = t_1
else if (z < 4.446702369113811d+64) then
tmp = x / (z * t_0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / Math.sin(y);
double t_1 = (x * (1.0 / t_0)) / z;
double tmp;
if (z < -4.2173720203427147e-29) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x / (z * t_0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y / math.sin(y) t_1 = (x * (1.0 / t_0)) / z tmp = 0 if z < -4.2173720203427147e-29: tmp = t_1 elif z < 4.446702369113811e+64: tmp = x / (z * t_0) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y / sin(y)) t_1 = Float64(Float64(x * Float64(1.0 / t_0)) / z) tmp = 0.0 if (z < -4.2173720203427147e-29) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = Float64(x / Float64(z * t_0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / sin(y); t_1 = (x * (1.0 / t_0)) / z; tmp = 0.0; if (z < -4.2173720203427147e-29) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = x / (z * t_0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[Less[z, -4.2173720203427147e-29], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\sin y}\\
t_1 := \frac{x \cdot \frac{1}{t_0}}{z}\\
\mathbf{if}\;z < -4.2173720203427147 \cdot 10^{-29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{z \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023290
(FPCore (x y z)
:name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< z -4.2173720203427147e-29) (/ (* x (/ 1.0 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1.0 (/ y (sin y)))) z)))
(/ (* x (/ (sin y) y)) z))