
(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 (/ (* 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.9%
Final simplification97.9%
(FPCore (x y z) :precision binary64 (if (<= y 1.5e-8) (/ x z) (* (sin y) (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.5e-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.5d-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.5e-8) {
tmp = x / z;
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.5e-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.5e-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.5e-8) tmp = x / z; else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.5e-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.5 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 1.49999999999999987e-8Initial program 99.7%
associate-*l/98.4%
times-frac78.1%
*-commutative78.1%
associate-*r/82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in y around 0 74.0%
if 1.49999999999999987e-8 < y Initial program 92.9%
associate-*l/92.5%
times-frac92.8%
*-commutative92.8%
associate-*r/92.7%
*-commutative92.7%
Simplified92.7%
Final simplification78.9%
(FPCore (x y z) :precision binary64 (if (<= y 0.00035) (/ (* 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.00035) {
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.00035d0) 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.00035) {
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.00035: 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.00035) 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.00035) 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.00035], 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.00035:\\
\;\;\;\;\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 < 3.49999999999999996e-4Initial program 99.7%
Taylor expanded in y around 0 67.7%
unpow267.7%
Simplified67.7%
if 3.49999999999999996e-4 < y Initial program 92.8%
associate-*r/92.8%
associate-/l/92.7%
*-commutative92.7%
times-frac92.7%
Simplified92.7%
Final simplification74.2%
(FPCore (x y z) :precision binary64 (if (<= y 6200.0) (/ (* x (+ 1.0 (* -0.16666666666666666 (* y y)))) z) (/ y (/ (* y z) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= 6200.0) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = y / ((y * z) / 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 <= 6200.0d0) then
tmp = (x * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))) / z
else
tmp = y / ((y * z) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 6200.0) {
tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z;
} else {
tmp = y / ((y * z) / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6200.0: tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z else: tmp = y / ((y * z) / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6200.0) tmp = Float64(Float64(x * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))) / z); else tmp = Float64(y / Float64(Float64(y * z) / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 6200.0) tmp = (x * (1.0 + (-0.16666666666666666 * (y * y)))) / z; else tmp = y / ((y * z) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 6200.0], N[(N[(x * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y / N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6200:\\
\;\;\;\;\frac{x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{y \cdot z}{x}}\\
\end{array}
\end{array}
if y < 6200Initial program 99.7%
Taylor expanded in y around 0 67.9%
unpow267.9%
Simplified67.9%
if 6200 < y Initial program 92.5%
associate-*r/92.6%
associate-/l/92.5%
*-commutative92.5%
times-frac92.5%
Simplified92.5%
Taylor expanded in y around 0 23.3%
frac-times27.5%
associate-/l*35.5%
associate-*l/35.3%
*-commutative35.3%
Applied egg-rr35.3%
Taylor expanded in y around 0 35.5%
Final simplification59.8%
(FPCore (x y z) :precision binary64 (if (<= y 1.15e+84) (/ x z) (* (/ x y) (/ y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.15e+84) {
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.15d+84) 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.15e+84) {
tmp = x / z;
} else {
tmp = (x / y) * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.15e+84: tmp = x / z else: tmp = (x / y) * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.15e+84) 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.15e+84) tmp = x / z; else tmp = (x / y) * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.15e+84], 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.15 \cdot 10^{+84}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < 1.1499999999999999e84Initial program 99.7%
associate-*l/98.5%
times-frac80.1%
*-commutative80.1%
associate-*r/83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in y around 0 68.2%
if 1.1499999999999999e84 < y Initial program 89.2%
associate-*r/89.3%
associate-/l/91.1%
*-commutative91.1%
times-frac89.2%
Simplified89.2%
Taylor expanded in y around 0 25.4%
Final simplification61.0%
(FPCore (x y z) :precision binary64 (if (<= y 4e-11) (/ x z) (/ x (/ (* y z) y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 4e-11) {
tmp = x / z;
} else {
tmp = x / ((y * 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 <= 4d-11) then
tmp = x / z
else
tmp = x / ((y * z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4e-11) {
tmp = x / z;
} else {
tmp = x / ((y * z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4e-11: tmp = x / z else: tmp = x / ((y * z) / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4e-11) tmp = Float64(x / z); else tmp = Float64(x / Float64(Float64(y * z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4e-11) tmp = x / z; else tmp = x / ((y * z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4e-11], N[(x / z), $MachinePrecision], N[(x / N[(N[(y * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y \cdot z}{y}}\\
\end{array}
\end{array}
if y < 3.99999999999999976e-11Initial program 99.7%
associate-*l/98.4%
times-frac78.1%
*-commutative78.1%
associate-*r/82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in y around 0 74.0%
if 3.99999999999999976e-11 < y Initial program 92.9%
associate-/l*92.5%
associate-/r/92.7%
Simplified92.7%
Taylor expanded in y around 0 21.5%
*-commutative21.5%
associate-*r/31.8%
Applied egg-rr31.8%
Final simplification63.0%
(FPCore (x y z) :precision binary64 (if (<= y 2.4e-11) (/ x z) (/ y (* y (/ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.4e-11) {
tmp = x / z;
} else {
tmp = y / (y * (z / 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.4d-11) then
tmp = x / z
else
tmp = y / (y * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.4e-11) {
tmp = x / z;
} else {
tmp = y / (y * (z / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.4e-11: tmp = x / z else: tmp = y / (y * (z / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.4e-11) tmp = Float64(x / z); else tmp = Float64(y / Float64(y * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.4e-11) tmp = x / z; else tmp = y / (y * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.4e-11], N[(x / z), $MachinePrecision], N[(y / N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < 2.4000000000000001e-11Initial program 99.7%
associate-*l/98.4%
times-frac78.1%
*-commutative78.1%
associate-*r/82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in y around 0 74.0%
if 2.4000000000000001e-11 < y Initial program 92.9%
associate-*r/92.9%
associate-/l/92.8%
*-commutative92.8%
times-frac92.8%
Simplified92.8%
Taylor expanded in y around 0 24.3%
frac-times28.5%
associate-/l*36.1%
associate-*l/35.9%
*-commutative35.9%
Applied egg-rr35.9%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (if (<= y 0.00082) (/ x z) (/ y (* z (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00082) {
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 <= 0.00082d0) 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 <= 0.00082) {
tmp = x / z;
} else {
tmp = y / (z * (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00082: tmp = x / z else: tmp = y / (z * (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00082) 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 <= 0.00082) tmp = x / z; else tmp = y / (z * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00082], N[(x / z), $MachinePrecision], N[(y / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00082:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\
\end{array}
\end{array}
if y < 8.1999999999999998e-4Initial program 99.7%
associate-*l/98.4%
times-frac78.2%
*-commutative78.2%
associate-*r/82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in y around 0 74.1%
if 8.1999999999999998e-4 < y Initial program 92.8%
associate-*r/92.8%
associate-/l/92.7%
*-commutative92.7%
times-frac92.7%
Simplified92.7%
Taylor expanded in y around 0 23.2%
*-commutative23.2%
clear-num23.2%
frac-times35.1%
*-un-lft-identity35.1%
Applied egg-rr35.1%
Final simplification64.1%
(FPCore (x y z) :precision binary64 (if (<= y 0.00011) (/ x z) (/ y (/ (* y z) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.00011) {
tmp = x / z;
} else {
tmp = y / ((y * z) / 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.00011d0) then
tmp = x / z
else
tmp = y / ((y * z) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.00011) {
tmp = x / z;
} else {
tmp = y / ((y * z) / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.00011: tmp = x / z else: tmp = y / ((y * z) / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.00011) tmp = Float64(x / z); else tmp = Float64(y / Float64(Float64(y * z) / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.00011) tmp = x / z; else tmp = y / ((y * z) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.00011], N[(x / z), $MachinePrecision], N[(y / N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00011:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{y \cdot z}{x}}\\
\end{array}
\end{array}
if y < 1.10000000000000004e-4Initial program 99.7%
associate-*l/98.4%
times-frac78.2%
*-commutative78.2%
associate-*r/82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in y around 0 74.1%
if 1.10000000000000004e-4 < y Initial program 92.8%
associate-*r/92.8%
associate-/l/92.7%
*-commutative92.7%
times-frac92.7%
Simplified92.7%
Taylor expanded in y around 0 23.2%
frac-times27.4%
associate-/l*35.1%
associate-*l/34.9%
*-commutative34.9%
Applied egg-rr34.9%
Taylor expanded in y around 0 35.1%
Final simplification64.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.9%
associate-*l/96.8%
times-frac81.9%
*-commutative81.9%
associate-*r/85.1%
*-commutative85.1%
Simplified85.1%
Taylor expanded in y around 0 60.3%
Final simplification60.3%
(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 2023258
(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))