
(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 13 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}
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 1.9e+155) (* (/ (sin y) y) (/ x z)) (/ (* x (sin y)) (* y z))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 1.9e+155) {
tmp = (sin(y) / y) * (x / z);
} else {
tmp = (x * sin(y)) / (y * z);
}
return tmp;
}
NOTE: y should be positive before calling this function
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.9d+155) then
tmp = (sin(y) / y) * (x / z)
else
tmp = (x * sin(y)) / (y * z)
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.9e+155) {
tmp = (Math.sin(y) / y) * (x / z);
} else {
tmp = (x * Math.sin(y)) / (y * z);
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 1.9e+155: tmp = (math.sin(y) / y) * (x / z) else: tmp = (x * math.sin(y)) / (y * z) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 1.9e+155) tmp = Float64(Float64(sin(y) / y) * Float64(x / z)); else tmp = Float64(Float64(x * sin(y)) / Float64(y * z)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.9e+155) tmp = (sin(y) / y) * (x / z); else tmp = (x * sin(y)) / (y * z); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 1.9e+155], N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{+155}:\\
\;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \sin y}{y \cdot z}\\
\end{array}
\end{array}
if y < 1.9e155Initial program 97.5%
*-commutative97.5%
associate-*r/97.4%
Simplified97.4%
if 1.9e155 < y Initial program 94.9%
associate-/l*99.4%
associate-/r/99.4%
associate-/l/94.9%
associate-/r/95.1%
associate-/r*99.6%
Simplified99.6%
Taylor expanded in x around 0 99.7%
Final simplification97.6%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 2e-8) (/ x z) (* (sin y) (/ x (* y z)))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 2e-8) {
tmp = x / z;
} else {
tmp = sin(y) * (x / (y * z));
}
return tmp;
}
NOTE: y should be positive before calling this function
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-8) then
tmp = x / z
else
tmp = sin(y) * (x / (y * z))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e-8) {
tmp = x / z;
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 2e-8: tmp = x / z else: tmp = math.sin(y) * (x / (y * z)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 2e-8) tmp = Float64(x / z); else tmp = Float64(sin(y) * Float64(x / Float64(y * z))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e-8) tmp = x / z; else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 2e-8], N[(x / z), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 2e-8Initial program 97.1%
associate-/l*96.9%
associate-/r/83.2%
associate-/l/76.1%
associate-/r/82.3%
associate-/r*81.5%
Simplified81.5%
Taylor expanded in y around 0 70.2%
if 2e-8 < y Initial program 97.7%
associate-/l*90.4%
associate-/r/90.4%
associate-/l/97.7%
associate-/r/97.8%
associate-/r*90.6%
Simplified90.6%
Final simplification75.2%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 2.2e+156) (* (/ (sin y) y) (/ x z)) (* (sin y) (/ x (* y z)))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 2.2e+156) {
tmp = (sin(y) / y) * (x / z);
} else {
tmp = sin(y) * (x / (y * z));
}
return tmp;
}
NOTE: y should be positive before calling this function
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.2d+156) then
tmp = (sin(y) / y) * (x / z)
else
tmp = sin(y) * (x / (y * z))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.2e+156) {
tmp = (Math.sin(y) / y) * (x / z);
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 2.2e+156: tmp = (math.sin(y) / y) * (x / z) else: tmp = math.sin(y) * (x / (y * z)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 2.2e+156) tmp = Float64(Float64(sin(y) / y) * Float64(x / z)); else tmp = Float64(sin(y) * Float64(x / Float64(y * z))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.2e+156) tmp = (sin(y) / y) * (x / z); else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 2.2e+156], N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{+156}:\\
\;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 2.20000000000000004e156Initial program 97.5%
*-commutative97.5%
associate-*r/97.4%
Simplified97.4%
if 2.20000000000000004e156 < y Initial program 94.9%
associate-/l*99.4%
associate-/r/99.4%
associate-/l/94.9%
associate-/r/95.1%
associate-/r*99.6%
Simplified99.6%
Final simplification97.6%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
y = abs(y);
double code(double x, double y, double z) {
return (x * (sin(y) / y)) / z;
}
NOTE: y should be positive before calling this function
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
y = Math.abs(y);
public static double code(double x, double y, double z) {
return (x * (Math.sin(y) / y)) / z;
}
y = abs(y) def code(x, y, z): return (x * (math.sin(y) / y)) / z
y = abs(y) function code(x, y, z) return Float64(Float64(x * Float64(sin(y) / y)) / z) end
y = abs(y) function tmp = code(x, y, z) tmp = (x * (sin(y) / y)) / z; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\frac{x \cdot \frac{\sin y}{y}}{z}
\end{array}
Initial program 97.3%
Final simplification97.3%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 2.4) (/ x z) (* 6.0 (* (/ 1.0 y) (/ (/ x z) y)))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 2.4) {
tmp = x / z;
} else {
tmp = 6.0 * ((1.0 / y) * ((x / z) / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 * ((1.0d0 / y) * ((x / z) / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.4) {
tmp = x / z;
} else {
tmp = 6.0 * ((1.0 / y) * ((x / z) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 2.4: tmp = x / z else: tmp = 6.0 * ((1.0 / y) * ((x / z) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 2.4) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(Float64(1.0 / y) * Float64(Float64(x / z) / y))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.4) tmp = x / z; else tmp = 6.0 * ((1.0 / y) * ((x / z) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 2.4], 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}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4:\\
\;\;\;\;\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.39999999999999991Initial program 97.1%
associate-/l*96.9%
associate-/r/83.3%
associate-/l/76.2%
associate-/r/82.4%
associate-/r*81.6%
Simplified81.6%
Taylor expanded in y around 0 70.2%
if 2.39999999999999991 < y Initial program 97.7%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in y around 0 37.7%
*-commutative37.7%
unpow237.7%
Simplified37.7%
Taylor expanded in y around inf 37.7%
unpow237.7%
*-commutative37.7%
Simplified37.7%
associate-/r*37.5%
*-un-lft-identity37.5%
times-frac37.7%
Applied egg-rr37.7%
Final simplification62.3%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 1.62e+16) (* (/ x z) (+ 1.0 (* (* y y) -0.16666666666666666))) (* 6.0 (* (/ 1.0 y) (/ (/ x z) y)))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 1.62e+16) {
tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = 6.0 * ((1.0 / y) * ((x / z) / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
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.62d+16) then
tmp = (x / z) * (1.0d0 + ((y * y) * (-0.16666666666666666d0)))
else
tmp = 6.0d0 * ((1.0d0 / y) * ((x / z) / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.62e+16) {
tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = 6.0 * ((1.0 / y) * ((x / z) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 1.62e+16: tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666)) else: tmp = 6.0 * ((1.0 / y) * ((x / z) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 1.62e+16) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666))); else tmp = Float64(6.0 * Float64(Float64(1.0 / y) * Float64(Float64(x / z) / y))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.62e+16) tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666)); else tmp = 6.0 * ((1.0 / y) * ((x / z) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 1.62e+16], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(1.0 / y), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.62 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + \left(y \cdot y\right) \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\frac{1}{y} \cdot \frac{\frac{x}{z}}{y}\right)\\
\end{array}
\end{array}
if y < 1.62e16Initial program 97.1%
*-commutative97.1%
associate-*r/98.0%
Simplified98.0%
Taylor expanded in y around 0 69.8%
unpow269.8%
Simplified69.8%
if 1.62e16 < y Initial program 97.6%
associate-/l*89.9%
Simplified89.9%
Taylor expanded in y around 0 39.6%
*-commutative39.6%
unpow239.6%
Simplified39.6%
Taylor expanded in y around inf 39.6%
unpow239.6%
*-commutative39.6%
Simplified39.6%
associate-/r*39.4%
*-un-lft-identity39.4%
times-frac39.5%
Applied egg-rr39.5%
Final simplification62.8%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 2.4) (/ x z) (* 6.0 (/ x (* y (* y z))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 2.4) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (y * (y * z)));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 * (y * z)))
end if
code = tmp
end function
y = Math.abs(y);
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 * (y * z)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 2.4: tmp = x / z else: tmp = 6.0 * (x / (y * (y * z))) return tmp
y = abs(y) 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(y * z)))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.4) tmp = x / z; else tmp = 6.0 * (x / (y * (y * z))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 2.4], N[(x / z), $MachinePrecision], N[(6.0 * N[(x / N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{x}{y \cdot \left(y \cdot z\right)}\\
\end{array}
\end{array}
if y < 2.39999999999999991Initial program 97.1%
associate-/l*96.9%
associate-/r/83.3%
associate-/l/76.2%
associate-/r/82.4%
associate-/r*81.6%
Simplified81.6%
Taylor expanded in y around 0 70.2%
if 2.39999999999999991 < y Initial program 97.7%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in y around 0 37.7%
*-commutative37.7%
unpow237.7%
Simplified37.7%
Taylor expanded in y around inf 37.7%
unpow237.7%
*-commutative37.7%
Simplified37.7%
Taylor expanded in z around 0 37.7%
unpow237.7%
associate-*l*37.7%
Simplified37.7%
Final simplification62.3%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 2.4) (/ x z) (* 6.0 (/ (/ x (* y z)) y))))
y = abs(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;
}
NOTE: y should be positive before calling this function
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
y = Math.abs(y);
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;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 2.4: tmp = x / z else: tmp = 6.0 * ((x / (y * z)) / y) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 2.4) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(Float64(x / Float64(y * z)) / y)); end return tmp end
y = abs(y) 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
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 2.4], N[(x / z), $MachinePrecision], N[(6.0 * N[(N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{\frac{x}{y \cdot z}}{y}\\
\end{array}
\end{array}
if y < 2.39999999999999991Initial program 97.1%
associate-/l*96.9%
associate-/r/83.3%
associate-/l/76.2%
associate-/r/82.4%
associate-/r*81.6%
Simplified81.6%
Taylor expanded in y around 0 70.2%
if 2.39999999999999991 < y Initial program 97.7%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in y around 0 37.7%
*-commutative37.7%
unpow237.7%
Simplified37.7%
Taylor expanded in y around inf 37.7%
unpow237.7%
*-commutative37.7%
Simplified37.7%
Taylor expanded in x around 0 37.7%
unpow237.7%
*-commutative37.7%
associate-/r*37.5%
*-lft-identity37.5%
times-frac37.7%
associate-*l/37.7%
*-lft-identity37.7%
associate-/l/37.7%
Simplified37.7%
Final simplification62.3%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (/ x (* z (+ 1.0 (* 0.16666666666666666 (* y y))))))
y = abs(y);
double code(double x, double y, double z) {
return x / (z * (1.0 + (0.16666666666666666 * (y * y))));
}
NOTE: y should be positive before calling this function
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 * (1.0d0 + (0.16666666666666666d0 * (y * y))))
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
return x / (z * (1.0 + (0.16666666666666666 * (y * y))));
}
y = abs(y) def code(x, y, z): return x / (z * (1.0 + (0.16666666666666666 * (y * y))))
y = abs(y) function code(x, y, z) return Float64(x / Float64(z * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))))) end
y = abs(y) function tmp = code(x, y, z) tmp = x / (z * (1.0 + (0.16666666666666666 * (y * y)))); end
NOTE: y should be positive before calling this function code[x_, y_, z_] := N[(x / N[(z * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\frac{x}{z \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)}
\end{array}
Initial program 97.3%
associate-/l*95.3%
Simplified95.3%
Taylor expanded in y around 0 65.6%
*-commutative65.6%
unpow265.6%
Simplified65.6%
Taylor expanded in z around 0 65.6%
unpow265.6%
Simplified65.6%
Final simplification65.6%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (/ x (+ z (* 0.16666666666666666 (* y (* y z))))))
y = abs(y);
double code(double x, double y, double z) {
return x / (z + (0.16666666666666666 * (y * (y * z))));
}
NOTE: y should be positive before calling this function
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
y = Math.abs(y);
public static double code(double x, double y, double z) {
return x / (z + (0.16666666666666666 * (y * (y * z))));
}
y = abs(y) def code(x, y, z): return x / (z + (0.16666666666666666 * (y * (y * z))))
y = abs(y) function code(x, y, z) return Float64(x / Float64(z + Float64(0.16666666666666666 * Float64(y * Float64(y * z))))) end
y = abs(y) function tmp = code(x, y, z) tmp = x / (z + (0.16666666666666666 * (y * (y * z)))); end
NOTE: y should be positive before calling this function code[x_, y_, z_] := N[(x / N[(z + N[(0.16666666666666666 * N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\frac{x}{z + 0.16666666666666666 \cdot \left(y \cdot \left(y \cdot z\right)\right)}
\end{array}
Initial program 97.3%
associate-/l*95.3%
Simplified95.3%
Taylor expanded in y around 0 65.6%
*-commutative65.6%
unpow265.6%
Simplified65.6%
Taylor expanded in z around 0 65.6%
unpow222.2%
associate-*l*22.3%
Simplified65.6%
Final simplification65.6%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 4e+101) (/ x z) (* (/ y z) (/ x y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 4e+101) {
tmp = x / z;
} else {
tmp = (y / z) * (x / y);
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 4d+101) then
tmp = x / z
else
tmp = (y / z) * (x / y)
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4e+101) {
tmp = x / z;
} else {
tmp = (y / z) * (x / y);
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 4e+101: tmp = x / z else: tmp = (y / z) * (x / y) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 4e+101) tmp = Float64(x / z); else tmp = Float64(Float64(y / z) * Float64(x / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4e+101) tmp = x / z; else tmp = (y / z) * (x / y); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 4e+101], N[(x / z), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 3.9999999999999999e101Initial program 97.4%
associate-/l*95.4%
associate-/r/83.4%
associate-/l/78.7%
associate-/r/84.3%
associate-/r*81.9%
Simplified81.9%
Taylor expanded in y around 0 65.1%
if 3.9999999999999999e101 < y Initial program 96.6%
associate-/l*94.3%
associate-/r/94.3%
associate-/l/96.5%
associate-/r/96.7%
associate-/r*94.5%
Simplified94.5%
Taylor expanded in x around 0 94.6%
Taylor expanded in y around 0 23.7%
*-commutative23.7%
*-commutative23.7%
times-frac20.6%
Applied egg-rr20.6%
Final simplification58.5%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 3.2e-8) (/ x z) (/ (* x y) (* y z))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 3.2e-8) {
tmp = x / z;
} else {
tmp = (x * y) / (y * z);
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 3.2d-8) then
tmp = x / z
else
tmp = (x * y) / (y * z)
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.2e-8) {
tmp = x / z;
} else {
tmp = (x * y) / (y * z);
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 3.2e-8: tmp = x / z else: tmp = (x * y) / (y * z) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 3.2e-8) tmp = Float64(x / z); else tmp = Float64(Float64(x * y) / Float64(y * z)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.2e-8) tmp = x / z; else tmp = (x * y) / (y * z); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 3.2e-8], N[(x / z), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.2 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{y \cdot z}\\
\end{array}
\end{array}
if y < 3.2000000000000002e-8Initial program 97.1%
associate-/l*96.9%
associate-/r/83.2%
associate-/l/76.1%
associate-/r/82.3%
associate-/r*81.5%
Simplified81.5%
Taylor expanded in y around 0 70.2%
if 3.2000000000000002e-8 < y Initial program 97.7%
associate-/l*90.4%
associate-/r/90.4%
associate-/l/97.7%
associate-/r/97.8%
associate-/r*90.6%
Simplified90.6%
Taylor expanded in x around 0 90.6%
Taylor expanded in y around 0 24.6%
Final simplification59.0%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (/ x z))
y = abs(y);
double code(double x, double y, double z) {
return x / z;
}
NOTE: y should be positive before calling this function
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
y = Math.abs(y);
public static double code(double x, double y, double z) {
return x / z;
}
y = abs(y) def code(x, y, z): return x / z
y = abs(y) function code(x, y, z) return Float64(x / z) end
y = abs(y) function tmp = code(x, y, z) tmp = x / z; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := N[(x / z), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\frac{x}{z}
\end{array}
Initial program 97.3%
associate-/l*95.3%
associate-/r/85.0%
associate-/l/81.4%
associate-/r/86.2%
associate-/r*83.7%
Simplified83.7%
Taylor expanded in y around 0 56.9%
Final simplification56.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 2023293
(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))