
(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 12 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 (<= z -5e+78) (not (<= z 0.012))) (* t_0 (/ x z)) (/ x (/ z t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if ((z <= -5e+78) || !(z <= 0.012)) {
tmp = t_0 * (x / z);
} else {
tmp = x / (z / 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 = sin(y) / y
if ((z <= (-5d+78)) .or. (.not. (z <= 0.012d0))) then
tmp = t_0 * (x / z)
else
tmp = x / (z / t_0)
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 ((z <= -5e+78) || !(z <= 0.012)) {
tmp = t_0 * (x / z);
} else {
tmp = x / (z / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y tmp = 0 if (z <= -5e+78) or not (z <= 0.012): tmp = t_0 * (x / z) else: tmp = x / (z / t_0) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) tmp = 0.0 if ((z <= -5e+78) || !(z <= 0.012)) tmp = Float64(t_0 * Float64(x / z)); else tmp = Float64(x / Float64(z / t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) / y; tmp = 0.0; if ((z <= -5e+78) || ~((z <= 0.012))) tmp = t_0 * (x / z); else tmp = x / (z / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, If[Or[LessEqual[z, -5e+78], N[Not[LessEqual[z, 0.012]], $MachinePrecision]], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;z \leq -5 \cdot 10^{+78} \lor \neg \left(z \leq 0.012\right):\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if z < -4.99999999999999984e78 or 0.012 < z Initial program 99.8%
*-commutative99.8%
associate-*r/99.8%
Simplified99.8%
if -4.99999999999999984e78 < z < 0.012Initial program 91.9%
associate-/l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -6e+78) (not (<= z 0.24))) (* (/ (sin y) y) (/ x z)) (/ x (* z (/ y (sin y))))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6e+78) || !(z <= 0.24)) {
tmp = (sin(y) / y) * (x / z);
} 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) :: tmp
if ((z <= (-6d+78)) .or. (.not. (z <= 0.24d0))) then
tmp = (sin(y) / y) * (x / z)
else
tmp = x / (z * (y / sin(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6e+78) || !(z <= 0.24)) {
tmp = (Math.sin(y) / y) * (x / z);
} else {
tmp = x / (z * (y / Math.sin(y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6e+78) or not (z <= 0.24): tmp = (math.sin(y) / y) * (x / z) else: tmp = x / (z * (y / math.sin(y))) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6e+78) || !(z <= 0.24)) tmp = Float64(Float64(sin(y) / y) * Float64(x / z)); else tmp = Float64(x / Float64(z * Float64(y / sin(y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6e+78) || ~((z <= 0.24))) tmp = (sin(y) / y) * (x / z); else tmp = x / (z * (y / sin(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6e+78], N[Not[LessEqual[z, 0.24]], $MachinePrecision]], N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z * N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+78} \lor \neg \left(z \leq 0.24\right):\\
\;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\
\end{array}
\end{array}
if z < -5.99999999999999964e78 or 0.23999999999999999 < z Initial program 99.8%
*-commutative99.8%
associate-*r/99.8%
Simplified99.8%
if -5.99999999999999964e78 < z < 0.23999999999999999Initial program 91.9%
associate-/l*99.8%
Simplified99.8%
clear-num99.6%
associate-/r/99.7%
clear-num99.7%
Applied egg-rr99.7%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= y 2.4e-8) (/ x z) (* (sin y) (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.4e-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.4d-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.4e-8) {
tmp = x / z;
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.4e-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.4e-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.4e-8) tmp = x / z; else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.4e-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.4 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 2.39999999999999998e-8Initial program 96.8%
associate-/l*96.4%
associate-/r/85.4%
associate-/l/79.5%
associate-/r/81.3%
associate-/r*82.3%
Simplified82.3%
Taylor expanded in y around 0 74.7%
if 2.39999999999999998e-8 < y Initial program 90.8%
associate-/l*90.3%
associate-/r/90.2%
associate-/l/90.9%
associate-/r/91.0%
associate-/r*90.3%
Simplified90.3%
Final simplification78.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y))) (if (<= x -2.9e+64) (/ (* 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 <= -2.9e+64) {
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 <= (-2.9d+64)) 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 <= -2.9e+64) {
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 <= -2.9e+64: 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 <= -2.9e+64) 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 <= -2.9e+64) 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[LessEqual[x, -2.9e+64], 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 -2.9 \cdot 10^{+64}:\\
\;\;\;\;\frac{x \cdot t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\end{array}
\end{array}
if x < -2.89999999999999993e64Initial program 99.6%
if -2.89999999999999993e64 < x Initial program 94.0%
*-commutative94.0%
associate-*r/97.9%
Simplified97.9%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (* (/ (sin y) y) (/ x z)))
double code(double x, double y, double z) {
return (sin(y) / 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 = (sin(y) / y) * (x / z)
end function
public static double code(double x, double y, double z) {
return (Math.sin(y) / y) * (x / z);
}
def code(x, y, z): return (math.sin(y) / y) * (x / z)
function code(x, y, z) return Float64(Float64(sin(y) / y) * Float64(x / z)) end
function tmp = code(x, y, z) tmp = (sin(y) / y) * (x / z); end
code[x_, y_, z_] := N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin y}{y} \cdot \frac{x}{z}
\end{array}
Initial program 95.3%
*-commutative95.3%
associate-*r/96.1%
Simplified96.1%
Final simplification96.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (* 6.0 (/ (/ x y) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
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 <= 2.5d0) 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 <= 2.5) {
tmp = x / z;
} else {
tmp = 6.0 * ((x / y) / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = 6.0 * ((x / y) / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) 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 <= 2.5) tmp = x / z; else tmp = 6.0 * ((x / y) / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], 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 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{\frac{x}{y}}{y \cdot z}\\
\end{array}
\end{array}
if y < 2.5Initial program 96.8%
associate-/l*96.4%
associate-/r/85.4%
associate-/l/79.5%
associate-/r/81.3%
associate-/r*82.3%
Simplified82.3%
Taylor expanded in y around 0 74.7%
if 2.5 < y Initial program 90.8%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in y around 0 32.4%
*-commutative32.4%
unpow232.4%
Simplified32.4%
Taylor expanded in y around inf 32.4%
unpow232.4%
associate-*r*32.4%
associate-/r*32.4%
*-commutative32.4%
Simplified32.4%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (* 6.0 (/ (/ (/ x y) y) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
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 <= 2.5d0) 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 <= 2.5) {
tmp = x / z;
} else {
tmp = 6.0 * (((x / y) / y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = 6.0 * (((x / y) / y) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(Float64(Float64(x / y) / y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = 6.0 * (((x / y) / y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(6.0 * N[(N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{\frac{\frac{x}{y}}{y}}{z}\\
\end{array}
\end{array}
if y < 2.5Initial program 96.8%
associate-/l*96.4%
associate-/r/85.4%
associate-/l/79.5%
associate-/r/81.3%
associate-/r*82.3%
Simplified82.3%
Taylor expanded in y around 0 74.7%
if 2.5 < y Initial program 90.8%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in y around 0 32.4%
*-commutative32.4%
unpow232.4%
Simplified32.4%
Taylor expanded in y around inf 32.4%
unpow232.4%
associate-*r*32.4%
associate-*r/32.4%
*-commutative32.4%
*-commutative32.4%
associate-*r*32.4%
Simplified32.4%
associate-*r*32.4%
times-frac32.4%
*-commutative32.4%
Applied egg-rr32.4%
Taylor expanded in y around 0 32.4%
associate-/r*32.5%
unpow232.5%
associate-/r*32.4%
Simplified32.4%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (* (/ x z) (/ 6.0 (* y y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (x / z) * (6.0 / (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.5d0) then
tmp = x / z
else
tmp = (x / z) * (6.0d0 / (y * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (x / z) * (6.0 / (y * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = (x / z) * (6.0 / (y * y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(Float64(x / z) * Float64(6.0 / Float64(y * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = (x / z) * (6.0 / (y * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(6.0 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{6}{y \cdot y}\\
\end{array}
\end{array}
if y < 2.5Initial program 96.8%
associate-/l*96.4%
associate-/r/85.4%
associate-/l/79.5%
associate-/r/81.3%
associate-/r*82.3%
Simplified82.3%
Taylor expanded in y around 0 74.7%
if 2.5 < y Initial program 90.8%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in y around 0 32.4%
*-commutative32.4%
unpow232.4%
Simplified32.4%
Taylor expanded in y around inf 32.4%
unpow232.4%
associate-*r*32.4%
associate-*r/32.4%
*-commutative32.4%
*-commutative32.4%
associate-*r*32.4%
Simplified32.4%
*-commutative32.4%
times-frac33.7%
Applied egg-rr33.7%
Final simplification64.3%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (* (/ x (* y z)) (/ 6.0 y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (x / (y * z)) * (6.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 <= 2.5d0) then
tmp = x / z
else
tmp = (x / (y * z)) * (6.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (x / (y * z)) * (6.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = (x / (y * z)) * (6.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(Float64(x / Float64(y * z)) * Float64(6.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = (x / (y * z)) * (6.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(6.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot z} \cdot \frac{6}{y}\\
\end{array}
\end{array}
if y < 2.5Initial program 96.8%
associate-/l*96.4%
associate-/r/85.4%
associate-/l/79.5%
associate-/r/81.3%
associate-/r*82.3%
Simplified82.3%
Taylor expanded in y around 0 74.7%
if 2.5 < y Initial program 90.8%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in y around 0 32.4%
*-commutative32.4%
unpow232.4%
Simplified32.4%
Taylor expanded in y around inf 32.4%
unpow232.4%
associate-*r*32.4%
associate-*r/32.4%
*-commutative32.4%
*-commutative32.4%
associate-*r*32.4%
Simplified32.4%
*-commutative32.4%
associate-*r*32.4%
times-frac33.8%
*-commutative33.8%
Applied egg-rr33.8%
Final simplification64.3%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (/ (/ 6.0 y) (* z (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (6.0 / y) / (z * (y / x));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.5d0) then
tmp = x / z
else
tmp = (6.0d0 / y) / (z * (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (6.0 / y) / (z * (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = (6.0 / y) / (z * (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(Float64(6.0 / y) / Float64(z * Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = (6.0 / y) / (z * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(N[(6.0 / y), $MachinePrecision] / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{6}{y}}{z \cdot \frac{y}{x}}\\
\end{array}
\end{array}
if y < 2.5Initial program 96.8%
associate-/l*96.4%
associate-/r/85.4%
associate-/l/79.5%
associate-/r/81.3%
associate-/r*82.3%
Simplified82.3%
Taylor expanded in y around 0 74.7%
if 2.5 < y Initial program 90.8%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in y around 0 32.4%
*-commutative32.4%
unpow232.4%
Simplified32.4%
Taylor expanded in y around inf 32.4%
unpow232.4%
associate-*r*32.4%
associate-*r/32.4%
*-commutative32.4%
*-commutative32.4%
associate-*r*32.4%
Simplified32.4%
associate-*r*32.4%
times-frac32.4%
*-commutative32.4%
Applied egg-rr32.4%
*-commutative32.4%
clear-num32.4%
associate-/r*32.4%
frac-times33.8%
*-un-lft-identity33.8%
Applied egg-rr33.8%
Final simplification64.3%
(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(Float64(y * 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[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z \cdot \left(1 + \left(y \cdot y\right) \cdot 0.16666666666666666\right)}
\end{array}
Initial program 95.3%
associate-/l*94.9%
Simplified94.9%
clear-num94.8%
associate-/r/94.8%
clear-num94.9%
Applied egg-rr94.9%
Taylor expanded in y around 0 66.0%
*-commutative66.0%
unpow266.0%
Simplified66.0%
Final simplification66.0%
(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 95.3%
associate-/l*94.9%
associate-/r/86.6%
associate-/l/82.4%
associate-/r/83.7%
associate-/r*84.3%
Simplified84.3%
Taylor expanded in y around 0 60.5%
Final simplification60.5%
(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 2023271
(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))