
(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 13 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 (if (or (<= y -2.25e-8) (not (<= y 6.4e-11))) (* (/ (sin y) z) (/ x y)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.25e-8) || !(y <= 6.4e-11)) {
tmp = (sin(y) / z) * (x / y);
} else {
tmp = 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 <= (-2.25d-8)) .or. (.not. (y <= 6.4d-11))) then
tmp = (sin(y) / z) * (x / y)
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.25e-8) || !(y <= 6.4e-11)) {
tmp = (Math.sin(y) / z) * (x / y);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.25e-8) or not (y <= 6.4e-11): tmp = (math.sin(y) / z) * (x / y) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.25e-8) || !(y <= 6.4e-11)) tmp = Float64(Float64(sin(y) / z) * Float64(x / y)); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.25e-8) || ~((y <= 6.4e-11))) tmp = (sin(y) / z) * (x / y); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.25e-8], N[Not[LessEqual[y, 6.4e-11]], $MachinePrecision]], N[(N[(N[Sin[y], $MachinePrecision] / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.25 \cdot 10^{-8} \lor \neg \left(y \leq 6.4 \cdot 10^{-11}\right):\\
\;\;\;\;\frac{\sin y}{z} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -2.24999999999999996e-8 or 6.39999999999999987e-11 < y Initial program 96.7%
associate-*r/96.8%
associate-/l/89.5%
*-commutative89.5%
times-frac96.8%
Simplified96.8%
if -2.24999999999999996e-8 < y < 6.39999999999999987e-11Initial program 100.0%
associate-*l/100.0%
times-frac75.3%
*-commutative75.3%
associate-*r/73.9%
*-commutative73.9%
Simplified73.9%
Taylor expanded in y around 0 100.0%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.35e-8) (not (<= y 3e-21))) (* (sin y) (/ x (* y z))) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.35e-8) || !(y <= 3e-21)) {
tmp = sin(y) * (x / (y * z));
} else {
tmp = 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 <= (-2.35d-8)) .or. (.not. (y <= 3d-21))) then
tmp = sin(y) * (x / (y * z))
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.35e-8) || !(y <= 3e-21)) {
tmp = Math.sin(y) * (x / (y * z));
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.35e-8) or not (y <= 3e-21): tmp = math.sin(y) * (x / (y * z)) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.35e-8) || !(y <= 3e-21)) tmp = Float64(sin(y) * Float64(x / Float64(y * z))); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.35e-8) || ~((y <= 3e-21))) tmp = sin(y) * (x / (y * z)); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.35e-8], N[Not[LessEqual[y, 3e-21]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.35 \cdot 10^{-8} \lor \neg \left(y \leq 3 \cdot 10^{-21}\right):\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -2.3499999999999999e-8 or 2.99999999999999991e-21 < y Initial program 96.7%
associate-*l/92.5%
times-frac89.6%
*-commutative89.6%
associate-*r/89.6%
*-commutative89.6%
Simplified89.6%
if -2.3499999999999999e-8 < y < 2.99999999999999991e-21Initial program 100.0%
associate-*l/100.0%
times-frac75.1%
*-commutative75.1%
associate-*r/73.7%
*-commutative73.7%
Simplified73.7%
Taylor expanded in y around 0 100.0%
Final simplification94.6%
(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}
Initial program 98.3%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= y -7200000000.0) (* (/ x (* y z)) (/ 6.0 y)) (if (<= y 6.4e-11) (/ x z) (* 6.0 (* (/ (/ x z) y) (/ 1.0 y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7200000000.0) {
tmp = (x / (y * z)) * (6.0 / y);
} else if (y <= 6.4e-11) {
tmp = x / z;
} else {
tmp = 6.0 * (((x / z) / y) * (1.0 / 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 (y <= (-7200000000.0d0)) then
tmp = (x / (y * z)) * (6.0d0 / y)
else if (y <= 6.4d-11) then
tmp = x / z
else
tmp = 6.0d0 * (((x / z) / y) * (1.0d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7200000000.0) {
tmp = (x / (y * z)) * (6.0 / y);
} else if (y <= 6.4e-11) {
tmp = x / z;
} else {
tmp = 6.0 * (((x / z) / y) * (1.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7200000000.0: tmp = (x / (y * z)) * (6.0 / y) elif y <= 6.4e-11: tmp = x / z else: tmp = 6.0 * (((x / z) / y) * (1.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7200000000.0) tmp = Float64(Float64(x / Float64(y * z)) * Float64(6.0 / y)); elseif (y <= 6.4e-11) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(Float64(Float64(x / z) / y) * Float64(1.0 / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7200000000.0) tmp = (x / (y * z)) * (6.0 / y); elseif (y <= 6.4e-11) tmp = x / z; else tmp = 6.0 * (((x / z) / y) * (1.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7200000000.0], N[(N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(6.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e-11], N[(x / z), $MachinePrecision], N[(6.0 * N[(N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7200000000:\\
\;\;\;\;\frac{x}{y \cdot z} \cdot \frac{6}{y}\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\frac{\frac{x}{z}}{y} \cdot \frac{1}{y}\right)\\
\end{array}
\end{array}
if y < -7.2e9Initial program 97.9%
associate-/l*90.1%
associate-/r/90.0%
Simplified90.0%
Taylor expanded in y around 0 36.8%
Taylor expanded in y around inf 36.8%
*-commutative36.8%
unpow236.8%
Simplified36.8%
Taylor expanded in x around 0 36.8%
associate-*r/36.8%
*-commutative36.8%
unpow236.8%
*-commutative36.8%
associate-/l*36.8%
associate-*r*36.8%
associate-/l*36.8%
Simplified36.8%
associate-/r/38.4%
*-commutative38.4%
Applied egg-rr38.4%
if -7.2e9 < y < 6.39999999999999987e-11Initial program 100.0%
associate-*l/99.3%
times-frac76.0%
*-commutative76.0%
associate-*r/74.7%
*-commutative74.7%
Simplified74.7%
Taylor expanded in y around 0 98.7%
if 6.39999999999999987e-11 < y Initial program 95.5%
associate-/l*88.3%
associate-/r/88.5%
Simplified88.5%
Taylor expanded in y around 0 30.7%
Taylor expanded in y around inf 30.7%
*-commutative30.7%
unpow230.7%
Simplified30.7%
Taylor expanded in x around 0 30.7%
unpow230.7%
*-commutative30.7%
associate-/r*32.0%
Simplified32.0%
associate-/r*32.2%
div-inv32.2%
Applied egg-rr32.2%
Final simplification66.9%
(FPCore (x y z)
:precision binary64
(if (<= y -3700000.0)
(* (/ x (* y z)) (/ 6.0 y))
(if (<= y 6.4e-11)
(/ (* x (+ 1.0 (* -0.16666666666666666 (* y y)))) z)
(* 6.0 (* (/ (/ x z) y) (/ 1.0 y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3700000.0) {
tmp = (x / (y * z)) * (6.0 / y);
} else if (y <= 6.4e-11) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = 6.0 * (((x / z) / y) * (1.0 / 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 (y <= (-3700000.0d0)) then
tmp = (x / (y * z)) * (6.0d0 / y)
else if (y <= 6.4d-11) then
tmp = (x * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))) / z
else
tmp = 6.0d0 * (((x / z) / y) * (1.0d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3700000.0) {
tmp = (x / (y * z)) * (6.0 / y);
} else if (y <= 6.4e-11) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = 6.0 * (((x / z) / y) * (1.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3700000.0: tmp = (x / (y * z)) * (6.0 / y) elif y <= 6.4e-11: tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z else: tmp = 6.0 * (((x / z) / y) * (1.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3700000.0) tmp = Float64(Float64(x / Float64(y * z)) * Float64(6.0 / y)); elseif (y <= 6.4e-11) tmp = Float64(Float64(x * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))) / z); else tmp = Float64(6.0 * Float64(Float64(Float64(x / z) / y) * Float64(1.0 / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3700000.0) tmp = (x / (y * z)) * (6.0 / y); elseif (y <= 6.4e-11) tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z; else tmp = 6.0 * (((x / z) / y) * (1.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3700000.0], N[(N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(6.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e-11], N[(N[(x * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(6.0 * N[(N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3700000:\\
\;\;\;\;\frac{x}{y \cdot z} \cdot \frac{6}{y}\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\frac{\frac{x}{z}}{y} \cdot \frac{1}{y}\right)\\
\end{array}
\end{array}
if y < -3.7e6Initial program 98.0%
associate-/l*90.6%
associate-/r/90.5%
Simplified90.5%
Taylor expanded in y around 0 38.4%
Taylor expanded in y around inf 38.4%
*-commutative38.4%
unpow238.4%
Simplified38.4%
Taylor expanded in x around 0 38.4%
associate-*r/38.4%
*-commutative38.4%
unpow238.4%
*-commutative38.4%
associate-/l*38.4%
associate-*r*38.4%
associate-/l*38.4%
Simplified38.4%
associate-/r/39.9%
*-commutative39.9%
Applied egg-rr39.9%
if -3.7e6 < y < 6.39999999999999987e-11Initial program 100.0%
Taylor expanded in y around 0 99.4%
unpow299.4%
Simplified99.4%
if 6.39999999999999987e-11 < y Initial program 95.5%
associate-/l*88.3%
associate-/r/88.5%
Simplified88.5%
Taylor expanded in y around 0 30.7%
Taylor expanded in y around inf 30.7%
*-commutative30.7%
unpow230.7%
Simplified30.7%
Taylor expanded in x around 0 30.7%
unpow230.7%
*-commutative30.7%
associate-/r*32.0%
Simplified32.0%
associate-/r*32.2%
div-inv32.2%
Applied egg-rr32.2%
Final simplification66.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -8000000000.0) (not (<= y 6.4e-11))) (* (/ x (* y z)) (/ 6.0 y)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8000000000.0) || !(y <= 6.4e-11)) {
tmp = (x / (y * z)) * (6.0 / y);
} else {
tmp = 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 <= (-8000000000.0d0)) .or. (.not. (y <= 6.4d-11))) then
tmp = (x / (y * z)) * (6.0d0 / y)
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -8000000000.0) || !(y <= 6.4e-11)) {
tmp = (x / (y * z)) * (6.0 / y);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -8000000000.0) or not (y <= 6.4e-11): tmp = (x / (y * z)) * (6.0 / y) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -8000000000.0) || !(y <= 6.4e-11)) tmp = Float64(Float64(x / Float64(y * z)) * Float64(6.0 / y)); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -8000000000.0) || ~((y <= 6.4e-11))) tmp = (x / (y * z)) * (6.0 / y); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -8000000000.0], N[Not[LessEqual[y, 6.4e-11]], $MachinePrecision]], N[(N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(6.0 / y), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8000000000 \lor \neg \left(y \leq 6.4 \cdot 10^{-11}\right):\\
\;\;\;\;\frac{x}{y \cdot z} \cdot \frac{6}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -8e9 or 6.39999999999999987e-11 < y Initial program 96.6%
associate-/l*89.1%
associate-/r/89.2%
Simplified89.2%
Taylor expanded in y around 0 33.5%
Taylor expanded in y around inf 33.5%
*-commutative33.5%
unpow233.5%
Simplified33.5%
Taylor expanded in x around 0 33.5%
associate-*r/33.5%
*-commutative33.5%
unpow233.5%
*-commutative33.5%
associate-/l*33.5%
associate-*r*33.5%
associate-/l*33.5%
Simplified33.5%
associate-/r/35.0%
*-commutative35.0%
Applied egg-rr35.0%
if -8e9 < y < 6.39999999999999987e-11Initial program 100.0%
associate-*l/99.3%
times-frac76.0%
*-commutative76.0%
associate-*r/74.7%
*-commutative74.7%
Simplified74.7%
Taylor expanded in y around 0 98.7%
Final simplification66.8%
(FPCore (x y z) :precision binary64 (if (<= y -2.1e+32) (* 6.0 (/ x (* z (* y y)))) (if (<= y 6.4e-11) (/ x z) (* 6.0 (/ (/ x z) (* y y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.1e+32) {
tmp = 6.0 * (x / (z * (y * y)));
} else if (y <= 6.4e-11) {
tmp = x / z;
} else {
tmp = 6.0 * ((x / z) / (y * 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 (y <= (-2.1d+32)) then
tmp = 6.0d0 * (x / (z * (y * y)))
else if (y <= 6.4d-11) then
tmp = x / z
else
tmp = 6.0d0 * ((x / z) / (y * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.1e+32) {
tmp = 6.0 * (x / (z * (y * y)));
} else if (y <= 6.4e-11) {
tmp = x / z;
} else {
tmp = 6.0 * ((x / z) / (y * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.1e+32: tmp = 6.0 * (x / (z * (y * y))) elif y <= 6.4e-11: tmp = x / z else: tmp = 6.0 * ((x / z) / (y * y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.1e+32) tmp = Float64(6.0 * Float64(x / Float64(z * Float64(y * y)))); elseif (y <= 6.4e-11) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(Float64(x / z) / Float64(y * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.1e+32) tmp = 6.0 * (x / (z * (y * y))); elseif (y <= 6.4e-11) tmp = x / z; else tmp = 6.0 * ((x / z) / (y * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.1e+32], N[(6.0 * N[(x / N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e-11], N[(x / z), $MachinePrecision], N[(6.0 * N[(N[(x / z), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{+32}:\\
\;\;\;\;6 \cdot \frac{x}{z \cdot \left(y \cdot y\right)}\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{\frac{x}{z}}{y \cdot y}\\
\end{array}
\end{array}
if y < -2.1000000000000001e32Initial program 97.6%
associate-/l*88.6%
associate-/r/88.5%
Simplified88.5%
Taylor expanded in y around 0 38.0%
Taylor expanded in y around inf 38.0%
*-commutative38.0%
unpow238.0%
Simplified38.0%
if -2.1000000000000001e32 < y < 6.39999999999999987e-11Initial program 100.0%
associate-*l/99.3%
times-frac77.4%
*-commutative77.4%
associate-*r/76.1%
*-commutative76.1%
Simplified76.1%
Taylor expanded in y around 0 95.2%
if 6.39999999999999987e-11 < y Initial program 95.5%
associate-/l*88.3%
associate-/r/88.5%
Simplified88.5%
Taylor expanded in y around 0 30.7%
Taylor expanded in y around inf 30.7%
*-commutative30.7%
unpow230.7%
Simplified30.7%
Taylor expanded in x around 0 30.7%
unpow230.7%
*-commutative30.7%
associate-/r*32.0%
Simplified32.0%
Final simplification66.8%
(FPCore (x y z) :precision binary64 (if (<= y -7e+32) (* x (/ (/ 6.0 y) (* y z))) (if (<= y 6.4e-11) (/ x z) (* 6.0 (/ (/ x z) (* y y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7e+32) {
tmp = x * ((6.0 / y) / (y * z));
} else if (y <= 6.4e-11) {
tmp = x / z;
} else {
tmp = 6.0 * ((x / z) / (y * 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 (y <= (-7d+32)) then
tmp = x * ((6.0d0 / y) / (y * z))
else if (y <= 6.4d-11) then
tmp = x / z
else
tmp = 6.0d0 * ((x / z) / (y * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7e+32) {
tmp = x * ((6.0 / y) / (y * z));
} else if (y <= 6.4e-11) {
tmp = x / z;
} else {
tmp = 6.0 * ((x / z) / (y * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7e+32: tmp = x * ((6.0 / y) / (y * z)) elif y <= 6.4e-11: tmp = x / z else: tmp = 6.0 * ((x / z) / (y * y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7e+32) tmp = Float64(x * Float64(Float64(6.0 / y) / Float64(y * z))); elseif (y <= 6.4e-11) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(Float64(x / z) / Float64(y * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7e+32) tmp = x * ((6.0 / y) / (y * z)); elseif (y <= 6.4e-11) tmp = x / z; else tmp = 6.0 * ((x / z) / (y * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7e+32], N[(x * N[(N[(6.0 / y), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e-11], N[(x / z), $MachinePrecision], N[(6.0 * N[(N[(x / z), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+32}:\\
\;\;\;\;x \cdot \frac{\frac{6}{y}}{y \cdot z}\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{\frac{x}{z}}{y \cdot y}\\
\end{array}
\end{array}
if y < -7.0000000000000002e32Initial program 97.6%
associate-/l*88.6%
associate-/r/88.5%
Simplified88.5%
Taylor expanded in y around 0 38.0%
Taylor expanded in y around inf 38.0%
*-commutative38.0%
unpow238.0%
Simplified38.0%
Taylor expanded in x around 0 38.0%
associate-*r/38.0%
*-commutative38.0%
unpow238.0%
*-commutative38.0%
associate-/l*38.0%
associate-*r*38.0%
associate-/l*38.0%
Simplified38.0%
div-inv38.0%
clear-num38.0%
*-commutative38.0%
Applied egg-rr38.0%
if -7.0000000000000002e32 < y < 6.39999999999999987e-11Initial program 100.0%
associate-*l/99.3%
times-frac77.4%
*-commutative77.4%
associate-*r/76.1%
*-commutative76.1%
Simplified76.1%
Taylor expanded in y around 0 95.2%
if 6.39999999999999987e-11 < y Initial program 95.5%
associate-/l*88.3%
associate-/r/88.5%
Simplified88.5%
Taylor expanded in y around 0 30.7%
Taylor expanded in y around inf 30.7%
*-commutative30.7%
unpow230.7%
Simplified30.7%
Taylor expanded in x around 0 30.7%
unpow230.7%
*-commutative30.7%
associate-/r*32.0%
Simplified32.0%
Final simplification66.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -5e+49) (not (<= y 5e+25))) (* y (/ x (* y z))) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+49) || !(y <= 5e+25)) {
tmp = y * (x / (y * z));
} else {
tmp = 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+49)) .or. (.not. (y <= 5d+25))) then
tmp = y * (x / (y * z))
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+49) || !(y <= 5e+25)) {
tmp = y * (x / (y * z));
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5e+49) or not (y <= 5e+25): tmp = y * (x / (y * z)) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5e+49) || !(y <= 5e+25)) tmp = Float64(y * Float64(x / Float64(y * z))); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5e+49) || ~((y <= 5e+25))) tmp = y * (x / (y * z)); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5e+49], N[Not[LessEqual[y, 5e+25]], $MachinePrecision]], N[(y * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+49} \lor \neg \left(y \leq 5 \cdot 10^{+25}\right):\\
\;\;\;\;y \cdot \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -5.0000000000000004e49 or 5.00000000000000024e25 < y Initial program 96.0%
associate-*r/96.1%
associate-/l/87.9%
*-commutative87.9%
times-frac96.1%
Simplified96.1%
Taylor expanded in y around 0 21.1%
*-commutative21.1%
clear-num21.1%
frac-times34.5%
*-un-lft-identity34.5%
Applied egg-rr34.5%
div-inv34.5%
associate-*l/34.6%
*-commutative34.6%
clear-num33.1%
*-commutative33.1%
Applied egg-rr33.1%
if -5.0000000000000004e49 < y < 5.00000000000000024e25Initial program 99.9%
associate-*l/99.3%
times-frac79.0%
*-commutative79.0%
associate-*r/77.9%
*-commutative77.9%
Simplified77.9%
Taylor expanded in y around 0 88.4%
Final simplification65.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -5e+49) (not (<= y 2.3e-32))) (/ y (* z (/ y x))) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+49) || !(y <= 2.3e-32)) {
tmp = y / (z * (y / x));
} else {
tmp = 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+49)) .or. (.not. (y <= 2.3d-32))) then
tmp = y / (z * (y / x))
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+49) || !(y <= 2.3e-32)) {
tmp = y / (z * (y / x));
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5e+49) or not (y <= 2.3e-32): tmp = y / (z * (y / x)) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5e+49) || !(y <= 2.3e-32)) tmp = Float64(y / Float64(z * Float64(y / x))); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5e+49) || ~((y <= 2.3e-32))) tmp = y / (z * (y / x)); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5e+49], N[Not[LessEqual[y, 2.3e-32]], $MachinePrecision]], N[(y / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+49} \lor \neg \left(y \leq 2.3 \cdot 10^{-32}\right):\\
\;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -5.0000000000000004e49 or 2.3000000000000001e-32 < y Initial program 96.4%
associate-*r/96.5%
associate-/l/87.5%
*-commutative87.5%
times-frac96.5%
Simplified96.5%
Taylor expanded in y around 0 23.7%
*-commutative23.7%
clear-num23.7%
frac-times36.2%
*-un-lft-identity36.2%
Applied egg-rr36.2%
if -5.0000000000000004e49 < y < 2.3000000000000001e-32Initial program 99.9%
associate-*l/99.3%
times-frac78.5%
*-commutative78.5%
associate-*r/77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in y around 0 92.0%
Final simplification66.5%
(FPCore (x y z) :precision binary64 (if (<= y -7.5e+49) (/ y (* z (/ y x))) (if (<= y 6.4e-11) (/ x z) (/ y (/ z (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.5e+49) {
tmp = y / (z * (y / x));
} else if (y <= 6.4e-11) {
tmp = x / z;
} else {
tmp = y / (z / (x / 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 (y <= (-7.5d+49)) then
tmp = y / (z * (y / x))
else if (y <= 6.4d-11) then
tmp = x / z
else
tmp = y / (z / (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7.5e+49) {
tmp = y / (z * (y / x));
} else if (y <= 6.4e-11) {
tmp = x / z;
} else {
tmp = y / (z / (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.5e+49: tmp = y / (z * (y / x)) elif y <= 6.4e-11: tmp = x / z else: tmp = y / (z / (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.5e+49) tmp = Float64(y / Float64(z * Float64(y / x))); elseif (y <= 6.4e-11) tmp = Float64(x / z); else tmp = Float64(y / Float64(z / Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7.5e+49) tmp = y / (z * (y / x)); elseif (y <= 6.4e-11) tmp = x / z; else tmp = y / (z / (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.5e+49], N[(y / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e-11], N[(x / z), $MachinePrecision], N[(y / N[(z / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+49}:\\
\;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{\frac{x}{y}}}\\
\end{array}
\end{array}
if y < -7.4999999999999995e49Initial program 97.4%
associate-*r/97.5%
associate-/l/87.2%
*-commutative87.2%
times-frac97.6%
Simplified97.6%
Taylor expanded in y around 0 18.8%
*-commutative18.8%
clear-num18.8%
frac-times39.1%
*-un-lft-identity39.1%
Applied egg-rr39.1%
if -7.4999999999999995e49 < y < 6.39999999999999987e-11Initial program 99.9%
associate-*l/99.3%
times-frac78.3%
*-commutative78.3%
associate-*r/77.1%
*-commutative77.1%
Simplified77.1%
Taylor expanded in y around 0 92.2%
if 6.39999999999999987e-11 < y Initial program 95.5%
associate-*r/95.7%
associate-/l/88.5%
*-commutative88.5%
times-frac95.6%
Simplified95.6%
Taylor expanded in y around 0 23.7%
*-commutative23.7%
clear-num23.7%
frac-times31.5%
*-un-lft-identity31.5%
Applied egg-rr31.5%
*-commutative31.5%
clear-num31.5%
un-div-inv31.5%
Applied egg-rr31.5%
Final simplification66.5%
(FPCore (x y z) :precision binary64 (if (<= y -7e+32) (* 6.0 (/ x (* z (* y y)))) (if (<= y 6.4e-11) (/ x z) (/ y (/ z (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7e+32) {
tmp = 6.0 * (x / (z * (y * y)));
} else if (y <= 6.4e-11) {
tmp = x / z;
} else {
tmp = y / (z / (x / 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 (y <= (-7d+32)) then
tmp = 6.0d0 * (x / (z * (y * y)))
else if (y <= 6.4d-11) then
tmp = x / z
else
tmp = y / (z / (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7e+32) {
tmp = 6.0 * (x / (z * (y * y)));
} else if (y <= 6.4e-11) {
tmp = x / z;
} else {
tmp = y / (z / (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7e+32: tmp = 6.0 * (x / (z * (y * y))) elif y <= 6.4e-11: tmp = x / z else: tmp = y / (z / (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7e+32) tmp = Float64(6.0 * Float64(x / Float64(z * Float64(y * y)))); elseif (y <= 6.4e-11) tmp = Float64(x / z); else tmp = Float64(y / Float64(z / Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7e+32) tmp = 6.0 * (x / (z * (y * y))); elseif (y <= 6.4e-11) tmp = x / z; else tmp = y / (z / (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7e+32], N[(6.0 * N[(x / N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e-11], N[(x / z), $MachinePrecision], N[(y / N[(z / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+32}:\\
\;\;\;\;6 \cdot \frac{x}{z \cdot \left(y \cdot y\right)}\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{\frac{x}{y}}}\\
\end{array}
\end{array}
if y < -7.0000000000000002e32Initial program 97.6%
associate-/l*88.6%
associate-/r/88.5%
Simplified88.5%
Taylor expanded in y around 0 38.0%
Taylor expanded in y around inf 38.0%
*-commutative38.0%
unpow238.0%
Simplified38.0%
if -7.0000000000000002e32 < y < 6.39999999999999987e-11Initial program 100.0%
associate-*l/99.3%
times-frac77.4%
*-commutative77.4%
associate-*r/76.1%
*-commutative76.1%
Simplified76.1%
Taylor expanded in y around 0 95.2%
if 6.39999999999999987e-11 < y Initial program 95.5%
associate-*r/95.7%
associate-/l/88.5%
*-commutative88.5%
times-frac95.6%
Simplified95.6%
Taylor expanded in y around 0 23.7%
*-commutative23.7%
clear-num23.7%
frac-times31.5%
*-un-lft-identity31.5%
Applied egg-rr31.5%
*-commutative31.5%
clear-num31.5%
un-div-inv31.5%
Applied egg-rr31.5%
Final simplification66.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 98.3%
associate-*l/96.1%
times-frac82.6%
*-commutative82.6%
associate-*r/82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in y around 0 58.7%
Final simplification58.7%
(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 2023182
(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))