
(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 9 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 (/ (sin y) y))) (if (or (<= x -5e+64) (not (<= x 7e-52))) (/ (* x t_0) z) (* t_0 (/ x z)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if ((x <= -5e+64) || !(x <= 7e-52)) {
tmp = (x * t_0) / z;
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = sin(y) / y
if ((x <= (-5d+64)) .or. (.not. (x <= 7d-52))) then
tmp = (x * t_0) / z
else
tmp = t_0 * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) / y;
double tmp;
if ((x <= -5e+64) || !(x <= 7e-52)) {
tmp = (x * t_0) / z;
} else {
tmp = t_0 * (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y tmp = 0 if (x <= -5e+64) or not (x <= 7e-52): tmp = (x * t_0) / z else: tmp = t_0 * (x / z) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) tmp = 0.0 if ((x <= -5e+64) || !(x <= 7e-52)) tmp = Float64(Float64(x * t_0) / z); else tmp = Float64(t_0 * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) / y; tmp = 0.0; if ((x <= -5e+64) || ~((x <= 7e-52))) tmp = (x * t_0) / z; else tmp = t_0 * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, If[Or[LessEqual[x, -5e+64], N[Not[LessEqual[x, 7e-52]], $MachinePrecision]], N[(N[(x * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;x \leq -5 \cdot 10^{+64} \lor \neg \left(x \leq 7 \cdot 10^{-52}\right):\\
\;\;\;\;\frac{x \cdot t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\end{array}
\end{array}
if x < -5e64 or 7.0000000000000001e-52 < x Initial program 99.7%
if -5e64 < x < 7.0000000000000001e-52Initial program 93.4%
associate-*l/99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y))) (if (<= t_0 2e-181) (* (sin y) (/ (/ x y) z)) (* t_0 (/ x z)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if (t_0 <= 2e-181) {
tmp = sin(y) * ((x / y) / z);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = sin(y) / y
if (t_0 <= 2d-181) then
tmp = sin(y) * ((x / y) / z)
else
tmp = t_0 * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) / y;
double tmp;
if (t_0 <= 2e-181) {
tmp = Math.sin(y) * ((x / y) / z);
} else {
tmp = t_0 * (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y tmp = 0 if t_0 <= 2e-181: tmp = math.sin(y) * ((x / y) / z) else: tmp = t_0 * (x / z) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) tmp = 0.0 if (t_0 <= 2e-181) tmp = Float64(sin(y) * Float64(Float64(x / y) / z)); else tmp = Float64(t_0 * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) / y; tmp = 0.0; if (t_0 <= 2e-181) tmp = sin(y) * ((x / y) / z); else tmp = t_0 * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-181], N[(N[Sin[y], $MachinePrecision] * N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;t_0 \leq 2 \cdot 10^{-181}:\\
\;\;\;\;\sin y \cdot \frac{\frac{x}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 y) y) < 2.00000000000000009e-181Initial program 95.2%
associate-/l*92.0%
associate-/l*92.0%
associate-/r/92.1%
*-commutative92.1%
associate-/l/95.2%
Simplified95.2%
if 2.00000000000000009e-181 < (/.f64 (sin.f64 y) y) Initial program 97.1%
associate-*l/98.4%
Simplified98.4%
Final simplification97.4%
(FPCore (x y z) :precision binary64 (if (<= y 7e-7) (* (/ x z) (+ 1.0 (* -0.16666666666666666 (* y y)))) (* x (/ (sin y) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 7e-7) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = x * (sin(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 <= 7d-7) then
tmp = (x / z) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
else
tmp = x * (sin(y) / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 7e-7) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = x * (Math.sin(y) / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 7e-7: tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))) else: tmp = x * (math.sin(y) / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 7e-7) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); else tmp = Float64(x * Float64(sin(y) / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 7e-7) tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))); else tmp = x * (sin(y) / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 7e-7], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[Sin[y], $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7 \cdot 10^{-7}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\sin y}{y \cdot z}\\
\end{array}
\end{array}
if y < 6.99999999999999968e-7Initial program 97.4%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in y around 0 70.4%
unpow270.4%
Simplified70.4%
if 6.99999999999999968e-7 < y Initial program 93.4%
associate-*r/92.0%
associate-/l/92.0%
*-commutative92.0%
Simplified92.0%
Final simplification75.5%
(FPCore (x y z) :precision binary64 (if (<= y 8.2e-7) (* (/ x z) (+ 1.0 (* -0.16666666666666666 (* y y)))) (* (sin y) (/ (/ x y) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 8.2e-7) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} 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 <= 8.2d-7) then
tmp = (x / z) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
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 <= 8.2e-7) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = Math.sin(y) * ((x / y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 8.2e-7: tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))) else: tmp = math.sin(y) * ((x / y) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 8.2e-7) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); else tmp = Float64(sin(y) * Float64(Float64(x / y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 8.2e-7) tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))); else tmp = sin(y) * ((x / y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 8.2e-7], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.2 \cdot 10^{-7}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{\frac{x}{y}}{z}\\
\end{array}
\end{array}
if y < 8.1999999999999998e-7Initial program 97.4%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in y around 0 70.4%
unpow270.4%
Simplified70.4%
if 8.1999999999999998e-7 < y Initial program 93.4%
associate-/l*92.0%
associate-/l*92.0%
associate-/r/91.8%
*-commutative91.8%
associate-/l/93.6%
Simplified93.6%
Final simplification75.9%
(FPCore (x y z) :precision binary64 (if (<= y 1.4e+67) (* (/ x z) (+ 1.0 (* -0.16666666666666666 (* y y)))) (* x (/ (- y) (* y (- z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.4e+67) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = 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 <= 1.4d+67) then
tmp = (x / z) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
else
tmp = x * (-y / (y * -z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.4e+67) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = x * (-y / (y * -z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.4e+67: tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))) else: tmp = x * (-y / (y * -z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.4e+67) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); else tmp = Float64(x * Float64(Float64(-y) / Float64(y * Float64(-z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.4e+67) tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))); else tmp = x * (-y / (y * -z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.4e+67], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[((-y) / N[(y * (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{+67}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-y}{y \cdot \left(-z\right)}\\
\end{array}
\end{array}
if y < 1.3999999999999999e67Initial program 97.6%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in y around 0 68.7%
unpow268.7%
Simplified68.7%
if 1.3999999999999999e67 < y Initial program 91.6%
associate-*r/89.7%
associate-/l/89.7%
*-commutative89.7%
Simplified89.7%
associate-*r/89.7%
associate-/l/85.8%
associate-*l/85.9%
*-commutative85.9%
Applied egg-rr85.9%
Taylor expanded in y around 0 19.2%
associate-*r/19.0%
Simplified19.0%
frac-2neg19.0%
distribute-rgt-neg-in19.0%
neg-mul-119.0%
metadata-eval19.0%
times-frac19.1%
div-inv19.1%
metadata-eval19.1%
metadata-eval19.1%
metadata-eval19.1%
*-commutative19.1%
metadata-eval19.1%
neg-mul-119.1%
frac-2neg19.1%
distribute-frac-neg19.1%
remove-double-neg19.1%
Applied egg-rr19.1%
associate-/l/29.9%
Simplified29.9%
Final simplification61.6%
(FPCore (x y z) :precision binary64 (if (<= y 1e+101) (/ x z) (* x (/ (- y) (* y (- z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1e+101) {
tmp = x / z;
} else {
tmp = 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 <= 1d+101) then
tmp = x / z
else
tmp = x * (-y / (y * -z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1e+101) {
tmp = x / z;
} else {
tmp = x * (-y / (y * -z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1e+101: tmp = x / z else: tmp = x * (-y / (y * -z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1e+101) tmp = Float64(x / z); else tmp = Float64(x * Float64(Float64(-y) / Float64(y * Float64(-z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1e+101) tmp = x / z; else tmp = x * (-y / (y * -z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1e+101], N[(x / z), $MachinePrecision], N[(x * N[((-y) / N[(y * (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+101}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-y}{y \cdot \left(-z\right)}\\
\end{array}
\end{array}
if y < 9.9999999999999998e100Initial program 97.2%
Taylor expanded in y around 0 68.5%
if 9.9999999999999998e100 < y Initial program 92.3%
associate-*r/92.0%
associate-/l/91.9%
*-commutative91.9%
Simplified91.9%
associate-*r/91.8%
associate-/l/86.5%
associate-*l/86.6%
*-commutative86.6%
Applied egg-rr86.6%
Taylor expanded in y around 0 17.6%
associate-*r/17.5%
Simplified17.5%
frac-2neg17.5%
distribute-rgt-neg-in17.5%
neg-mul-117.5%
metadata-eval17.5%
times-frac17.6%
div-inv17.6%
metadata-eval17.6%
metadata-eval17.6%
metadata-eval17.6%
*-commutative17.6%
metadata-eval17.6%
neg-mul-117.6%
frac-2neg17.6%
distribute-frac-neg17.6%
remove-double-neg17.6%
Applied egg-rr17.6%
associate-/l/31.6%
Simplified31.6%
Final simplification63.3%
(FPCore (x y z) :precision binary64 (if (<= y 2.5e+70) (/ x z) (* (/ x y) (/ y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5e+70) {
tmp = x / z;
} else {
tmp = (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 <= 2.5d+70) then
tmp = x / z
else
tmp = (x / y) * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5e+70) {
tmp = x / z;
} else {
tmp = (x / y) * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5e+70: tmp = x / z else: tmp = (x / y) * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5e+70) tmp = Float64(x / z); else tmp = Float64(Float64(x / y) * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5e+70) tmp = x / z; else tmp = (x / y) * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5e+70], N[(x / z), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{+70}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < 2.5000000000000001e70Initial program 97.6%
Taylor expanded in y around 0 70.5%
if 2.5000000000000001e70 < y Initial program 91.5%
associate-*r/89.5%
associate-/l/89.5%
*-commutative89.5%
Simplified89.5%
associate-*r/89.5%
associate-/l/87.4%
associate-*l/87.5%
*-commutative87.5%
Applied egg-rr87.5%
Taylor expanded in y around 0 19.3%
associate-*r/19.1%
Simplified19.1%
associate-/l*19.3%
associate-/r/26.7%
*-commutative26.7%
Applied egg-rr26.7%
Final simplification62.7%
(FPCore (x y z) :precision binary64 (if (<= y 3.5e+104) (/ x z) (/ (* x y) (* y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.5e+104) {
tmp = x / z;
} else {
tmp = (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 <= 3.5d+104) then
tmp = x / z
else
tmp = (x * y) / (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.5e+104) {
tmp = x / z;
} else {
tmp = (x * y) / (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.5e+104: tmp = x / z else: tmp = (x * y) / (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.5e+104) tmp = Float64(x / z); else tmp = Float64(Float64(x * y) / Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.5e+104) tmp = x / z; else tmp = (x * y) / (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.5e+104], N[(x / z), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{+104}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{y \cdot z}\\
\end{array}
\end{array}
if y < 3.5000000000000002e104Initial program 97.2%
Taylor expanded in y around 0 68.5%
if 3.5000000000000002e104 < y Initial program 92.3%
Taylor expanded in x around 0 91.8%
Taylor expanded in y around 0 28.4%
Final simplification62.8%
(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 96.5%
Taylor expanded in y around 0 61.4%
Final simplification61.4%
(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 2023297
(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))