
(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 (<= x 1.95e+56) (/ 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 <= 1.95e+56) {
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 <= 1.95d+56) 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 <= 1.95e+56) {
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 <= 1.95e+56: 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 <= 1.95e+56) 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 <= 1.95e+56) 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, 1.95e+56], 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 1.95 \cdot 10^{+56}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t_0}{z}\\
\end{array}
\end{array}
if x < 1.94999999999999997e56Initial program 94.2%
associate-/l*99.4%
Simplified99.4%
if 1.94999999999999997e56 < x Initial program 99.8%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (<= y 2.6e-12) (/ x z) (* (sin y) (/ x (* z y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.6e-12) {
tmp = x / z;
} else {
tmp = sin(y) * (x / (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 <= 2.6d-12) then
tmp = x / z
else
tmp = sin(y) * (x / (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.6e-12) {
tmp = x / z;
} else {
tmp = Math.sin(y) * (x / (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.6e-12: tmp = x / z else: tmp = math.sin(y) * (x / (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.6e-12) tmp = Float64(x / z); else tmp = Float64(sin(y) * Float64(x / Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.6e-12) tmp = x / z; else tmp = sin(y) * (x / (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.6e-12], N[(x / z), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{-12}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{z \cdot y}\\
\end{array}
\end{array}
if y < 2.59999999999999983e-12Initial program 95.6%
associate-/l*98.2%
associate-/r/90.8%
associate-/l/82.3%
associate-/r/83.0%
associate-/r*84.0%
Simplified84.0%
Taylor expanded in y around 0 70.9%
if 2.59999999999999983e-12 < y Initial program 94.6%
associate-/l*94.0%
associate-/r/94.1%
associate-/l/94.9%
associate-/r/94.9%
associate-/r*94.0%
Simplified94.0%
Final simplification76.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y))) (if (<= z -5e+33) (* 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+33) {
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+33)) 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+33) {
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+33: 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+33) 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+33) 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[LessEqual[z, -5e+33], 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^{+33}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if z < -4.99999999999999973e33Initial program 99.9%
*-commutative99.9%
associate-*r/99.9%
Simplified99.9%
if -4.99999999999999973e33 < z Initial program 93.9%
associate-/l*98.6%
Simplified98.6%
Final simplification98.9%
(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.4%
*-commutative95.4%
associate-*r/96.1%
Simplified96.1%
Final simplification96.1%
(FPCore (x y z) :precision binary64 (if (<= y 350.0) (* (/ x z) (+ 1.0 (* (* y y) -0.16666666666666666))) (/ (/ 6.0 y) (/ y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 350.0) {
tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = (6.0 / 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 <= 350.0d0) then
tmp = (x / z) * (1.0d0 + ((y * y) * (-0.16666666666666666d0)))
else
tmp = (6.0d0 / y) / (y / (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 350.0) {
tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = (6.0 / y) / (y / (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 350.0: tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666)) else: tmp = (6.0 / y) / (y / (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 350.0) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666))); else tmp = Float64(Float64(6.0 / y) / Float64(y / Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 350.0) tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666)); else tmp = (6.0 / y) / (y / (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 350.0], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(6.0 / y), $MachinePrecision] / N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 350:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + \left(y \cdot y\right) \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{6}{y}}{\frac{y}{\frac{x}{z}}}\\
\end{array}
\end{array}
if y < 350Initial program 95.8%
*-commutative95.8%
associate-*r/97.5%
Simplified97.5%
Taylor expanded in y around 0 69.4%
unpow269.4%
Simplified69.4%
if 350 < y Initial program 94.1%
associate-/l*93.5%
Simplified93.5%
Taylor expanded in y around 0 30.3%
*-commutative30.3%
unpow230.3%
Simplified30.3%
Taylor expanded in y around inf 30.3%
unpow230.3%
associate-*r*30.3%
Simplified30.3%
associate-*r/30.3%
frac-times30.3%
clear-num30.3%
un-div-inv30.3%
*-commutative30.3%
Applied egg-rr30.3%
Taylor expanded in z around 0 30.3%
associate-/l*30.4%
Simplified30.4%
Final simplification60.2%
(FPCore (x y z) :precision binary64 (if (<= y 2.4) (/ x z) (* 6.0 (/ x (* y (* z y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.4) {
tmp = x / z;
} else {
tmp = 6.0 * (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 <= 2.4d0) then
tmp = x / z
else
tmp = 6.0d0 * (x / (y * (z * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.4) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (y * (z * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.4: tmp = x / z else: tmp = 6.0 * (x / (y * (z * y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.4) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(x / Float64(y * Float64(z * y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.4) tmp = x / z; else tmp = 6.0 * (x / (y * (z * y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.4], N[(x / z), $MachinePrecision], N[(6.0 * N[(x / N[(y * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{x}{y \cdot \left(z \cdot y\right)}\\
\end{array}
\end{array}
if y < 2.39999999999999991Initial program 95.8%
associate-/l*98.2%
associate-/r/91.1%
associate-/l/82.8%
associate-/r/83.6%
associate-/r*84.5%
Simplified84.5%
Taylor expanded in y around 0 71.4%
if 2.39999999999999991 < y Initial program 94.1%
associate-/l*93.5%
Simplified93.5%
Taylor expanded in y around 0 30.3%
*-commutative30.3%
unpow230.3%
Simplified30.3%
Taylor expanded in y around inf 30.3%
unpow230.3%
associate-*r*30.3%
Simplified30.3%
Final simplification61.8%
(FPCore (x y z) :precision binary64 (if (<= y 2.4) (/ x z) (* 6.0 (/ (/ x z) (* y y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.4) {
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.4d0) 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.4) {
tmp = x / z;
} else {
tmp = 6.0 * ((x / z) / (y * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.4: tmp = x / z else: tmp = 6.0 * ((x / z) / (y * y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.4) 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.4) tmp = x / z; else tmp = 6.0 * ((x / z) / (y * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.4], 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.4:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{\frac{x}{z}}{y \cdot y}\\
\end{array}
\end{array}
if y < 2.39999999999999991Initial program 95.8%
associate-/l*98.2%
associate-/r/91.1%
associate-/l/82.8%
associate-/r/83.6%
associate-/r*84.5%
Simplified84.5%
Taylor expanded in y around 0 71.4%
if 2.39999999999999991 < y Initial program 94.1%
associate-/l*93.5%
Simplified93.5%
Taylor expanded in y around 0 30.3%
*-commutative30.3%
unpow230.3%
Simplified30.3%
Taylor expanded in y around inf 30.3%
unpow230.3%
associate-*r*30.3%
Simplified30.3%
Taylor expanded in x around 0 30.3%
unpow230.3%
*-commutative30.3%
associate-/r*30.1%
Simplified30.1%
Final simplification61.7%
(FPCore (x y z) :precision binary64 (if (<= y 2.4) (/ x z) (* (/ x (* z y)) (/ 6.0 y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.4) {
tmp = x / z;
} else {
tmp = (x / (z * y)) * (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.4d0) then
tmp = x / z
else
tmp = (x / (z * y)) * (6.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.4) {
tmp = x / z;
} else {
tmp = (x / (z * y)) * (6.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.4: tmp = x / z else: tmp = (x / (z * y)) * (6.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.4) tmp = Float64(x / z); else tmp = Float64(Float64(x / Float64(z * y)) * Float64(6.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.4) tmp = x / z; else tmp = (x / (z * y)) * (6.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.4], N[(x / z), $MachinePrecision], N[(N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision] * N[(6.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot y} \cdot \frac{6}{y}\\
\end{array}
\end{array}
if y < 2.39999999999999991Initial program 95.8%
associate-/l*98.2%
associate-/r/91.1%
associate-/l/82.8%
associate-/r/83.6%
associate-/r*84.5%
Simplified84.5%
Taylor expanded in y around 0 71.4%
if 2.39999999999999991 < y Initial program 94.1%
associate-/l*93.5%
Simplified93.5%
Taylor expanded in y around 0 30.3%
*-commutative30.3%
unpow230.3%
Simplified30.3%
Taylor expanded in y around inf 30.3%
unpow230.3%
associate-*r*30.3%
associate-*r/30.3%
times-frac30.3%
Simplified30.3%
Final simplification61.8%
(FPCore (x y z) :precision binary64 (if (<= y 2.4) (/ x z) (/ (/ 6.0 y) (/ y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.4) {
tmp = x / z;
} else {
tmp = (6.0 / 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 <= 2.4d0) then
tmp = x / z
else
tmp = (6.0d0 / y) / (y / (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.4) {
tmp = x / z;
} else {
tmp = (6.0 / y) / (y / (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.4: tmp = x / z else: tmp = (6.0 / y) / (y / (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.4) tmp = Float64(x / z); else tmp = Float64(Float64(6.0 / y) / Float64(y / Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.4) tmp = x / z; else tmp = (6.0 / y) / (y / (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.4], N[(x / z), $MachinePrecision], N[(N[(6.0 / y), $MachinePrecision] / N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{6}{y}}{\frac{y}{\frac{x}{z}}}\\
\end{array}
\end{array}
if y < 2.39999999999999991Initial program 95.8%
associate-/l*98.2%
associate-/r/91.1%
associate-/l/82.8%
associate-/r/83.6%
associate-/r*84.5%
Simplified84.5%
Taylor expanded in y around 0 71.4%
if 2.39999999999999991 < y Initial program 94.1%
associate-/l*93.5%
Simplified93.5%
Taylor expanded in y around 0 30.3%
*-commutative30.3%
unpow230.3%
Simplified30.3%
Taylor expanded in y around inf 30.3%
unpow230.3%
associate-*r*30.3%
Simplified30.3%
associate-*r/30.3%
frac-times30.3%
clear-num30.3%
un-div-inv30.3%
*-commutative30.3%
Applied egg-rr30.3%
Taylor expanded in z around 0 30.3%
associate-/l*30.4%
Simplified30.4%
Final simplification61.8%
(FPCore (x y z) :precision binary64 (/ x (+ z (* 0.16666666666666666 (* z (* y y))))))
double code(double x, double y, double z) {
return x / (z + (0.16666666666666666 * (z * (y * y))));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x / (z + (0.16666666666666666d0 * (z * (y * y))))
end function
public static double code(double x, double y, double z) {
return x / (z + (0.16666666666666666 * (z * (y * y))));
}
def code(x, y, z): return x / (z + (0.16666666666666666 * (z * (y * y))))
function code(x, y, z) return Float64(x / Float64(z + Float64(0.16666666666666666 * Float64(z * Float64(y * y))))) end
function tmp = code(x, y, z) tmp = x / (z + (0.16666666666666666 * (z * (y * y)))); end
code[x_, y_, z_] := N[(x / N[(z + N[(0.16666666666666666 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z + 0.16666666666666666 \cdot \left(z \cdot \left(y \cdot y\right)\right)}
\end{array}
Initial program 95.4%
associate-/l*97.1%
Simplified97.1%
Taylor expanded in y around 0 68.1%
*-commutative68.1%
unpow268.1%
Simplified68.1%
Final simplification68.1%
(FPCore (x y z) :precision binary64 (/ x (+ z (* y (* (* z y) 0.16666666666666666)))))
double code(double x, double y, double z) {
return x / (z + (y * ((z * 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 + (y * ((z * y) * 0.16666666666666666d0)))
end function
public static double code(double x, double y, double z) {
return x / (z + (y * ((z * y) * 0.16666666666666666)));
}
def code(x, y, z): return x / (z + (y * ((z * y) * 0.16666666666666666)))
function code(x, y, z) return Float64(x / Float64(z + Float64(y * Float64(Float64(z * y) * 0.16666666666666666)))) end
function tmp = code(x, y, z) tmp = x / (z + (y * ((z * y) * 0.16666666666666666))); end
code[x_, y_, z_] := N[(x / N[(z + N[(y * N[(N[(z * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z + y \cdot \left(\left(z \cdot y\right) \cdot 0.16666666666666666\right)}
\end{array}
Initial program 95.4%
associate-/l*97.1%
Simplified97.1%
Taylor expanded in y around 0 68.1%
*-commutative68.1%
unpow268.1%
Simplified68.1%
Taylor expanded in z around 0 68.1%
unpow268.1%
associate-*r*68.1%
*-commutative68.1%
associate-*l*68.1%
Simplified68.1%
Final simplification68.1%
(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.4%
associate-/l*97.1%
associate-/r/91.6%
associate-/l/85.5%
associate-/r/86.1%
associate-/r*86.6%
Simplified86.6%
Taylor expanded in y around 0 58.2%
Final simplification58.2%
(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 2023285
(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))