
(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 10 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 (if (<= z -0.0052) (* (/ (sin y) y) (/ x z)) (/ x (* z (/ y (sin y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.0052) {
tmp = (sin(y) / y) * (x / z);
} else {
tmp = x / (z * (y / sin(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 (z <= (-0.0052d0)) then
tmp = (sin(y) / y) * (x / z)
else
tmp = x / (z * (y / sin(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.0052) {
tmp = (Math.sin(y) / y) * (x / z);
} else {
tmp = x / (z * (y / Math.sin(y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.0052: tmp = (math.sin(y) / y) * (x / z) else: tmp = x / (z * (y / math.sin(y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.0052) tmp = Float64(Float64(sin(y) / y) * Float64(x / z)); else tmp = Float64(x / Float64(z * Float64(y / sin(y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.0052) tmp = (sin(y) / y) * (x / z); else tmp = x / (z * (y / sin(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.0052], N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z * N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0052:\\
\;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\
\end{array}
\end{array}
if z < -0.0051999999999999998Initial program 99.7%
*-commutative99.7%
associate-*r/99.7%
Simplified99.7%
if -0.0051999999999999998 < z Initial program 96.3%
associate-/l*97.8%
Simplified97.8%
div-inv97.9%
*-commutative97.9%
clear-num97.9%
Applied egg-rr97.9%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (<= y 1.6e-8) (/ x z) (* (sin y) (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.6e-8) {
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 <= 1.6d-8) 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 <= 1.6e-8) {
tmp = x / z;
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.6e-8: tmp = x / z else: tmp = math.sin(y) * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.6e-8) 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 <= 1.6e-8) tmp = x / z; else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.6e-8], 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 1.6 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 1.6000000000000001e-8Initial program 98.9%
associate-*r/87.0%
associate-/l/78.6%
associate-/l*83.6%
associate-/r/77.3%
*-commutative77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in y around 0 74.3%
if 1.6000000000000001e-8 < y Initial program 91.7%
associate-*r/91.8%
associate-/l/91.9%
associate-/l*91.8%
associate-/r/91.9%
*-commutative91.9%
*-commutative91.9%
Simplified91.9%
Final simplification78.5%
(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/96.5%
Simplified96.5%
Final simplification96.5%
(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 1.8e+85) (/ x z) (* y (* x (/ 1.0 (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.8e+85) {
tmp = x / z;
} else {
tmp = y * (x * (1.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 <= 1.8d+85) then
tmp = x / z
else
tmp = y * (x * (1.0d0 / (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.8e+85) {
tmp = x / z;
} else {
tmp = y * (x * (1.0 / (y * z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.8e+85: tmp = x / z else: tmp = y * (x * (1.0 / (y * z))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.8e+85) tmp = Float64(x / z); else tmp = Float64(y * Float64(x * Float64(1.0 / Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.8e+85) tmp = x / z; else tmp = y * (x * (1.0 / (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.8e+85], N[(x / z), $MachinePrecision], N[(y * N[(x * N[(1.0 / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.8 \cdot 10^{+85}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{1}{y \cdot z}\right)\\
\end{array}
\end{array}
if y < 1.7999999999999999e85Initial program 98.9%
associate-*r/88.0%
associate-/l/79.5%
associate-/l*84.1%
associate-/r/78.3%
*-commutative78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in y around 0 69.9%
if 1.7999999999999999e85 < y Initial program 88.5%
associate-*r/88.6%
associate-/l/93.0%
associate-/l*93.0%
associate-/r/93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
associate-*r/93.0%
frac-times90.8%
associate-*l/90.8%
Applied egg-rr90.8%
Taylor expanded in y around 0 16.6%
associate-/l*16.4%
associate-/r/16.8%
Simplified16.8%
*-commutative16.8%
clear-num16.8%
un-div-inv16.8%
Applied egg-rr16.8%
associate-/r/16.4%
associate-*r/20.6%
times-frac23.4%
*-commutative23.4%
un-div-inv23.4%
*-commutative23.4%
associate-*r*32.6%
Applied egg-rr32.6%
Final simplification63.6%
(FPCore (x y z) :precision binary64 (if (<= y 1.2e+132) (/ x z) (* (/ x y) (/ y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.2e+132) {
tmp = x / z;
} else {
tmp = (x / y) * (y / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 1.2d+132) then
tmp = x / z
else
tmp = (x / y) * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.2e+132) {
tmp = x / z;
} else {
tmp = (x / y) * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.2e+132: tmp = x / z else: tmp = (x / y) * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.2e+132) tmp = Float64(x / z); else tmp = Float64(Float64(x / y) * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.2e+132) tmp = x / z; else tmp = (x / y) * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.2e+132], N[(x / z), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.2 \cdot 10^{+132}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < 1.2000000000000001e132Initial program 98.1%
associate-*r/87.6%
associate-/l/80.2%
associate-/l*84.7%
associate-/r/79.0%
*-commutative79.0%
*-commutative79.0%
Simplified79.0%
Taylor expanded in y around 0 67.9%
if 1.2000000000000001e132 < y Initial program 91.5%
associate-*r/91.6%
associate-/l/91.5%
associate-/l*91.5%
associate-/r/91.6%
*-commutative91.6%
*-commutative91.6%
Simplified91.6%
associate-*r/91.5%
frac-times88.8%
associate-*l/88.7%
Applied egg-rr88.7%
Taylor expanded in y around 0 16.8%
associate-/l*16.7%
associate-/r/17.0%
Simplified17.0%
associate-*l/16.8%
associate-/l/25.1%
times-frac21.9%
Applied egg-rr21.9%
Final simplification61.6%
(FPCore (x y z) :precision binary64 (if (<= y 1e+115) (/ x z) (* x (/ y (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1e+115) {
tmp = x / z;
} else {
tmp = x * (y / (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 1d+115) then
tmp = x / z
else
tmp = x * (y / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1e+115) {
tmp = x / z;
} else {
tmp = x * (y / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1e+115: tmp = x / z else: tmp = x * (y / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1e+115) tmp = Float64(x / z); else tmp = Float64(x * Float64(y / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1e+115) tmp = x / z; else tmp = x * (y / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1e+115], N[(x / z), $MachinePrecision], N[(x * N[(y / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+115}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{y \cdot z}\\
\end{array}
\end{array}
if y < 1e115Initial program 98.9%
associate-*r/88.1%
associate-/l/79.7%
associate-/l*84.2%
associate-/r/78.5%
*-commutative78.5%
*-commutative78.5%
Simplified78.5%
Taylor expanded in y around 0 69.3%
if 1e115 < y Initial program 88.0%
associate-*r/88.0%
associate-/l/92.6%
associate-/l*92.7%
associate-/r/92.8%
*-commutative92.8%
*-commutative92.8%
Simplified92.8%
associate-*r/92.6%
frac-times90.4%
associate-*l/90.4%
Applied egg-rr90.4%
Taylor expanded in y around 0 17.3%
associate-/l*17.1%
associate-/r/17.4%
Simplified17.4%
*-commutative17.4%
clear-num17.4%
un-div-inv17.4%
Applied egg-rr17.4%
associate-/r/17.1%
associate-*r/21.4%
times-frac24.3%
*-commutative24.3%
un-div-inv24.3%
associate-*l*24.7%
*-commutative24.7%
un-div-inv24.7%
Applied egg-rr24.7%
Final simplification62.1%
(FPCore (x y z) :precision binary64 (if (<= y 2e+18) (/ x z) (* y (/ (/ x z) y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e+18) {
tmp = x / z;
} else {
tmp = 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 <= 2d+18) then
tmp = x / z
else
tmp = y * ((x / z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e+18) {
tmp = x / z;
} else {
tmp = y * ((x / z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e+18: tmp = x / z else: tmp = y * ((x / z) / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e+18) tmp = Float64(x / z); else tmp = Float64(y * Float64(Float64(x / z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e+18) tmp = x / z; else tmp = y * ((x / z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e+18], N[(x / z), $MachinePrecision], N[(y * N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+18}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{x}{z}}{y}\\
\end{array}
\end{array}
if y < 2e18Initial program 98.9%
associate-*r/87.3%
associate-/l/79.2%
associate-/l*84.1%
associate-/r/77.9%
*-commutative77.9%
*-commutative77.9%
Simplified77.9%
Taylor expanded in y around 0 73.3%
if 2e18 < y Initial program 90.9%
associate-*r/90.9%
associate-/l/91.0%
associate-/l*91.0%
associate-/r/91.1%
*-commutative91.1%
*-commutative91.1%
Simplified91.1%
associate-*r/91.0%
frac-times92.6%
associate-*l/92.7%
Applied egg-rr92.7%
Taylor expanded in y around 0 15.9%
associate-/l*15.7%
associate-/r/16.0%
Simplified16.0%
associate-/l*16.1%
associate-/r/28.2%
Applied egg-rr28.2%
Final simplification63.6%
(FPCore (x y z) :precision binary64 (if (<= y 400.0) (/ x z) (/ y (* z (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 400.0) {
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 <= 400.0d0) 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 <= 400.0) {
tmp = x / z;
} else {
tmp = y / (z * (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 400.0: tmp = x / z else: tmp = y / (z * (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 400.0) 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 <= 400.0) tmp = x / z; else tmp = y / (z * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 400.0], N[(x / z), $MachinePrecision], N[(y / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 400:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\
\end{array}
\end{array}
if y < 400Initial program 98.9%
associate-*r/87.2%
associate-/l/79.0%
associate-/l*84.0%
associate-/r/77.7%
*-commutative77.7%
*-commutative77.7%
Simplified77.7%
Taylor expanded in y around 0 73.4%
if 400 < y Initial program 91.2%
associate-*r/91.2%
associate-/l/91.3%
associate-/l*91.3%
associate-/r/91.4%
*-commutative91.4%
*-commutative91.4%
Simplified91.4%
associate-*r/91.3%
frac-times92.9%
associate-*l/93.0%
Applied egg-rr93.0%
Taylor expanded in y around 0 17.3%
associate-/l*17.1%
associate-/r/17.4%
Simplified17.4%
associate-*l/17.3%
associate-/l/22.3%
times-frac20.3%
Applied egg-rr20.3%
clear-num20.3%
frac-times29.3%
*-un-lft-identity29.3%
Applied egg-rr29.3%
Final simplification63.6%
(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-*r/88.1%
associate-/l/81.7%
associate-/l*85.6%
associate-/r/80.8%
*-commutative80.8%
*-commutative80.8%
Simplified80.8%
Taylor expanded in y around 0 61.0%
Final simplification61.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 2023301
(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))