
(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 (<= t_0 5e-184) (* (/ (sin y) z) (/ x y)) (/ x (/ z t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if (t_0 <= 5e-184) {
tmp = (sin(y) / z) * (x / y);
} 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 (t_0 <= 5d-184) then
tmp = (sin(y) / z) * (x / y)
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 (t_0 <= 5e-184) {
tmp = (Math.sin(y) / z) * (x / y);
} else {
tmp = x / (z / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y tmp = 0 if t_0 <= 5e-184: tmp = (math.sin(y) / z) * (x / y) else: tmp = x / (z / t_0) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) tmp = 0.0 if (t_0 <= 5e-184) tmp = Float64(Float64(sin(y) / z) * Float64(x / y)); 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 (t_0 <= 5e-184) tmp = (sin(y) / z) * (x / y); 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[t$95$0, 5e-184], N[(N[(N[Sin[y], $MachinePrecision] / z), $MachinePrecision] * N[(x / y), $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}\;t_0 \leq 5 \cdot 10^{-184}:\\
\;\;\;\;\frac{\sin y}{z} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 y) y) < 5.00000000000000003e-184Initial program 96.6%
associate-*r/96.6%
associate-/l/91.3%
*-commutative91.3%
times-frac96.6%
Simplified96.6%
if 5.00000000000000003e-184 < (/.f64 (sin.f64 y) y) Initial program 98.7%
associate-/l*99.9%
Simplified99.9%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.0004) (not (<= y 5e-5))) (* (sin y) (/ x (* y z))) (/ (* x (+ 1.0 (* -0.16666666666666666 (* y y)))) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0004) || !(y <= 5e-5)) {
tmp = sin(y) * (x / (y * z));
} else {
tmp = (x * (1.0 + (-0.16666666666666666 * (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 <= (-0.0004d0)) .or. (.not. (y <= 5d-5))) then
tmp = sin(y) * (x / (y * z))
else
tmp = (x * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0004) || !(y <= 5e-5)) {
tmp = Math.sin(y) * (x / (y * z));
} else {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.0004) or not (y <= 5e-5): tmp = math.sin(y) * (x / (y * z)) else: tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.0004) || !(y <= 5e-5)) tmp = Float64(sin(y) * Float64(x / Float64(y * z))); else tmp = Float64(Float64(x * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.0004) || ~((y <= 5e-5))) tmp = sin(y) * (x / (y * z)); else tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.0004], N[Not[LessEqual[y, 5e-5]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0004 \lor \neg \left(y \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)}{z}\\
\end{array}
\end{array}
if y < -4.00000000000000019e-4 or 5.00000000000000024e-5 < y Initial program 96.2%
associate-*l/87.6%
times-frac94.0%
*-commutative94.0%
associate-*r/94.1%
*-commutative94.1%
Simplified94.1%
if -4.00000000000000019e-4 < y < 5.00000000000000024e-5Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Final simplification96.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -5e-8) (not (<= y 2.45e-8))) (* (/ (sin y) z) (/ x y)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5e-8) || !(y <= 2.45e-8)) {
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 <= (-5d-8)) .or. (.not. (y <= 2.45d-8))) 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 <= -5e-8) || !(y <= 2.45e-8)) {
tmp = (Math.sin(y) / z) * (x / y);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5e-8) or not (y <= 2.45e-8): tmp = (math.sin(y) / z) * (x / y) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5e-8) || !(y <= 2.45e-8)) 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 <= -5e-8) || ~((y <= 2.45e-8))) tmp = (sin(y) / z) * (x / y); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5e-8], N[Not[LessEqual[y, 2.45e-8]], $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 -5 \cdot 10^{-8} \lor \neg \left(y \leq 2.45 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{\sin y}{z} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -4.9999999999999998e-8 or 2.4500000000000001e-8 < y Initial program 96.2%
associate-*r/96.2%
associate-/l/94.1%
*-commutative94.1%
times-frac96.2%
Simplified96.2%
if -4.9999999999999998e-8 < y < 2.4500000000000001e-8Initial program 100.0%
Taylor expanded in y around 0 100.0%
Final simplification97.9%
(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 97.9%
Final simplification97.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (* z 0.16666666666666666))))
(if (<= y -12.5)
(/ 1.0 (* y (/ t_0 x)))
(if (<= y 390000000.0)
(/ x (/ z (+ 1.0 (* -0.16666666666666666 (* y y)))))
(/ (/ x t_0) y)))))
double code(double x, double y, double z) {
double t_0 = y * (z * 0.16666666666666666);
double tmp;
if (y <= -12.5) {
tmp = 1.0 / (y * (t_0 / x));
} else if (y <= 390000000.0) {
tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y))));
} else {
tmp = (x / t_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) :: t_0
real(8) :: tmp
t_0 = y * (z * 0.16666666666666666d0)
if (y <= (-12.5d0)) then
tmp = 1.0d0 / (y * (t_0 / x))
else if (y <= 390000000.0d0) then
tmp = x / (z / (1.0d0 + ((-0.16666666666666666d0) * (y * y))))
else
tmp = (x / t_0) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (z * 0.16666666666666666);
double tmp;
if (y <= -12.5) {
tmp = 1.0 / (y * (t_0 / x));
} else if (y <= 390000000.0) {
tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y))));
} else {
tmp = (x / t_0) / y;
}
return tmp;
}
def code(x, y, z): t_0 = y * (z * 0.16666666666666666) tmp = 0 if y <= -12.5: tmp = 1.0 / (y * (t_0 / x)) elif y <= 390000000.0: tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y)))) else: tmp = (x / t_0) / y return tmp
function code(x, y, z) t_0 = Float64(y * Float64(z * 0.16666666666666666)) tmp = 0.0 if (y <= -12.5) tmp = Float64(1.0 / Float64(y * Float64(t_0 / x))); elseif (y <= 390000000.0) tmp = Float64(x / Float64(z / Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))))); else tmp = Float64(Float64(x / t_0) / y); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (z * 0.16666666666666666); tmp = 0.0; if (y <= -12.5) tmp = 1.0 / (y * (t_0 / x)); elseif (y <= 390000000.0) tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y)))); else tmp = (x / t_0) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -12.5], N[(1.0 / N[(y * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 390000000.0], N[(x / N[(z / N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / t$95$0), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(z \cdot 0.16666666666666666\right)\\
\mathbf{if}\;y \leq -12.5:\\
\;\;\;\;\frac{1}{y \cdot \frac{t_0}{x}}\\
\mathbf{elif}\;y \leq 390000000:\\
\;\;\;\;\frac{x}{\frac{z}{1 + -0.16666666666666666 \cdot \left(y \cdot y\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t_0}}{y}\\
\end{array}
\end{array}
if y < -12.5Initial program 96.3%
associate-/l*93.0%
associate-/r/92.9%
Simplified92.9%
Taylor expanded in y around 0 30.1%
Taylor expanded in y around inf 30.1%
associate-*r/30.1%
*-commutative30.1%
times-frac30.1%
unpow230.1%
associate-/r*30.1%
Simplified30.1%
associate-*r/30.1%
div-inv30.1%
associate-*l*30.1%
metadata-eval30.1%
times-frac30.2%
*-un-lft-identity30.2%
*-commutative30.2%
times-frac30.2%
*-un-lft-identity30.2%
*-commutative30.2%
associate-/r*30.1%
clear-num30.1%
*-commutative30.1%
*-un-lft-identity30.1%
times-frac30.2%
/-rgt-identity30.2%
associate-*l*30.2%
Applied egg-rr30.2%
if -12.5 < y < 3.9e8Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 98.5%
unpow298.5%
Simplified98.5%
if 3.9e8 < y Initial program 96.0%
associate-/l*94.6%
associate-/r/94.6%
Simplified94.6%
Taylor expanded in y around 0 35.7%
Taylor expanded in y around inf 35.6%
associate-*r/35.6%
*-commutative35.6%
times-frac35.5%
unpow235.5%
associate-/r*35.6%
Simplified35.6%
associate-*r/38.0%
div-inv38.0%
associate-*l*38.0%
metadata-eval38.0%
times-frac38.0%
*-un-lft-identity38.0%
*-commutative38.0%
times-frac38.0%
*-un-lft-identity38.0%
*-commutative38.0%
associate-*l*38.0%
Applied egg-rr38.0%
Final simplification64.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (* z 0.16666666666666666))))
(if (<= y -12.5)
(/ 1.0 (* y (/ t_0 x)))
(if (<= y 390000000.0)
(/ (* x (+ 1.0 (* -0.16666666666666666 (* y y)))) z)
(/ (/ x t_0) y)))))
double code(double x, double y, double z) {
double t_0 = y * (z * 0.16666666666666666);
double tmp;
if (y <= -12.5) {
tmp = 1.0 / (y * (t_0 / x));
} else if (y <= 390000000.0) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = (x / t_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) :: t_0
real(8) :: tmp
t_0 = y * (z * 0.16666666666666666d0)
if (y <= (-12.5d0)) then
tmp = 1.0d0 / (y * (t_0 / x))
else if (y <= 390000000.0d0) then
tmp = (x * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))) / z
else
tmp = (x / t_0) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (z * 0.16666666666666666);
double tmp;
if (y <= -12.5) {
tmp = 1.0 / (y * (t_0 / x));
} else if (y <= 390000000.0) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = (x / t_0) / y;
}
return tmp;
}
def code(x, y, z): t_0 = y * (z * 0.16666666666666666) tmp = 0 if y <= -12.5: tmp = 1.0 / (y * (t_0 / x)) elif y <= 390000000.0: tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z else: tmp = (x / t_0) / y return tmp
function code(x, y, z) t_0 = Float64(y * Float64(z * 0.16666666666666666)) tmp = 0.0 if (y <= -12.5) tmp = Float64(1.0 / Float64(y * Float64(t_0 / x))); elseif (y <= 390000000.0) tmp = Float64(Float64(x * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))) / z); else tmp = Float64(Float64(x / t_0) / y); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (z * 0.16666666666666666); tmp = 0.0; if (y <= -12.5) tmp = 1.0 / (y * (t_0 / x)); elseif (y <= 390000000.0) tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z; else tmp = (x / t_0) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -12.5], N[(1.0 / N[(y * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 390000000.0], N[(N[(x * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / t$95$0), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(z \cdot 0.16666666666666666\right)\\
\mathbf{if}\;y \leq -12.5:\\
\;\;\;\;\frac{1}{y \cdot \frac{t_0}{x}}\\
\mathbf{elif}\;y \leq 390000000:\\
\;\;\;\;\frac{x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t_0}}{y}\\
\end{array}
\end{array}
if y < -12.5Initial program 96.3%
associate-/l*93.0%
associate-/r/92.9%
Simplified92.9%
Taylor expanded in y around 0 30.1%
Taylor expanded in y around inf 30.1%
associate-*r/30.1%
*-commutative30.1%
times-frac30.1%
unpow230.1%
associate-/r*30.1%
Simplified30.1%
associate-*r/30.1%
div-inv30.1%
associate-*l*30.1%
metadata-eval30.1%
times-frac30.2%
*-un-lft-identity30.2%
*-commutative30.2%
times-frac30.2%
*-un-lft-identity30.2%
*-commutative30.2%
associate-/r*30.1%
clear-num30.1%
*-commutative30.1%
*-un-lft-identity30.1%
times-frac30.2%
/-rgt-identity30.2%
associate-*l*30.2%
Applied egg-rr30.2%
if -12.5 < y < 3.9e8Initial program 100.0%
Taylor expanded in y around 0 98.5%
unpow298.5%
Simplified98.5%
if 3.9e8 < y Initial program 96.0%
associate-/l*94.6%
associate-/r/94.6%
Simplified94.6%
Taylor expanded in y around 0 35.7%
Taylor expanded in y around inf 35.6%
associate-*r/35.6%
*-commutative35.6%
times-frac35.5%
unpow235.5%
associate-/r*35.6%
Simplified35.6%
associate-*r/38.0%
div-inv38.0%
associate-*l*38.0%
metadata-eval38.0%
times-frac38.0%
*-un-lft-identity38.0%
*-commutative38.0%
times-frac38.0%
*-un-lft-identity38.0%
*-commutative38.0%
associate-*l*38.0%
Applied egg-rr38.0%
Final simplification64.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.4) (not (<= y 2.4))) (/ (/ x (* y (* z 0.16666666666666666))) y) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4) || !(y <= 2.4)) {
tmp = (x / (y * (z * 0.16666666666666666))) / 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.4d0)) .or. (.not. (y <= 2.4d0))) then
tmp = (x / (y * (z * 0.16666666666666666d0))) / 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.4) || !(y <= 2.4)) {
tmp = (x / (y * (z * 0.16666666666666666))) / y;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.4) or not (y <= 2.4): tmp = (x / (y * (z * 0.16666666666666666))) / y else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.4) || !(y <= 2.4)) tmp = Float64(Float64(x / Float64(y * Float64(z * 0.16666666666666666))) / y); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.4) || ~((y <= 2.4))) tmp = (x / (y * (z * 0.16666666666666666))) / y; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.4], N[Not[LessEqual[y, 2.4]], $MachinePrecision]], N[(N[(x / N[(y * N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \lor \neg \left(y \leq 2.4\right):\\
\;\;\;\;\frac{\frac{x}{y \cdot \left(z \cdot 0.16666666666666666\right)}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -2.39999999999999991 or 2.39999999999999991 < y Initial program 96.2%
associate-/l*94.1%
associate-/r/94.0%
Simplified94.0%
Taylor expanded in y around 0 32.7%
Taylor expanded in y around inf 32.7%
associate-*r/32.7%
*-commutative32.7%
times-frac32.6%
unpow232.6%
associate-/r*32.7%
Simplified32.7%
associate-*r/34.0%
div-inv34.0%
associate-*l*34.0%
metadata-eval34.0%
times-frac34.1%
*-un-lft-identity34.1%
*-commutative34.1%
times-frac34.1%
*-un-lft-identity34.1%
*-commutative34.1%
associate-*l*34.1%
Applied egg-rr34.1%
if -2.39999999999999991 < y < 2.39999999999999991Initial program 100.0%
Taylor expanded in y around 0 99.5%
Final simplification64.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (* z 0.16666666666666666))))
(if (<= y -2.4)
(/ 1.0 (* y (/ t_0 x)))
(if (<= y 2.4) (/ x z) (/ (/ x t_0) y)))))
double code(double x, double y, double z) {
double t_0 = y * (z * 0.16666666666666666);
double tmp;
if (y <= -2.4) {
tmp = 1.0 / (y * (t_0 / x));
} else if (y <= 2.4) {
tmp = x / z;
} else {
tmp = (x / t_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) :: t_0
real(8) :: tmp
t_0 = y * (z * 0.16666666666666666d0)
if (y <= (-2.4d0)) then
tmp = 1.0d0 / (y * (t_0 / x))
else if (y <= 2.4d0) then
tmp = x / z
else
tmp = (x / t_0) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (z * 0.16666666666666666);
double tmp;
if (y <= -2.4) {
tmp = 1.0 / (y * (t_0 / x));
} else if (y <= 2.4) {
tmp = x / z;
} else {
tmp = (x / t_0) / y;
}
return tmp;
}
def code(x, y, z): t_0 = y * (z * 0.16666666666666666) tmp = 0 if y <= -2.4: tmp = 1.0 / (y * (t_0 / x)) elif y <= 2.4: tmp = x / z else: tmp = (x / t_0) / y return tmp
function code(x, y, z) t_0 = Float64(y * Float64(z * 0.16666666666666666)) tmp = 0.0 if (y <= -2.4) tmp = Float64(1.0 / Float64(y * Float64(t_0 / x))); elseif (y <= 2.4) tmp = Float64(x / z); else tmp = Float64(Float64(x / t_0) / y); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (z * 0.16666666666666666); tmp = 0.0; if (y <= -2.4) tmp = 1.0 / (y * (t_0 / x)); elseif (y <= 2.4) tmp = x / z; else tmp = (x / t_0) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.4], N[(1.0 / N[(y * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4], N[(x / z), $MachinePrecision], N[(N[(x / t$95$0), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(z \cdot 0.16666666666666666\right)\\
\mathbf{if}\;y \leq -2.4:\\
\;\;\;\;\frac{1}{y \cdot \frac{t_0}{x}}\\
\mathbf{elif}\;y \leq 2.4:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t_0}}{y}\\
\end{array}
\end{array}
if y < -2.39999999999999991Initial program 96.3%
associate-/l*93.0%
associate-/r/92.9%
Simplified92.9%
Taylor expanded in y around 0 30.1%
Taylor expanded in y around inf 30.1%
associate-*r/30.1%
*-commutative30.1%
times-frac30.1%
unpow230.1%
associate-/r*30.1%
Simplified30.1%
associate-*r/30.1%
div-inv30.1%
associate-*l*30.1%
metadata-eval30.1%
times-frac30.2%
*-un-lft-identity30.2%
*-commutative30.2%
times-frac30.2%
*-un-lft-identity30.2%
*-commutative30.2%
associate-/r*30.1%
clear-num30.1%
*-commutative30.1%
*-un-lft-identity30.1%
times-frac30.2%
/-rgt-identity30.2%
associate-*l*30.2%
Applied egg-rr30.2%
if -2.39999999999999991 < y < 2.39999999999999991Initial program 100.0%
Taylor expanded in y around 0 99.5%
if 2.39999999999999991 < y Initial program 96.1%
associate-/l*94.8%
associate-/r/94.8%
Simplified94.8%
Taylor expanded in y around 0 34.5%
Taylor expanded in y around inf 34.4%
associate-*r/34.4%
*-commutative34.4%
times-frac34.3%
unpow234.3%
associate-/r*34.4%
Simplified34.4%
associate-*r/36.7%
div-inv36.7%
associate-*l*36.7%
metadata-eval36.7%
times-frac36.8%
*-un-lft-identity36.8%
*-commutative36.8%
times-frac36.8%
*-un-lft-identity36.8%
*-commutative36.8%
associate-*l*36.8%
Applied egg-rr36.8%
Final simplification64.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1e+54) (not (<= y 1e+39))) (* y (/ x (* y z))) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1e+54) || !(y <= 1e+39)) {
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 <= (-1d+54)) .or. (.not. (y <= 1d+39))) 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 <= -1e+54) || !(y <= 1e+39)) {
tmp = y * (x / (y * z));
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1e+54) or not (y <= 1e+39): tmp = y * (x / (y * z)) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1e+54) || !(y <= 1e+39)) 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 <= -1e+54) || ~((y <= 1e+39))) tmp = y * (x / (y * z)); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1e+54], N[Not[LessEqual[y, 1e+39]], $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 -1 \cdot 10^{+54} \lor \neg \left(y \leq 10^{+39}\right):\\
\;\;\;\;y \cdot \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -1.0000000000000001e54 or 9.9999999999999994e38 < y Initial program 96.5%
associate-*l/85.5%
times-frac93.1%
*-commutative93.1%
associate-*r/93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in y around 0 36.6%
if -1.0000000000000001e54 < y < 9.9999999999999994e38Initial program 99.2%
Taylor expanded in y around 0 87.8%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (if (<= y -2.4) (* 6.0 (/ x (* z (* y y)))) (if (<= y 0.022) (/ x z) (* y (/ x (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.4) {
tmp = 6.0 * (x / (z * (y * y)));
} else if (y <= 0.022) {
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 <= (-2.4d0)) then
tmp = 6.0d0 * (x / (z * (y * y)))
else if (y <= 0.022d0) 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 <= -2.4) {
tmp = 6.0 * (x / (z * (y * y)));
} else if (y <= 0.022) {
tmp = x / z;
} else {
tmp = y * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.4: tmp = 6.0 * (x / (z * (y * y))) elif y <= 0.022: tmp = x / z else: tmp = y * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.4) tmp = Float64(6.0 * Float64(x / Float64(z * Float64(y * y)))); elseif (y <= 0.022) tmp = Float64(x / z); else tmp = Float64(y * Float64(x / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.4) tmp = 6.0 * (x / (z * (y * y))); elseif (y <= 0.022) tmp = x / z; else tmp = y * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.4], N[(6.0 * N[(x / N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.022], N[(x / z), $MachinePrecision], N[(y * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4:\\
\;\;\;\;6 \cdot \frac{x}{z \cdot \left(y \cdot y\right)}\\
\mathbf{elif}\;y \leq 0.022:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < -2.39999999999999991Initial program 96.3%
associate-/l*93.0%
associate-/r/92.9%
Simplified92.9%
Taylor expanded in y around 0 30.1%
Taylor expanded in y around inf 30.1%
*-commutative30.1%
unpow230.1%
Simplified30.1%
if -2.39999999999999991 < y < 0.021999999999999999Initial program 100.0%
Taylor expanded in y around 0 99.5%
if 0.021999999999999999 < y Initial program 96.1%
associate-*l/86.0%
times-frac94.7%
*-commutative94.7%
associate-*r/94.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in y around 0 36.4%
Final simplification64.1%
(FPCore (x y z) :precision binary64 (if (<= y -2.4) (* 6.0 (/ (/ x y) (* y z))) (if (<= y 0.0034) (/ x z) (* y (/ x (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.4) {
tmp = 6.0 * ((x / y) / (y * z));
} else if (y <= 0.0034) {
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 <= (-2.4d0)) then
tmp = 6.0d0 * ((x / y) / (y * z))
else if (y <= 0.0034d0) 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 <= -2.4) {
tmp = 6.0 * ((x / y) / (y * z));
} else if (y <= 0.0034) {
tmp = x / z;
} else {
tmp = y * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.4: tmp = 6.0 * ((x / y) / (y * z)) elif y <= 0.0034: tmp = x / z else: tmp = y * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.4) tmp = Float64(6.0 * Float64(Float64(x / y) / Float64(y * z))); elseif (y <= 0.0034) tmp = Float64(x / z); else tmp = Float64(y * Float64(x / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.4) tmp = 6.0 * ((x / y) / (y * z)); elseif (y <= 0.0034) tmp = x / z; else tmp = y * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.4], N[(6.0 * N[(N[(x / y), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0034], N[(x / z), $MachinePrecision], N[(y * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4:\\
\;\;\;\;6 \cdot \frac{\frac{x}{y}}{y \cdot z}\\
\mathbf{elif}\;y \leq 0.0034:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < -2.39999999999999991Initial program 96.3%
associate-/l*93.0%
associate-/r/92.9%
Simplified92.9%
Taylor expanded in y around 0 30.1%
Taylor expanded in y around inf 30.1%
*-commutative30.1%
Simplified30.1%
associate-/r*30.2%
*-un-lft-identity30.2%
*-commutative30.2%
times-frac30.2%
metadata-eval30.2%
*-un-lft-identity30.2%
*-commutative30.2%
times-frac30.1%
associate-*l*30.1%
div-inv30.1%
associate-*r/30.1%
frac-times30.2%
*-commutative30.2%
*-un-lft-identity30.2%
times-frac30.2%
metadata-eval30.2%
Applied egg-rr30.2%
if -2.39999999999999991 < y < 0.00339999999999999981Initial program 100.0%
Taylor expanded in y around 0 99.5%
if 0.00339999999999999981 < y Initial program 96.1%
associate-*l/86.0%
times-frac94.7%
*-commutative94.7%
associate-*r/94.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in y around 0 36.4%
Final simplification64.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 97.9%
Taylor expanded in y around 0 55.9%
Final simplification55.9%
(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 2023195
(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))