
(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 (if (<= x 1e-14) (/ x (/ z (/ (sin y) y))) (/ (/ (* x (sin y)) y) z)))
double code(double x, double y, double z) {
double tmp;
if (x <= 1e-14) {
tmp = x / (z / (sin(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 (x <= 1d-14) then
tmp = x / (z / (sin(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 (x <= 1e-14) {
tmp = x / (z / (Math.sin(y) / y));
} else {
tmp = ((x * Math.sin(y)) / y) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1e-14: tmp = x / (z / (math.sin(y) / y)) else: tmp = ((x * math.sin(y)) / y) / z return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1e-14) tmp = Float64(x / Float64(z / Float64(sin(y) / y))); else tmp = Float64(Float64(Float64(x * sin(y)) / y) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1e-14) tmp = x / (z / (sin(y) / y)); else tmp = ((x * sin(y)) / y) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1e-14], N[(x / N[(z / N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-14}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\
\end{array}
\end{array}
if x < 9.99999999999999999e-15Initial program 96.2%
associate-/l*98.6%
Simplified98.6%
if 9.99999999999999999e-15 < x Initial program 99.5%
clear-num98.1%
associate-/r/99.5%
Applied egg-rr99.5%
*-commutative99.5%
associate-*l/99.5%
*-un-lft-identity99.5%
associate-*l/99.6%
Applied egg-rr99.6%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y))) (if (<= z 5e-49) (* 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 (z <= 5e-49) {
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 (z <= 5d-49) 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 (z <= 5e-49) {
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 z <= 5e-49: 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 (z <= 5e-49) tmp = Float64(x * Float64(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 (z <= 5e-49) 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[z, 5e-49], N[(x * N[(t$95$0 / 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}\;z \leq 5 \cdot 10^{-49}:\\
\;\;\;\;x \cdot \frac{t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < 4.9999999999999999e-49Initial program 95.9%
associate-*r/97.9%
Simplified97.9%
if 4.9999999999999999e-49 < z Initial program 99.7%
associate-*l/99.7%
*-commutative99.7%
Simplified99.7%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y))) (if (<= z 4e+42) (/ x (/ z t_0)) (* t_0 (/ x z)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if (z <= 4e+42) {
tmp = x / (z / t_0);
} 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 (z <= 4d+42) then
tmp = x / (z / t_0)
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 (z <= 4e+42) {
tmp = x / (z / t_0);
} else {
tmp = t_0 * (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y tmp = 0 if z <= 4e+42: tmp = x / (z / t_0) else: tmp = t_0 * (x / z) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) tmp = 0.0 if (z <= 4e+42) tmp = Float64(x / Float64(z / t_0)); 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 (z <= 4e+42) tmp = x / (z / t_0); 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[z, 4e+42], N[(x / N[(z / t$95$0), $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}\;z \leq 4 \cdot 10^{+42}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < 4.00000000000000018e42Initial program 96.3%
associate-/l*98.1%
Simplified98.1%
if 4.00000000000000018e42 < z Initial program 99.8%
associate-*l/99.7%
*-commutative99.7%
Simplified99.7%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y))) (if (<= x 5.5e-61) (/ x (/ z t_0)) (/ (* x t_0) z))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if (x <= 5.5e-61) {
tmp = x / (z / t_0);
} else {
tmp = (x * t_0) / 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 <= 5.5d-61) then
tmp = x / (z / t_0)
else
tmp = (x * t_0) / 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 <= 5.5e-61) {
tmp = x / (z / t_0);
} else {
tmp = (x * t_0) / z;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y tmp = 0 if x <= 5.5e-61: tmp = x / (z / t_0) else: tmp = (x * t_0) / z return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) tmp = 0.0 if (x <= 5.5e-61) tmp = Float64(x / Float64(z / t_0)); else tmp = Float64(Float64(x * t_0) / z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) / y; tmp = 0.0; if (x <= 5.5e-61) tmp = x / (z / t_0); else tmp = (x * t_0) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, 5.5e-61], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x * t$95$0), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;x \leq 5.5 \cdot 10^{-61}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t_0}{z}\\
\end{array}
\end{array}
if x < 5.4999999999999997e-61Initial program 96.0%
associate-/l*98.5%
Simplified98.5%
if 5.4999999999999997e-61 < x Initial program 99.5%
Final simplification98.8%
(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(x * Float64(Float64(sin(y) / y) / z)) end
function tmp = code(x, y, z) tmp = x * ((sin(y) / y) / z); end
code[x_, y_, z_] := N[(x * N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{\frac{\sin y}{y}}{z}
\end{array}
Initial program 97.1%
associate-*r/95.6%
Simplified95.6%
Final simplification95.6%
(FPCore (x y z) :precision binary64 (if (<= y 4.5e+79) (/ x z) (* (- y) (/ (/ x y) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.5e+79) {
tmp = x / z;
} else {
tmp = -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 <= 4.5d+79) then
tmp = x / z
else
tmp = -y * ((x / y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4.5e+79) {
tmp = x / z;
} else {
tmp = -y * ((x / y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4.5e+79: tmp = x / z else: tmp = -y * ((x / y) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4.5e+79) tmp = Float64(x / z); else tmp = Float64(Float64(-y) * Float64(Float64(x / y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4.5e+79) tmp = x / z; else tmp = -y * ((x / y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4.5e+79], N[(x / z), $MachinePrecision], N[((-y) * N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{+79}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot \frac{\frac{x}{y}}{z}\\
\end{array}
\end{array}
if y < 4.49999999999999994e79Initial program 98.8%
Taylor expanded in y around 0 66.8%
if 4.49999999999999994e79 < y Initial program 90.9%
associate-*r/92.9%
associate-/l/92.8%
associate-/r*92.9%
Simplified92.9%
Taylor expanded in y around 0 13.0%
associate-/l/25.5%
div-inv25.5%
Applied egg-rr25.5%
*-commutative25.5%
un-div-inv25.5%
*-commutative25.5%
associate-/r*13.0%
add-sqr-sqrt13.0%
sqrt-unprod6.5%
sqr-neg6.5%
sqrt-unprod0.0%
add-sqr-sqrt14.1%
add-sqr-sqrt14.1%
sqrt-unprod31.4%
sqr-neg31.4%
sqrt-unprod0.0%
add-sqr-sqrt13.0%
associate-/r/23.0%
associate-/l/35.2%
add-sqr-sqrt0.0%
sqrt-unprod8.5%
sqr-neg8.5%
sqrt-unprod36.3%
add-sqr-sqrt36.3%
Applied egg-rr35.2%
frac-2neg35.2%
distribute-rgt-neg-out35.2%
div-inv35.2%
associate-/r*35.2%
clear-num35.2%
add-sqr-sqrt19.3%
sqrt-unprod36.3%
sqr-neg36.3%
sqrt-unprod17.4%
add-sqr-sqrt36.3%
Applied egg-rr36.3%
Final simplification60.2%
(FPCore (x y z) :precision binary64 (if (<= y 4.3e+79) (/ x z) (/ y (* (/ y x) (- z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.3e+79) {
tmp = x / z;
} else {
tmp = y / ((y / x) * -z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 4.3d+79) then
tmp = x / z
else
tmp = y / ((y / x) * -z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4.3e+79) {
tmp = x / z;
} else {
tmp = y / ((y / x) * -z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4.3e+79: tmp = x / z else: tmp = y / ((y / x) * -z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4.3e+79) tmp = Float64(x / z); else tmp = Float64(y / Float64(Float64(y / x) * Float64(-z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4.3e+79) tmp = x / z; else tmp = y / ((y / x) * -z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4.3e+79], N[(x / z), $MachinePrecision], N[(y / N[(N[(y / x), $MachinePrecision] * (-z)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{+79}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{y}{x} \cdot \left(-z\right)}\\
\end{array}
\end{array}
if y < 4.3000000000000003e79Initial program 98.8%
Taylor expanded in y around 0 66.8%
if 4.3000000000000003e79 < y Initial program 90.9%
associate-*r/92.9%
associate-/l/92.8%
associate-/r*92.9%
Simplified92.9%
Taylor expanded in y around 0 13.0%
associate-/l/25.5%
div-inv25.5%
Applied egg-rr25.5%
*-commutative25.5%
un-div-inv25.5%
*-commutative25.5%
associate-/r*13.0%
add-sqr-sqrt13.0%
sqrt-unprod6.5%
sqr-neg6.5%
sqrt-unprod0.0%
add-sqr-sqrt14.1%
add-sqr-sqrt14.1%
sqrt-unprod31.4%
sqr-neg31.4%
sqrt-unprod0.0%
add-sqr-sqrt13.0%
associate-/r/23.0%
distribute-frac-neg23.0%
frac-2neg23.0%
distribute-frac-neg23.0%
remove-double-neg23.0%
associate-/l/35.2%
Applied egg-rr36.3%
Final simplification60.2%
(FPCore (x y z) :precision binary64 (if (<= y 0.5) (/ x z) (* x (/ y (* z y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.5) {
tmp = x / z;
} else {
tmp = x * (y / (z * 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 <= 0.5d0) then
tmp = x / z
else
tmp = x * (y / (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.5) {
tmp = x / z;
} else {
tmp = x * (y / (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.5: tmp = x / z else: tmp = x * (y / (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.5) tmp = Float64(x / z); else tmp = Float64(x * Float64(y / Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.5) tmp = x / z; else tmp = x * (y / (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.5], N[(x / z), $MachinePrecision], N[(x * N[(y / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z \cdot y}\\
\end{array}
\end{array}
if y < 0.5Initial program 98.6%
Taylor expanded in y around 0 69.9%
if 0.5 < y Initial program 93.3%
associate-*r/94.7%
associate-/l/94.7%
associate-/r*94.7%
Simplified94.7%
Taylor expanded in y around 0 19.8%
*-commutative19.8%
frac-2neg19.8%
associate-*l/19.7%
distribute-neg-frac19.7%
Applied egg-rr19.7%
associate-/l*27.2%
associate-/r/19.8%
add-sqr-sqrt0.0%
sqrt-unprod9.2%
sqr-neg9.2%
sqrt-unprod13.9%
add-sqr-sqrt13.9%
add-sqr-sqrt0.0%
sqrt-unprod30.9%
sqr-neg30.9%
sqrt-unprod19.8%
add-sqr-sqrt19.8%
associate-/r*29.0%
*-commutative29.0%
Applied egg-rr29.0%
Final simplification57.9%
(FPCore (x y z) :precision binary64 (if (<= y 2e+28) (/ x z) (* y (/ (/ x y) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e+28) {
tmp = x / z;
} else {
tmp = 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 <= 2d+28) then
tmp = x / z
else
tmp = y * ((x / y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e+28) {
tmp = x / z;
} else {
tmp = y * ((x / y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e+28: tmp = x / z else: tmp = y * ((x / y) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e+28) tmp = Float64(x / z); else tmp = Float64(y * Float64(Float64(x / y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e+28) tmp = x / z; else tmp = y * ((x / y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e+28], N[(x / z), $MachinePrecision], N[(y * N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+28}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{x}{y}}{z}\\
\end{array}
\end{array}
if y < 1.99999999999999992e28Initial program 98.7%
Taylor expanded in y around 0 69.1%
if 1.99999999999999992e28 < y Initial program 92.6%
associate-*r/94.2%
associate-/l/94.1%
associate-/r*94.2%
Simplified94.2%
Taylor expanded in y around 0 17.0%
associate-/l/27.1%
div-inv27.1%
Applied egg-rr27.1%
*-commutative27.1%
un-div-inv27.1%
*-commutative27.1%
associate-/r*17.0%
add-sqr-sqrt17.0%
sqrt-unprod11.8%
sqr-neg11.8%
sqrt-unprod0.0%
add-sqr-sqrt15.0%
add-sqr-sqrt15.0%
sqrt-unprod29.0%
sqr-neg29.0%
sqrt-unprod0.0%
add-sqr-sqrt17.0%
associate-/r/25.2%
associate-/l/35.0%
add-sqr-sqrt0.0%
sqrt-unprod10.5%
sqr-neg10.5%
sqrt-unprod33.0%
add-sqr-sqrt33.0%
Applied egg-rr35.0%
associate-/r*28.5%
add-sqr-sqrt10.6%
sqrt-unprod33.3%
sqr-neg33.3%
sqrt-unprod16.5%
add-sqr-sqrt26.5%
associate-/r*33.0%
div-inv33.0%
*-commutative33.0%
associate-/r*33.0%
clear-num33.0%
add-sqr-sqrt18.8%
sqrt-unprod33.3%
sqr-neg33.3%
sqrt-unprod14.7%
add-sqr-sqrt35.0%
Applied egg-rr35.0%
Final simplification60.0%
(FPCore (x y z) :precision binary64 (if (<= y 3e+30) (/ x z) (/ y (* z (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3e+30) {
tmp = x / z;
} else {
tmp = 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 <= 3d+30) then
tmp = x / z
else
tmp = y / (z * (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3e+30) {
tmp = x / z;
} else {
tmp = y / (z * (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3e+30: tmp = x / z else: tmp = y / (z * (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3e+30) tmp = Float64(x / z); else tmp = Float64(y / Float64(z * Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3e+30) tmp = x / z; else tmp = y / (z * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3e+30], N[(x / z), $MachinePrecision], N[(y / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{+30}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\
\end{array}
\end{array}
if y < 2.99999999999999978e30Initial program 98.7%
Taylor expanded in y around 0 68.7%
if 2.99999999999999978e30 < y Initial program 92.5%
associate-*r/94.1%
associate-/l/94.0%
associate-/r*94.1%
Simplified94.1%
Taylor expanded in y around 0 17.3%
associate-/l/27.5%
div-inv27.5%
Applied egg-rr27.5%
*-commutative27.5%
un-div-inv27.5%
*-commutative27.5%
associate-/r*17.3%
add-sqr-sqrt17.3%
sqrt-unprod12.0%
sqr-neg12.0%
sqrt-unprod0.0%
add-sqr-sqrt15.1%
add-sqr-sqrt15.1%
sqrt-unprod29.3%
sqr-neg29.3%
sqrt-unprod0.0%
add-sqr-sqrt17.3%
associate-/r/25.5%
associate-/l/35.5%
add-sqr-sqrt0.0%
sqrt-unprod10.5%
sqr-neg10.5%
sqrt-unprod33.3%
add-sqr-sqrt33.3%
Applied egg-rr35.5%
Final simplification60.0%
(FPCore (x y z) :precision binary64 (if (<= y 2e+28) (/ x z) (/ y (/ (* z y) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e+28) {
tmp = x / z;
} else {
tmp = 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 <= 2d+28) then
tmp = x / z
else
tmp = y / ((z * y) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e+28) {
tmp = x / z;
} else {
tmp = y / ((z * y) / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e+28: tmp = x / z else: tmp = y / ((z * y) / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e+28) tmp = Float64(x / z); else tmp = Float64(y / Float64(Float64(z * y) / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e+28) tmp = x / z; else tmp = y / ((z * y) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e+28], N[(x / z), $MachinePrecision], N[(y / N[(N[(z * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+28}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z \cdot y}{x}}\\
\end{array}
\end{array}
if y < 1.99999999999999992e28Initial program 98.7%
Taylor expanded in y around 0 69.1%
if 1.99999999999999992e28 < y Initial program 92.6%
associate-*r/94.2%
Simplified94.2%
*-commutative94.2%
associate-/l/94.1%
associate-*l/94.1%
*-commutative94.1%
associate-/l*94.1%
Applied egg-rr94.1%
Taylor expanded in y around 0 35.0%
Final simplification60.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 97.1%
Taylor expanded in y around 0 55.3%
Final simplification55.3%
(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 2023318
(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))