
(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 t_0) -2e-264) (/ (/ x (/ y (sin y))) z) (/ x (/ z t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if ((x * t_0) <= -2e-264) {
tmp = (x / (y / sin(y))) / 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 ((x * t_0) <= (-2d-264)) then
tmp = (x / (y / sin(y))) / 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 ((x * t_0) <= -2e-264) {
tmp = (x / (y / Math.sin(y))) / z;
} else {
tmp = x / (z / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y tmp = 0 if (x * t_0) <= -2e-264: tmp = (x / (y / math.sin(y))) / z else: tmp = x / (z / t_0) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) tmp = 0.0 if (Float64(x * t_0) <= -2e-264) tmp = Float64(Float64(x / Float64(y / sin(y))) / 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 ((x * t_0) <= -2e-264) tmp = (x / (y / sin(y))) / 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[N[(x * t$95$0), $MachinePrecision], -2e-264], N[(N[(x / N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;x \cdot t_0 \leq -2 \cdot 10^{-264}:\\
\;\;\;\;\frac{\frac{x}{\frac{y}{\sin y}}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if (*.f64 x (/.f64 (sin.f64 y) y)) < -2e-264Initial program 99.8%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
if -2e-264 < (*.f64 x (/.f64 (sin.f64 y) y)) Initial program 92.6%
associate-/l*98.6%
Simplified98.6%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y)) (t_1 (* x t_0))) (if (<= t_1 -2e-264) (/ t_1 z) (/ x (/ z t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double t_1 = x * t_0;
double tmp;
if (t_1 <= -2e-264) {
tmp = t_1 / 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) :: t_1
real(8) :: tmp
t_0 = sin(y) / y
t_1 = x * t_0
if (t_1 <= (-2d-264)) then
tmp = t_1 / 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 t_1 = x * t_0;
double tmp;
if (t_1 <= -2e-264) {
tmp = t_1 / z;
} else {
tmp = x / (z / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y t_1 = x * t_0 tmp = 0 if t_1 <= -2e-264: tmp = t_1 / z else: tmp = x / (z / t_0) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) t_1 = Float64(x * t_0) tmp = 0.0 if (t_1 <= -2e-264) tmp = Float64(t_1 / 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; t_1 = x * t_0; tmp = 0.0; if (t_1 <= -2e-264) tmp = t_1 / 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]}, Block[{t$95$1 = N[(x * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-264], N[(t$95$1 / z), $MachinePrecision], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
t_1 := x \cdot t_0\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{-264}:\\
\;\;\;\;\frac{t_1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if (*.f64 x (/.f64 (sin.f64 y) y)) < -2e-264Initial program 99.8%
if -2e-264 < (*.f64 x (/.f64 (sin.f64 y) y)) Initial program 92.6%
associate-/l*98.6%
Simplified98.6%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.4e-5) (/ x (/ z (+ 1.0 (* -0.16666666666666666 (* y y))))) (* (sin y) (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.4e-5) {
tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y))));
} 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-5) then
tmp = x / (z / (1.0d0 + ((-0.16666666666666666d0) * (y * y))))
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-5) {
tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y))));
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.4e-5: tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y)))) else: tmp = math.sin(y) * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.4e-5) tmp = Float64(x / Float64(z / Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))))); 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-5) tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y)))); else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.4e-5], N[(x / N[(z / N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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^{-5}:\\
\;\;\;\;\frac{x}{\frac{z}{1 + -0.16666666666666666 \cdot \left(y \cdot y\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 2.4000000000000001e-5Initial program 98.2%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in y around 0 70.0%
unpow270.0%
Simplified70.0%
if 2.4000000000000001e-5 < y Initial program 87.7%
associate-/l*96.6%
associate-/r/96.6%
associate-/l/87.7%
associate-/r/87.6%
associate-/r*96.6%
Simplified96.6%
Final simplification76.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y))) (if (<= z -1e+49) (* 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 <= -1e+49) {
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 <= (-1d+49)) 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 <= -1e+49) {
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 <= -1e+49: 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 <= -1e+49) 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 <= -1e+49) 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, -1e+49], 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 -1 \cdot 10^{+49}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if z < -9.99999999999999946e48Initial program 99.9%
*-commutative99.9%
associate-*r/99.9%
Simplified99.9%
if -9.99999999999999946e48 < z Initial program 94.3%
associate-/l*97.9%
Simplified97.9%
Final simplification98.4%
(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.5%
*-commutative95.5%
associate-*r/95.7%
Simplified95.7%
Final simplification95.7%
(FPCore (x y z) :precision binary64 (if (<= y 5.3e+14) (/ x (/ z (+ 1.0 (* -0.16666666666666666 (* y y))))) (/ 6.0 (/ (* y (* y z)) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.3e+14) {
tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y))));
} else {
tmp = 6.0 / ((y * (y * z)) / 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 <= 5.3d+14) then
tmp = x / (z / (1.0d0 + ((-0.16666666666666666d0) * (y * y))))
else
tmp = 6.0d0 / ((y * (y * z)) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 5.3e+14) {
tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y))));
} else {
tmp = 6.0 / ((y * (y * z)) / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5.3e+14: tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y)))) else: tmp = 6.0 / ((y * (y * z)) / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5.3e+14) tmp = Float64(x / Float64(z / Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))))); else tmp = Float64(6.0 / Float64(Float64(y * Float64(y * z)) / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5.3e+14) tmp = x / (z / (1.0 + (-0.16666666666666666 * (y * y)))); else tmp = 6.0 / ((y * (y * z)) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5.3e+14], N[(x / N[(z / N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.3 \cdot 10^{+14}:\\
\;\;\;\;\frac{x}{\frac{z}{1 + -0.16666666666666666 \cdot \left(y \cdot y\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{\frac{y \cdot \left(y \cdot z\right)}{x}}\\
\end{array}
\end{array}
if y < 5.3e14Initial program 98.2%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in y around 0 69.9%
unpow269.9%
Simplified69.9%
if 5.3e14 < y Initial program 86.4%
clear-num86.3%
un-div-inv86.5%
Applied egg-rr86.5%
Taylor expanded in y around 0 30.8%
*-commutative30.8%
unpow230.8%
Simplified30.8%
Taylor expanded in y around inf 30.8%
unpow230.8%
*-commutative30.8%
Simplified30.8%
clear-num30.8%
un-div-inv30.8%
associate-*r*30.9%
Applied egg-rr30.9%
Final simplification61.1%
(FPCore (x y z) :precision binary64 (if (<= y 5.4e+14) (/ (* x (+ 1.0 (* -0.16666666666666666 (* y y)))) z) (/ 6.0 (/ (* y (* y z)) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.4e+14) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = 6.0 / ((y * (y * z)) / 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 <= 5.4d+14) then
tmp = (x * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))) / z
else
tmp = 6.0d0 / ((y * (y * z)) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 5.4e+14) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = 6.0 / ((y * (y * z)) / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5.4e+14: tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z else: tmp = 6.0 / ((y * (y * z)) / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5.4e+14) tmp = Float64(Float64(x * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))) / z); else tmp = Float64(6.0 / Float64(Float64(y * Float64(y * z)) / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5.4e+14) tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z; else tmp = 6.0 / ((y * (y * z)) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5.4e+14], N[(N[(x * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(6.0 / N[(N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.4 \cdot 10^{+14}:\\
\;\;\;\;\frac{x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{\frac{y \cdot \left(y \cdot z\right)}{x}}\\
\end{array}
\end{array}
if y < 5.4e14Initial program 98.2%
Taylor expanded in y around 0 69.9%
unpow269.9%
Simplified69.9%
if 5.4e14 < y Initial program 86.4%
clear-num86.3%
un-div-inv86.5%
Applied egg-rr86.5%
Taylor expanded in y around 0 30.8%
*-commutative30.8%
unpow230.8%
Simplified30.8%
Taylor expanded in y around inf 30.8%
unpow230.8%
*-commutative30.8%
Simplified30.8%
clear-num30.8%
un-div-inv30.8%
associate-*r*30.9%
Applied egg-rr30.9%
Final simplification61.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.45) (/ x z) (* 6.0 (/ x (* z (* y y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.45) {
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.45d0) 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.45) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (z * (y * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.45: tmp = x / z else: tmp = 6.0 * (x / (z * (y * y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.45) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(x / Float64(z * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.45) tmp = x / z; else tmp = 6.0 * (x / (z * (y * y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.45], N[(x / z), $MachinePrecision], N[(6.0 * N[(x / N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.45:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{x}{z \cdot \left(y \cdot y\right)}\\
\end{array}
\end{array}
if y < 2.4500000000000002Initial program 98.2%
associate-/l*96.1%
associate-/r/81.7%
associate-/l/78.2%
associate-/r/78.1%
associate-/r*76.9%
Simplified76.9%
Taylor expanded in y around 0 75.6%
if 2.4500000000000002 < y Initial program 87.1%
clear-num87.0%
un-div-inv87.1%
Applied egg-rr87.1%
Taylor expanded in y around 0 31.0%
*-commutative31.0%
unpow231.0%
Simplified31.0%
Taylor expanded in y around inf 31.0%
unpow231.0%
*-commutative31.0%
Simplified31.0%
Final simplification65.0%
(FPCore (x y z) :precision binary64 (if (<= y 2.45) (/ x z) (/ 6.0 (/ (* y (* y z)) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.45) {
tmp = x / z;
} else {
tmp = 6.0 / ((y * (y * z)) / 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.45d0) then
tmp = x / z
else
tmp = 6.0d0 / ((y * (y * z)) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.45) {
tmp = x / z;
} else {
tmp = 6.0 / ((y * (y * z)) / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.45: tmp = x / z else: tmp = 6.0 / ((y * (y * z)) / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.45) tmp = Float64(x / z); else tmp = Float64(6.0 / Float64(Float64(y * Float64(y * z)) / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.45) tmp = x / z; else tmp = 6.0 / ((y * (y * z)) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.45], N[(x / z), $MachinePrecision], N[(6.0 / N[(N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.45:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{\frac{y \cdot \left(y \cdot z\right)}{x}}\\
\end{array}
\end{array}
if y < 2.4500000000000002Initial program 98.2%
associate-/l*96.1%
associate-/r/81.7%
associate-/l/78.2%
associate-/r/78.1%
associate-/r*76.9%
Simplified76.9%
Taylor expanded in y around 0 75.6%
if 2.4500000000000002 < y Initial program 87.1%
clear-num87.0%
un-div-inv87.1%
Applied egg-rr87.1%
Taylor expanded in y around 0 31.0%
*-commutative31.0%
unpow231.0%
Simplified31.0%
Taylor expanded in y around inf 31.0%
unpow231.0%
*-commutative31.0%
Simplified31.0%
clear-num31.0%
un-div-inv31.0%
associate-*r*31.0%
Applied egg-rr31.0%
Final simplification65.0%
(FPCore (x y z) :precision binary64 (/ (/ x (+ 1.0 (* y (* y 0.16666666666666666)))) z))
double code(double x, double y, double z) {
return (x / (1.0 + (y * (y * 0.16666666666666666)))) / 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 / (1.0d0 + (y * (y * 0.16666666666666666d0)))) / z
end function
public static double code(double x, double y, double z) {
return (x / (1.0 + (y * (y * 0.16666666666666666)))) / z;
}
def code(x, y, z): return (x / (1.0 + (y * (y * 0.16666666666666666)))) / z
function code(x, y, z) return Float64(Float64(x / Float64(1.0 + Float64(y * Float64(y * 0.16666666666666666)))) / z) end
function tmp = code(x, y, z) tmp = (x / (1.0 + (y * (y * 0.16666666666666666)))) / z; end
code[x_, y_, z_] := N[(N[(x / N[(1.0 + N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{x}{1 + y \cdot \left(y \cdot 0.16666666666666666\right)}}{z}
\end{array}
Initial program 95.5%
clear-num95.5%
un-div-inv95.5%
Applied egg-rr95.5%
Taylor expanded in y around 0 70.5%
*-commutative70.5%
unpow270.5%
Simplified70.5%
Taylor expanded in y around 0 70.5%
unpow270.5%
*-commutative70.5%
associate-*r*70.5%
Simplified70.5%
Final simplification70.5%
(FPCore (x y z) :precision binary64 (if (<= y 2e+136) (/ x z) (* (/ x y) (/ y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e+136) {
tmp = x / z;
} else {
tmp = (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 <= 2d+136) then
tmp = x / z
else
tmp = (x / y) * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e+136) {
tmp = x / z;
} else {
tmp = (x / y) * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e+136: tmp = x / z else: tmp = (x / y) * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e+136) tmp = Float64(x / z); else tmp = Float64(Float64(x / y) * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e+136) tmp = x / z; else tmp = (x / y) * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e+136], N[(x / z), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < 2.00000000000000012e136Initial program 96.7%
associate-/l*96.1%
associate-/r/83.7%
associate-/l/79.5%
associate-/r/79.3%
associate-/r*79.5%
Simplified79.5%
Taylor expanded in y around 0 67.9%
if 2.00000000000000012e136 < y Initial program 86.8%
clear-num86.6%
un-div-inv86.8%
Applied egg-rr86.8%
div-inv86.5%
associate-/r/86.6%
associate-*l*86.7%
Applied egg-rr86.7%
Taylor expanded in y around 0 28.4%
Final simplification63.3%
(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.5%
associate-/l*96.2%
associate-/r/85.2%
associate-/l/80.3%
associate-/r/80.2%
associate-/r*81.5%
Simplified81.5%
Taylor expanded in y around 0 61.5%
Final simplification61.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 2023279
(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))