
(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 9 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 (* (/ (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.7%
associate-*l/97.2%
*-commutative97.2%
Applied egg-rr97.2%
Final simplification97.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.7e-8) (not (<= y 1e-31))) (* (sin y) (/ x (* y z))) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e-8) || !(y <= 1e-31)) {
tmp = sin(y) * (x / (y * z));
} else {
tmp = x / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-2.7d-8)) .or. (.not. (y <= 1d-31))) then
tmp = sin(y) * (x / (y * z))
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e-8) || !(y <= 1e-31)) {
tmp = Math.sin(y) * (x / (y * z));
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.7e-8) or not (y <= 1e-31): tmp = math.sin(y) * (x / (y * z)) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.7e-8) || !(y <= 1e-31)) tmp = Float64(sin(y) * Float64(x / Float64(y * z))); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.7e-8) || ~((y <= 1e-31))) tmp = sin(y) * (x / (y * z)); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.7e-8], N[Not[LessEqual[y, 1e-31]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{-8} \lor \neg \left(y \leq 10^{-31}\right):\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -2.70000000000000002e-8 or 1e-31 < y Initial program 92.0%
associate-*l/94.8%
times-frac89.3%
*-commutative89.3%
associate-*r/89.2%
*-commutative89.2%
Simplified89.2%
if -2.70000000000000002e-8 < y < 1e-31Initial program 100.0%
Taylor expanded in y around 0 100.0%
Final simplification94.3%
(FPCore (x y z)
:precision binary64
(if (<= y -4.4e+67)
(* 6.0 (/ x (* z (* y y))))
(if (<= y 2.3)
(* (/ x z) (+ 1.0 (* (* y y) -0.16666666666666666)))
(/ y (* z (/ y x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+67) {
tmp = 6.0 * (x / (z * (y * y)));
} else if (y <= 2.3) {
tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = y / (z * (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 <= (-4.4d+67)) then
tmp = 6.0d0 * (x / (z * (y * y)))
else if (y <= 2.3d0) then
tmp = (x / z) * (1.0d0 + ((y * y) * (-0.16666666666666666d0)))
else
tmp = y / (z * (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+67) {
tmp = 6.0 * (x / (z * (y * y)));
} else if (y <= 2.3) {
tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = y / (z * (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e+67: tmp = 6.0 * (x / (z * (y * y))) elif y <= 2.3: tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666)) else: tmp = y / (z * (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e+67) tmp = Float64(6.0 * Float64(x / Float64(z * Float64(y * y)))); elseif (y <= 2.3) tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666))); else tmp = Float64(y / Float64(z * Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.4e+67) tmp = 6.0 * (x / (z * (y * y))); elseif (y <= 2.3) tmp = (x / z) * (1.0 + ((y * y) * -0.16666666666666666)); else tmp = y / (z * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e+67], N[(6.0 * N[(x / N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+67}:\\
\;\;\;\;6 \cdot \frac{x}{z \cdot \left(y \cdot y\right)}\\
\mathbf{elif}\;y \leq 2.3:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + \left(y \cdot y\right) \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\
\end{array}
\end{array}
if y < -4.4e67Initial program 91.7%
Taylor expanded in y around 0 2.1%
unpow22.1%
Simplified2.1%
distribute-rgt-in2.1%
*-un-lft-identity2.1%
flip-+0.5%
*-commutative0.5%
*-commutative0.5%
associate-*r*0.5%
associate-*r*0.5%
*-commutative0.5%
associate-*r*0.5%
associate-*r*4.4%
*-commutative4.4%
*-commutative4.4%
associate-*r*4.4%
associate-*r*1.2%
*-commutative1.2%
Applied egg-rr1.2%
Taylor expanded in y around 0 33.9%
unpow233.9%
Simplified33.9%
Taylor expanded in y around inf 36.8%
unpow236.8%
*-commutative36.8%
Simplified36.8%
if -4.4e67 < y < 2.2999999999999998Initial program 100.0%
associate-*l/100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 95.0%
unpow294.9%
Simplified95.0%
if 2.2999999999999998 < y Initial program 89.6%
associate-*r/89.7%
associate-/l/88.6%
*-commutative88.6%
times-frac89.7%
Simplified89.7%
Taylor expanded in y around 0 30.9%
*-commutative30.9%
clear-num30.9%
frac-times36.3%
*-un-lft-identity36.3%
Applied egg-rr36.3%
Final simplification68.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -6e+22) (not (<= y 3.5e-23))) (/ y (* z (/ y x))) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6e+22) || !(y <= 3.5e-23)) {
tmp = y / (z * (y / x));
} else {
tmp = x / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-6d+22)) .or. (.not. (y <= 3.5d-23))) then
tmp = y / (z * (y / x))
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6e+22) || !(y <= 3.5e-23)) {
tmp = y / (z * (y / x));
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6e+22) or not (y <= 3.5e-23): tmp = y / (z * (y / x)) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6e+22) || !(y <= 3.5e-23)) tmp = Float64(y / Float64(z * Float64(y / x))); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6e+22) || ~((y <= 3.5e-23))) tmp = y / (z * (y / x)); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6e+22], N[Not[LessEqual[y, 3.5e-23]], $MachinePrecision]], N[(y / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+22} \lor \neg \left(y \leq 3.5 \cdot 10^{-23}\right):\\
\;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -6e22 or 3.49999999999999993e-23 < y Initial program 91.6%
associate-*r/91.7%
associate-/l/88.8%
*-commutative88.8%
times-frac91.6%
Simplified91.6%
Taylor expanded in y around 0 29.5%
*-commutative29.5%
clear-num30.2%
frac-times38.3%
*-un-lft-identity38.3%
Applied egg-rr38.3%
if -6e22 < y < 3.49999999999999993e-23Initial program 100.0%
Taylor expanded in y around 0 98.0%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (if (<= y -4.2e+90) (/ x (/ (* y z) y)) (if (<= y 400000.0) (/ x z) (* (/ y z) (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.2e+90) {
tmp = x / ((y * z) / y);
} else if (y <= 400000.0) {
tmp = x / z;
} else {
tmp = (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 <= (-4.2d+90)) then
tmp = x / ((y * z) / y)
else if (y <= 400000.0d0) then
tmp = x / z
else
tmp = (y / z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.2e+90) {
tmp = x / ((y * z) / y);
} else if (y <= 400000.0) {
tmp = x / z;
} else {
tmp = (y / z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.2e+90: tmp = x / ((y * z) / y) elif y <= 400000.0: tmp = x / z else: tmp = (y / z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.2e+90) tmp = Float64(x / Float64(Float64(y * z) / y)); elseif (y <= 400000.0) tmp = Float64(x / z); else tmp = Float64(Float64(y / z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.2e+90) tmp = x / ((y * z) / y); elseif (y <= 400000.0) tmp = x / z; else tmp = (y / z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.2e+90], N[(x / N[(N[(y * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 400000.0], N[(x / z), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+90}:\\
\;\;\;\;\frac{x}{\frac{y \cdot z}{y}}\\
\mathbf{elif}\;y \leq 400000:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -4.19999999999999961e90Initial program 91.1%
associate-/l*86.7%
associate-/r/86.6%
Simplified86.6%
Taylor expanded in y around 0 19.5%
associate-*l/29.3%
*-commutative29.3%
Applied egg-rr29.3%
if -4.19999999999999961e90 < y < 4e5Initial program 99.9%
Taylor expanded in y around 0 89.4%
if 4e5 < y Initial program 89.1%
associate-*r/89.2%
associate-/l/88.1%
*-commutative88.1%
times-frac89.2%
Simplified89.2%
Taylor expanded in y around 0 30.6%
Final simplification64.3%
(FPCore (x y z) :precision binary64 (if (<= y -2.4) (* 6.0 (/ x (* z (* y y)))) (if (<= y 3.5e-23) (/ x z) (/ y (* z (/ y x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.4) {
tmp = 6.0 * (x / (z * (y * y)));
} else if (y <= 3.5e-23) {
tmp = x / z;
} else {
tmp = y / (z * (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.4d0)) then
tmp = 6.0d0 * (x / (z * (y * y)))
else if (y <= 3.5d-23) then
tmp = x / z
else
tmp = y / (z * (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.4) {
tmp = 6.0 * (x / (z * (y * y)));
} else if (y <= 3.5e-23) {
tmp = x / z;
} else {
tmp = y / (z * (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.4: tmp = 6.0 * (x / (z * (y * y))) elif y <= 3.5e-23: tmp = x / z else: tmp = y / (z * (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.4) tmp = Float64(6.0 * Float64(x / Float64(z * Float64(y * y)))); elseif (y <= 3.5e-23) tmp = Float64(x / z); else tmp = Float64(y / Float64(z * Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.4) tmp = 6.0 * (x / (z * (y * y))); elseif (y <= 3.5e-23) tmp = x / z; else tmp = y / (z * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.4], N[(6.0 * N[(x / N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.5e-23], N[(x / z), $MachinePrecision], N[(y / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4:\\
\;\;\;\;6 \cdot \frac{x}{z \cdot \left(y \cdot y\right)}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-23}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\
\end{array}
\end{array}
if y < -2.39999999999999991Initial program 92.7%
Taylor expanded in y around 0 3.8%
unpow23.8%
Simplified3.8%
distribute-rgt-in3.8%
*-un-lft-identity3.8%
flip-+0.8%
*-commutative0.8%
*-commutative0.8%
associate-*r*0.8%
associate-*r*0.8%
*-commutative0.8%
associate-*r*0.8%
associate-*r*4.1%
*-commutative4.1%
*-commutative4.1%
associate-*r*4.2%
associate-*r*1.3%
*-commutative1.3%
Applied egg-rr1.3%
Taylor expanded in y around 0 30.7%
unpow230.7%
Simplified30.7%
Taylor expanded in y around inf 33.4%
unpow233.4%
*-commutative33.4%
Simplified33.4%
if -2.39999999999999991 < y < 3.49999999999999993e-23Initial program 100.0%
Taylor expanded in y around 0 99.4%
if 3.49999999999999993e-23 < y Initial program 90.8%
associate-*r/90.9%
associate-/l/90.0%
*-commutative90.0%
times-frac90.9%
Simplified90.9%
Taylor expanded in y around 0 37.8%
*-commutative37.8%
clear-num37.8%
frac-times42.6%
*-un-lft-identity42.6%
Applied egg-rr42.6%
Final simplification67.8%
(FPCore (x y z) :precision binary64 (/ x (+ z (* z (* 0.16666666666666666 (* y y))))))
double code(double x, double y, double z) {
return x / (z + (z * (0.16666666666666666 * (y * y))));
}
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 + (z * (0.16666666666666666d0 * (y * y))))
end function
public static double code(double x, double y, double z) {
return x / (z + (z * (0.16666666666666666 * (y * y))));
}
def code(x, y, z): return x / (z + (z * (0.16666666666666666 * (y * y))))
function code(x, y, z) return Float64(x / Float64(z + Float64(z * Float64(0.16666666666666666 * Float64(y * y))))) end
function tmp = code(x, y, z) tmp = x / (z + (z * (0.16666666666666666 * (y * y)))); end
code[x_, y_, z_] := N[(x / N[(z + N[(z * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z + z \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)}
\end{array}
Initial program 95.7%
Taylor expanded in y around 0 53.1%
unpow253.1%
Simplified53.1%
distribute-rgt-in53.1%
*-un-lft-identity53.1%
flip-+34.7%
*-commutative34.7%
*-commutative34.7%
associate-*r*34.7%
associate-*r*34.7%
*-commutative34.7%
associate-*r*34.7%
associate-*r*36.0%
*-commutative36.0%
*-commutative36.0%
associate-*r*36.0%
associate-*r*34.9%
*-commutative34.9%
Applied egg-rr34.9%
Taylor expanded in y around 0 49.9%
unpow249.9%
Simplified49.9%
Taylor expanded in x around 0 68.0%
*-commutative68.0%
unpow268.0%
cancel-sign-sub-inv68.0%
metadata-eval68.0%
unpow268.0%
distribute-lft-in68.0%
*-rgt-identity68.0%
unpow268.0%
Simplified68.0%
Final simplification68.0%
(FPCore (x y z) :precision binary64 (if (<= y 8e-6) (/ x z) (* (/ y z) (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 8e-6) {
tmp = x / z;
} else {
tmp = (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 <= 8d-6) then
tmp = x / z
else
tmp = (y / z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 8e-6) {
tmp = x / z;
} else {
tmp = (y / z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 8e-6: tmp = x / z else: tmp = (y / z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 8e-6) tmp = Float64(x / z); else tmp = Float64(Float64(y / z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 8e-6) tmp = x / z; else tmp = (y / z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 8e-6], N[(x / z), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{-6}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 7.99999999999999964e-6Initial program 97.6%
Taylor expanded in y around 0 72.0%
if 7.99999999999999964e-6 < y Initial program 90.1%
associate-*r/90.2%
associate-/l/89.2%
*-commutative89.2%
times-frac90.1%
Simplified90.1%
Taylor expanded in y around 0 33.3%
Final simplification62.4%
(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.7%
Taylor expanded in y around 0 60.0%
Final simplification60.0%
(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 2023194
(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))