
(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 11 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 (/ (* 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.1%
Final simplification97.1%
(FPCore (x y z) :precision binary64 (if (<= y 6.5e-9) (/ x z) (* (sin y) (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 6.5e-9) {
tmp = x / z;
} 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 <= 6.5d-9) then
tmp = x / z
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 <= 6.5e-9) {
tmp = x / z;
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6.5e-9: tmp = x / z else: tmp = math.sin(y) * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6.5e-9) tmp = Float64(x / z); 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 <= 6.5e-9) tmp = x / z; else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 6.5e-9], N[(x / z), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 6.5000000000000003e-9Initial program 97.6%
associate-*l/97.8%
times-frac77.7%
*-commutative77.7%
associate-*r/76.5%
*-commutative76.5%
Simplified76.5%
Taylor expanded in y around 0 71.5%
if 6.5000000000000003e-9 < y Initial program 95.7%
associate-*l/85.4%
times-frac90.3%
*-commutative90.3%
associate-*r/90.4%
*-commutative90.4%
Simplified90.4%
Final simplification76.8%
(FPCore (x y z) :precision binary64 (if (<= y 0.00025) (/ (* x (+ 1.0 (* -0.16666666666666666 (* y y)))) z) (* (/ (sin y) z) (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00025) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = (sin(y) / z) * (x / 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 <= 0.00025d0) then
tmp = (x * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))) / z
else
tmp = (sin(y) / z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.00025) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = (Math.sin(y) / z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00025: tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z else: tmp = (math.sin(y) / z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00025) tmp = Float64(Float64(x * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))) / z); else tmp = Float64(Float64(sin(y) / z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.00025) tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z; else tmp = (sin(y) / z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00025], N[(N[(x * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[Sin[y], $MachinePrecision] / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00025:\\
\;\;\;\;\frac{x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin y}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 2.5000000000000001e-4Initial program 97.6%
Taylor expanded in y around 0 68.9%
unpow268.9%
Simplified68.9%
if 2.5000000000000001e-4 < y Initial program 95.6%
associate-*r/95.6%
associate-/l/90.2%
*-commutative90.2%
times-frac95.6%
Simplified95.6%
Final simplification76.3%
(FPCore (x y z) :precision binary64 (if (<= y 7.5e+21) (/ (* x (+ 1.0 (* -0.16666666666666666 (* y y)))) z) (/ (/ 6.0 z) (* y (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 7.5e+21) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / 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 <= 7.5d+21) then
tmp = (x * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))) / 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 <= 7.5e+21) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = (6.0 / z) / (y * (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 7.5e+21: tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z else: tmp = (6.0 / z) / (y * (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 7.5e+21) tmp = Float64(Float64(x * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))) / z); else tmp = Float64(Float64(6.0 / z) / Float64(y * Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 7.5e+21) tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z; else tmp = (6.0 / z) / (y * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 7.5e+21], N[(N[(x * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(6.0 / z), $MachinePrecision] / N[(y * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.5 \cdot 10^{+21}:\\
\;\;\;\;\frac{x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{6}{z}}{y \cdot \frac{y}{x}}\\
\end{array}
\end{array}
if y < 7.5e21Initial program 97.7%
Taylor expanded in y around 0 68.1%
unpow268.1%
Simplified68.1%
if 7.5e21 < y Initial program 95.2%
associate-/l*89.1%
associate-/r/89.1%
Simplified89.1%
Taylor expanded in y around 0 38.1%
Taylor expanded in y around inf 38.1%
*-commutative38.1%
unpow238.1%
Simplified38.1%
Taylor expanded in x around 0 38.1%
unpow238.1%
associate-/r*38.1%
associate-*r/38.1%
associate-*l/38.1%
associate-*r/37.8%
associate-/l*38.1%
associate-*l/38.2%
Simplified38.2%
Final simplification60.7%
(FPCore (x y z) :precision binary64 (if (<= y 0.00056) (/ x z) (* 6.0 (/ x (* z (* y y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00056) {
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 <= 0.00056d0) 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 <= 0.00056) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (z * (y * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00056: tmp = x / z else: tmp = 6.0 * (x / (z * (y * y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00056) 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 <= 0.00056) tmp = x / z; else tmp = 6.0 * (x / (z * (y * y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00056], 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 0.00056:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{x}{z \cdot \left(y \cdot y\right)}\\
\end{array}
\end{array}
if y < 5.5999999999999995e-4Initial program 97.6%
associate-*l/97.8%
times-frac77.8%
*-commutative77.8%
associate-*r/76.6%
*-commutative76.6%
Simplified76.6%
Taylor expanded in y around 0 71.7%
if 5.5999999999999995e-4 < y Initial program 95.6%
associate-/l*90.2%
associate-/r/90.2%
Simplified90.2%
Taylor expanded in y around 0 37.5%
Taylor expanded in y around inf 37.5%
*-commutative37.5%
unpow237.5%
Simplified37.5%
Final simplification62.2%
(FPCore (x y z) :precision binary64 (if (<= y 0.00056) (/ x z) (* (/ 6.0 z) (/ x (* y y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00056) {
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 <= 0.00056d0) 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 <= 0.00056) {
tmp = x / z;
} else {
tmp = (6.0 / z) * (x / (y * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00056: tmp = x / z else: tmp = (6.0 / z) * (x / (y * y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00056) 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 <= 0.00056) tmp = x / z; else tmp = (6.0 / z) * (x / (y * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00056], 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 0.00056:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{z} \cdot \frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < 5.5999999999999995e-4Initial program 97.6%
associate-*l/97.8%
times-frac77.8%
*-commutative77.8%
associate-*r/76.6%
*-commutative76.6%
Simplified76.6%
Taylor expanded in y around 0 71.7%
if 5.5999999999999995e-4 < y Initial program 95.6%
associate-/l*90.2%
associate-/r/90.2%
Simplified90.2%
Taylor expanded in y around 0 37.5%
Taylor expanded in y around inf 37.5%
*-commutative37.5%
associate-*l/37.5%
unpow237.5%
associate-*l*37.5%
Simplified37.5%
associate-*r*37.5%
times-frac37.5%
Applied egg-rr37.5%
Final simplification62.2%
(FPCore (x y z) :precision binary64 (if (<= y 0.00056) (/ x z) (* (/ x (* y z)) (/ 6.0 y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00056) {
tmp = x / z;
} else {
tmp = (x / (y * z)) * (6.0 / y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 0.00056d0) then
tmp = x / z
else
tmp = (x / (y * z)) * (6.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.00056) {
tmp = x / z;
} else {
tmp = (x / (y * z)) * (6.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00056: tmp = x / z else: tmp = (x / (y * z)) * (6.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00056) tmp = Float64(x / z); else tmp = Float64(Float64(x / Float64(y * z)) * Float64(6.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.00056) tmp = x / z; else tmp = (x / (y * z)) * (6.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00056], N[(x / z), $MachinePrecision], N[(N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(6.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00056:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot z} \cdot \frac{6}{y}\\
\end{array}
\end{array}
if y < 5.5999999999999995e-4Initial program 97.6%
associate-*l/97.8%
times-frac77.8%
*-commutative77.8%
associate-*r/76.6%
*-commutative76.6%
Simplified76.6%
Taylor expanded in y around 0 71.7%
if 5.5999999999999995e-4 < y Initial program 95.6%
associate-/l*90.2%
associate-/r/90.2%
Simplified90.2%
Taylor expanded in y around 0 37.5%
Taylor expanded in y around inf 37.5%
*-commutative37.5%
associate-*l/37.5%
unpow237.5%
associate-*l*37.5%
Simplified37.5%
*-commutative37.5%
times-frac37.6%
Applied egg-rr37.6%
Final simplification62.2%
(FPCore (x y z) :precision binary64 (if (<= y 0.00056) (/ x z) (* (/ x y) (/ (/ 6.0 y) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00056) {
tmp = x / z;
} else {
tmp = (x / y) * ((6.0 / 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.00056d0) then
tmp = x / z
else
tmp = (x / y) * ((6.0d0 / y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.00056) {
tmp = x / z;
} else {
tmp = (x / y) * ((6.0 / y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00056: tmp = x / z else: tmp = (x / y) * ((6.0 / y) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00056) tmp = Float64(x / z); else tmp = Float64(Float64(x / y) * Float64(Float64(6.0 / y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.00056) tmp = x / z; else tmp = (x / y) * ((6.0 / y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00056], N[(x / z), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(N[(6.0 / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00056:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{\frac{6}{y}}{z}\\
\end{array}
\end{array}
if y < 5.5999999999999995e-4Initial program 97.6%
associate-*l/97.8%
times-frac77.8%
*-commutative77.8%
associate-*r/76.6%
*-commutative76.6%
Simplified76.6%
Taylor expanded in y around 0 71.7%
if 5.5999999999999995e-4 < y Initial program 95.6%
associate-/l*90.2%
associate-/r/90.2%
Simplified90.2%
Taylor expanded in y around 0 37.5%
Taylor expanded in y around inf 37.5%
*-commutative37.5%
unpow237.5%
associate-*r*37.5%
*-commutative37.5%
associate-*l*37.5%
*-commutative37.5%
associate-*l*37.5%
*-commutative37.5%
Simplified37.5%
*-un-lft-identity37.5%
times-frac37.6%
un-div-inv37.6%
metadata-eval37.6%
div-inv37.6%
clear-num37.6%
associate-*l/37.6%
*-un-lft-identity37.6%
*-commutative37.6%
*-commutative37.6%
times-frac37.6%
Applied egg-rr37.6%
Final simplification62.2%
(FPCore (x y z) :precision binary64 (if (<= y 0.00056) (/ x z) (/ (/ 6.0 z) (* y (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00056) {
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 <= 0.00056d0) 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 <= 0.00056) {
tmp = x / z;
} else {
tmp = (6.0 / z) / (y * (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00056: tmp = x / z else: tmp = (6.0 / z) / (y * (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00056) tmp = Float64(x / z); else tmp = Float64(Float64(6.0 / z) / Float64(y * Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.00056) tmp = x / z; else tmp = (6.0 / z) / (y * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00056], N[(x / z), $MachinePrecision], N[(N[(6.0 / z), $MachinePrecision] / N[(y * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00056:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{6}{z}}{y \cdot \frac{y}{x}}\\
\end{array}
\end{array}
if y < 5.5999999999999995e-4Initial program 97.6%
associate-*l/97.8%
times-frac77.8%
*-commutative77.8%
associate-*r/76.6%
*-commutative76.6%
Simplified76.6%
Taylor expanded in y around 0 71.7%
if 5.5999999999999995e-4 < y Initial program 95.6%
associate-/l*90.2%
associate-/r/90.2%
Simplified90.2%
Taylor expanded in y around 0 37.5%
Taylor expanded in y around inf 37.5%
*-commutative37.5%
unpow237.5%
Simplified37.5%
Taylor expanded in x around 0 37.5%
unpow237.5%
associate-/r*37.5%
associate-*r/37.5%
associate-*l/37.5%
associate-*r/37.2%
associate-/l*37.5%
associate-*l/37.6%
Simplified37.6%
Final simplification62.2%
(FPCore (x y z) :precision binary64 (if (<= y 6.6e-9) (/ x z) (* y (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 6.6e-9) {
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 <= 6.6d-9) 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 <= 6.6e-9) {
tmp = x / z;
} else {
tmp = y * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6.6e-9: tmp = x / z else: tmp = y * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6.6e-9) 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 <= 6.6e-9) tmp = x / z; else tmp = y * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 6.6e-9], N[(x / z), $MachinePrecision], N[(y * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.6 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 6.60000000000000037e-9Initial program 97.6%
associate-*l/97.8%
times-frac77.7%
*-commutative77.7%
associate-*r/76.5%
*-commutative76.5%
Simplified76.5%
Taylor expanded in y around 0 71.5%
if 6.60000000000000037e-9 < y Initial program 95.7%
associate-*r/95.7%
associate-/l/90.3%
*-commutative90.3%
times-frac95.7%
Simplified95.7%
Taylor expanded in y around 0 27.6%
*-commutative27.6%
clear-num29.0%
frac-times37.6%
*-un-lft-identity37.6%
Applied egg-rr37.6%
div-inv37.6%
associate-*l/38.1%
clear-num38.1%
Applied egg-rr38.1%
Final simplification62.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.1%
associate-*l/94.3%
times-frac81.2%
*-commutative81.2%
associate-*r/80.4%
*-commutative80.4%
Simplified80.4%
Taylor expanded in y around 0 57.2%
Final simplification57.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (sin y))) (t_1 (/ (* x (/ 1.0 t_0)) z)))
(if (< z -4.2173720203427147e-29)
t_1
(if (< z 4.446702369113811e+64) (/ x (* z t_0)) t_1))))
double code(double x, double y, double z) {
double t_0 = y / sin(y);
double t_1 = (x * (1.0 / t_0)) / z;
double tmp;
if (z < -4.2173720203427147e-29) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x / (z * t_0);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y / sin(y)
t_1 = (x * (1.0d0 / t_0)) / z
if (z < (-4.2173720203427147d-29)) then
tmp = t_1
else if (z < 4.446702369113811d+64) then
tmp = x / (z * t_0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / Math.sin(y);
double t_1 = (x * (1.0 / t_0)) / z;
double tmp;
if (z < -4.2173720203427147e-29) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x / (z * t_0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y / math.sin(y) t_1 = (x * (1.0 / t_0)) / z tmp = 0 if z < -4.2173720203427147e-29: tmp = t_1 elif z < 4.446702369113811e+64: tmp = x / (z * t_0) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y / sin(y)) t_1 = Float64(Float64(x * Float64(1.0 / t_0)) / z) tmp = 0.0 if (z < -4.2173720203427147e-29) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = Float64(x / Float64(z * t_0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / sin(y); t_1 = (x * (1.0 / t_0)) / z; tmp = 0.0; if (z < -4.2173720203427147e-29) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = x / (z * t_0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[Less[z, -4.2173720203427147e-29], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\sin y}\\
t_1 := \frac{x \cdot \frac{1}{t_0}}{z}\\
\mathbf{if}\;z < -4.2173720203427147 \cdot 10^{-29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{z \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023240
(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))