
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
double code(double x, double y, double z) {
return (x * (sin(y) / y)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * (sin(y) / y)) / z
end function
public static double code(double x, double y, double z) {
return (x * (Math.sin(y) / y)) / z;
}
def code(x, y, z): return (x * (math.sin(y) / y)) / z
function code(x, y, z) return Float64(Float64(x * Float64(sin(y) / y)) / z) end
function tmp = code(x, y, z) tmp = (x * (sin(y) / y)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\sin y}{y}}{z}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (sin y) y)))
(if (or (<= z -2e+80) (not (<= z 2.1e-41)))
(* 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 <= -2e+80) || !(z <= 2.1e-41)) {
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 <= (-2d+80)) .or. (.not. (z <= 2.1d-41))) 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 <= -2e+80) || !(z <= 2.1e-41)) {
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 <= -2e+80) or not (z <= 2.1e-41): 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 <= -2e+80) || !(z <= 2.1e-41)) 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 <= -2e+80) || ~((z <= 2.1e-41))) tmp = t_0 * (x / z); else tmp = x / (z / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, If[Or[LessEqual[z, -2e+80], N[Not[LessEqual[z, 2.1e-41]], $MachinePrecision]], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;z \leq -2 \cdot 10^{+80} \lor \neg \left(z \leq 2.1 \cdot 10^{-41}\right):\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if z < -2e80 or 2.10000000000000013e-41 < z Initial program 99.8%
*-commutative99.8%
associate-*r/99.8%
Simplified99.8%
if -2e80 < z < 2.10000000000000013e-41Initial program 94.6%
associate-/l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= y 1e-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 <= 1e-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 <= 1d-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 <= 1e-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 <= 1e-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 <= 1e-5) tmp = Float64(Float64(x / 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 <= 1e-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, 1e-5], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $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 10^{-5}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 1.00000000000000008e-5Initial program 98.5%
*-commutative98.5%
associate-*r/95.5%
Simplified95.5%
Taylor expanded in y around 0 64.5%
unpow264.5%
Simplified64.5%
if 1.00000000000000008e-5 < y Initial program 92.9%
associate-/l*88.5%
associate-/r/88.5%
associate-/l/92.9%
associate-/r/92.9%
associate-/r*88.3%
Simplified88.3%
Final simplification70.1%
(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 97.2%
*-commutative97.2%
associate-*r/95.4%
Simplified95.4%
Final simplification95.4%
(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.2%
Final simplification97.2%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (* 6.0 (* (/ 1.0 y) (/ (/ x z) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = 6.0 * ((1.0 / 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.5d0) then
tmp = x / z
else
tmp = 6.0d0 * ((1.0d0 / 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.5) {
tmp = x / z;
} else {
tmp = 6.0 * ((1.0 / y) * ((x / z) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = 6.0 * ((1.0 / y) * ((x / z) / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(Float64(1.0 / y) * Float64(Float64(x / z) / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = 6.0 * ((1.0 / y) * ((x / z) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(6.0 * N[(N[(1.0 / y), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\frac{1}{y} \cdot \frac{\frac{x}{z}}{y}\right)\\
\end{array}
\end{array}
if y < 2.5Initial program 98.5%
associate-/l*96.5%
associate-/r/88.6%
associate-/l/86.9%
associate-/r/82.7%
associate-/r*82.1%
Simplified82.1%
Taylor expanded in y around 0 67.4%
if 2.5 < y Initial program 92.9%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in y around 0 36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in y around inf 36.2%
unpow236.2%
*-commutative36.2%
Simplified36.2%
associate-/r*36.1%
*-un-lft-identity36.1%
associate-*l/36.1%
*-un-lft-identity36.1%
times-frac36.4%
associate-*l/36.4%
*-un-lft-identity36.4%
Applied egg-rr36.4%
Final simplification60.2%
(FPCore (x y z) :precision binary64 (if (<= y 1.8e+65) (* (/ x z) (+ 1.0 (* -0.16666666666666666 (* y y)))) (* 6.0 (* (/ 1.0 y) (/ (/ x z) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.8e+65) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = 6.0 * ((1.0 / 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 <= 1.8d+65) then
tmp = (x / z) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
else
tmp = 6.0d0 * ((1.0d0 / y) * ((x / z) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.8e+65) {
tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = 6.0 * ((1.0 / y) * ((x / z) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.8e+65: tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))) else: tmp = 6.0 * ((1.0 / y) * ((x / z) / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.8e+65) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); else tmp = Float64(6.0 * Float64(Float64(1.0 / y) * Float64(Float64(x / z) / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.8e+65) tmp = (x / z) * (1.0 + (-0.16666666666666666 * (y * y))); else tmp = 6.0 * ((1.0 / y) * ((x / z) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.8e+65], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(1.0 / y), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.8 \cdot 10^{+65}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\frac{1}{y} \cdot \frac{\frac{x}{z}}{y}\right)\\
\end{array}
\end{array}
if y < 1.79999999999999989e65Initial program 98.5%
*-commutative98.5%
associate-*r/95.6%
Simplified95.6%
Taylor expanded in y around 0 63.7%
unpow263.7%
Simplified63.7%
if 1.79999999999999989e65 < y Initial program 92.1%
associate-/l*89.0%
Simplified89.0%
Taylor expanded in y around 0 38.1%
*-commutative38.1%
unpow238.1%
Simplified38.1%
Taylor expanded in y around inf 38.1%
unpow238.1%
*-commutative38.1%
Simplified38.1%
associate-/r*38.0%
*-un-lft-identity38.0%
associate-*l/38.0%
*-un-lft-identity38.0%
times-frac38.3%
associate-*l/38.3%
*-un-lft-identity38.3%
Applied egg-rr38.3%
Final simplification58.3%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (* (/ -6.0 y) (/ x (* y (- z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (-6.0 / 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.5d0) then
tmp = x / z
else
tmp = ((-6.0d0) / 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.5) {
tmp = x / z;
} else {
tmp = (-6.0 / y) * (x / (y * -z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = (-6.0 / y) * (x / (y * -z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(Float64(-6.0 / y) * Float64(x / Float64(y * Float64(-z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = (-6.0 / y) * (x / (y * -z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(N[(-6.0 / y), $MachinePrecision] * N[(x / N[(y * (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{-6}{y} \cdot \frac{x}{y \cdot \left(-z\right)}\\
\end{array}
\end{array}
if y < 2.5Initial program 98.5%
associate-/l*96.5%
associate-/r/88.6%
associate-/l/86.9%
associate-/r/82.7%
associate-/r*82.1%
Simplified82.1%
Taylor expanded in y around 0 67.4%
if 2.5 < y Initial program 92.9%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in y around 0 36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in y around inf 36.2%
unpow236.2%
*-commutative36.2%
Simplified36.2%
associate-*r/36.2%
frac-2neg36.2%
*-commutative36.2%
associate-*r*36.3%
distribute-rgt-neg-in36.3%
Applied egg-rr36.3%
distribute-lft-neg-in36.3%
times-frac36.3%
metadata-eval36.3%
*-commutative36.3%
distribute-rgt-neg-in36.3%
Simplified36.3%
Final simplification60.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (* 6.0 (/ x (* z (* y y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
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.5d0) 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.5) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (z * (y * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = 6.0 * (x / (z * (y * y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) 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.5) tmp = x / z; else tmp = 6.0 * (x / (z * (y * y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], 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.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{x}{z \cdot \left(y \cdot y\right)}\\
\end{array}
\end{array}
if y < 2.5Initial program 98.5%
associate-/l*96.5%
associate-/r/88.6%
associate-/l/86.9%
associate-/r/82.7%
associate-/r*82.1%
Simplified82.1%
Taylor expanded in y around 0 67.4%
if 2.5 < y Initial program 92.9%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in y around 0 36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in y around inf 36.2%
unpow236.2%
*-commutative36.2%
Simplified36.2%
Final simplification60.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (* (/ 6.0 z) (/ x (* y y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (6.0 / z) * (x / (y * y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.5d0) then
tmp = x / z
else
tmp = (6.0d0 / z) * (x / (y * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (6.0 / z) * (x / (y * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = (6.0 / z) * (x / (y * y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(Float64(6.0 / z) * Float64(x / Float64(y * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = (6.0 / z) * (x / (y * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(N[(6.0 / z), $MachinePrecision] * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{z} \cdot \frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < 2.5Initial program 98.5%
associate-/l*96.5%
associate-/r/88.6%
associate-/l/86.9%
associate-/r/82.7%
associate-/r*82.1%
Simplified82.1%
Taylor expanded in y around 0 67.4%
if 2.5 < y Initial program 92.9%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in y around 0 36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in y around inf 36.2%
associate-*r/36.2%
unpow236.2%
*-commutative36.2%
times-frac36.3%
Simplified36.3%
Final simplification60.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (/ 6.0 (* z (/ (* y y) x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = 6.0 / (z * ((y * y) / x));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.5d0) then
tmp = x / z
else
tmp = 6.0d0 / (z * ((y * y) / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = 6.0 / (z * ((y * y) / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = 6.0 / (z * ((y * y) / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(6.0 / Float64(z * Float64(Float64(y * y) / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = 6.0 / (z * ((y * y) / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(6.0 / N[(z * N[(N[(y * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{z \cdot \frac{y \cdot y}{x}}\\
\end{array}
\end{array}
if y < 2.5Initial program 98.5%
associate-/l*96.5%
associate-/r/88.6%
associate-/l/86.9%
associate-/r/82.7%
associate-/r*82.1%
Simplified82.1%
Taylor expanded in y around 0 67.4%
if 2.5 < y Initial program 92.9%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in y around 0 36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in y around inf 36.2%
unpow236.2%
*-commutative36.2%
Simplified36.2%
clear-num36.2%
un-div-inv36.2%
*-un-lft-identity36.2%
times-frac36.3%
/-rgt-identity36.3%
Applied egg-rr36.3%
Final simplification60.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (/ (* x 6.0) (* y (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (x * 6.0) / (y * (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.5d0) then
tmp = x / z
else
tmp = (x * 6.0d0) / (y * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (x * 6.0) / (y * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = (x * 6.0) / (y * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(Float64(x * 6.0) / Float64(y * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = (x * 6.0) / (y * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(N[(x * 6.0), $MachinePrecision] / N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 6}{y \cdot \left(y \cdot z\right)}\\
\end{array}
\end{array}
if y < 2.5Initial program 98.5%
associate-/l*96.5%
associate-/r/88.6%
associate-/l/86.9%
associate-/r/82.7%
associate-/r*82.1%
Simplified82.1%
Taylor expanded in y around 0 67.4%
if 2.5 < y Initial program 92.9%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in y around 0 36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in y around inf 36.2%
unpow236.2%
*-commutative36.2%
Simplified36.2%
associate-*r/36.2%
*-commutative36.2%
associate-*r*36.3%
Applied egg-rr36.3%
Final simplification60.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.5) (/ x z) (/ (* 6.0 (/ x y)) (* y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (6.0 * (x / y)) / (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.5d0) then
tmp = x / z
else
tmp = (6.0d0 * (x / y)) / (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5) {
tmp = x / z;
} else {
tmp = (6.0 * (x / y)) / (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5: tmp = x / z else: tmp = (6.0 * (x / y)) / (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5) tmp = Float64(x / z); else tmp = Float64(Float64(6.0 * Float64(x / y)) / Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5) tmp = x / z; else tmp = (6.0 * (x / y)) / (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5], N[(x / z), $MachinePrecision], N[(N[(6.0 * N[(x / y), $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{6 \cdot \frac{x}{y}}{y \cdot z}\\
\end{array}
\end{array}
if y < 2.5Initial program 98.5%
associate-/l*96.5%
associate-/r/88.6%
associate-/l/86.9%
associate-/r/82.7%
associate-/r*82.1%
Simplified82.1%
Taylor expanded in y around 0 67.4%
if 2.5 < y Initial program 92.9%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in y around 0 36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in y around inf 36.2%
associate-*r/36.2%
unpow236.2%
*-commutative36.2%
times-frac36.3%
Simplified36.3%
*-commutative36.3%
associate-/r*36.4%
frac-times36.3%
*-commutative36.3%
Applied egg-rr36.3%
Final simplification60.1%
(FPCore (x y z) :precision binary64 (/ x (+ z (* 0.16666666666666666 (* y (* y z))))))
double code(double x, double y, double z) {
return x / (z + (0.16666666666666666 * (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 / (z + (0.16666666666666666d0 * (y * (y * z))))
end function
public static double code(double x, double y, double z) {
return x / (z + (0.16666666666666666 * (y * (y * z))));
}
def code(x, y, z): return x / (z + (0.16666666666666666 * (y * (y * z))))
function code(x, y, z) return Float64(x / Float64(z + Float64(0.16666666666666666 * Float64(y * Float64(y * z))))) end
function tmp = code(x, y, z) tmp = x / (z + (0.16666666666666666 * (y * (y * z)))); end
code[x_, y_, z_] := N[(x / N[(z + N[(0.16666666666666666 * N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z + 0.16666666666666666 \cdot \left(y \cdot \left(y \cdot z\right)\right)}
\end{array}
Initial program 97.2%
associate-/l*94.6%
Simplified94.6%
Taylor expanded in y around 0 67.8%
*-commutative67.8%
unpow267.8%
Simplified67.8%
Taylor expanded in z around 0 67.8%
unpow267.8%
associate-*l*67.8%
Simplified67.8%
Final simplification67.8%
(FPCore (x y z) :precision binary64 (/ 1.0 (/ z x)))
double code(double x, double y, double z) {
return 1.0 / (z / x);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 / (z / x)
end function
public static double code(double x, double y, double z) {
return 1.0 / (z / x);
}
def code(x, y, z): return 1.0 / (z / x)
function code(x, y, z) return Float64(1.0 / Float64(z / x)) end
function tmp = code(x, y, z) tmp = 1.0 / (z / x); end
code[x_, y_, z_] := N[(1.0 / N[(z / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{z}{x}}
\end{array}
Initial program 97.2%
associate-/l*94.6%
associate-/r/88.6%
associate-/l/88.3%
associate-/r/85.1%
associate-/r*83.6%
Simplified83.6%
*-commutative83.6%
associate-*r/85.8%
frac-times95.4%
clear-num95.0%
un-div-inv95.4%
Applied egg-rr95.4%
Taylor expanded in y around 0 55.5%
Final simplification55.5%
(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.2%
associate-/l*94.6%
associate-/r/88.6%
associate-/l/88.3%
associate-/r/85.1%
associate-/r*83.6%
Simplified83.6%
Taylor expanded in y around 0 55.1%
Final simplification55.1%
(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 2023275
(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))