
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (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 = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (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 = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (<= y 3.7e+133) (/ (* y (/ (cosh x) x)) z) (/ (cosh x) (* x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.7e+133) {
tmp = (y * (cosh(x) / x)) / z;
} else {
tmp = cosh(x) / (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 <= 3.7d+133) then
tmp = (y * (cosh(x) / x)) / z
else
tmp = cosh(x) / (x * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.7e+133) {
tmp = (y * (Math.cosh(x) / x)) / z;
} else {
tmp = Math.cosh(x) / (x * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.7e+133: tmp = (y * (math.cosh(x) / x)) / z else: tmp = math.cosh(x) / (x * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.7e+133) tmp = Float64(Float64(y * Float64(cosh(x) / x)) / z); else tmp = Float64(cosh(x) / Float64(x * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.7e+133) tmp = (y * (cosh(x) / x)) / z; else tmp = cosh(x) / (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.7e+133], N[(N[(y * N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] / N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.7 \cdot 10^{+133}:\\
\;\;\;\;\frac{y \cdot \frac{\cosh x}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x \cdot \frac{z}{y}}\\
\end{array}
\end{array}
if y < 3.70000000000000023e133Initial program 84.5%
associate-*r/97.6%
associate-/l/79.4%
associate-*l/79.3%
*-commutative79.3%
*-commutative79.3%
Simplified79.3%
*-commutative79.3%
associate-/r*97.6%
associate-*l/97.6%
Applied egg-rr97.6%
if 3.70000000000000023e133 < y Initial program 89.1%
associate-/l*89.1%
associate-/r/99.9%
Simplified99.9%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (<= (/ (* (cosh x) (/ y x)) z) INFINITY) (* (/ y x) (/ (cosh x) z)) (/ (* y (/ (+ 1.0 (* 0.5 (* x x))) x)) z)))
double code(double x, double y, double z) {
double tmp;
if (((cosh(x) * (y / x)) / z) <= ((double) INFINITY)) {
tmp = (y / x) * (cosh(x) / z);
} else {
tmp = (y * ((1.0 + (0.5 * (x * x))) / x)) / z;
}
return tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if (((Math.cosh(x) * (y / x)) / z) <= Double.POSITIVE_INFINITY) {
tmp = (y / x) * (Math.cosh(x) / z);
} else {
tmp = (y * ((1.0 + (0.5 * (x * x))) / x)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((math.cosh(x) * (y / x)) / z) <= math.inf: tmp = (y / x) * (math.cosh(x) / z) else: tmp = (y * ((1.0 + (0.5 * (x * x))) / x)) / z return tmp
function code(x, y, z) tmp = 0.0 if (Float64(Float64(cosh(x) * Float64(y / x)) / z) <= Inf) tmp = Float64(Float64(y / x) * Float64(cosh(x) / z)); else tmp = Float64(Float64(y * Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) / x)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((cosh(x) * (y / x)) / z) <= Inf) tmp = (y / x) * (cosh(x) / z); else tmp = (y * ((1.0 + (0.5 * (x * x))) / x)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], Infinity], N[(N[(y / x), $MachinePrecision] * N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \leq \infty:\\
\;\;\;\;\frac{y}{x} \cdot \frac{\cosh x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{x}}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < +inf.0Initial program 95.7%
*-commutative95.7%
associate-*r/95.8%
Simplified95.8%
if +inf.0 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 0.0%
associate-*r/100.0%
associate-/l/50.0%
associate-*l/50.0%
*-commutative50.0%
*-commutative50.0%
Simplified50.0%
*-commutative50.0%
associate-/r*100.0%
associate-*l/100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 72.2%
unpow229.2%
Simplified72.2%
Final simplification93.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.35e+154) (not (<= x 1.35e+154))) (/ (* y (/ (+ 1.0 (* 0.5 (* x x))) x)) z) (* y (/ (cosh x) (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.35e+154) || !(x <= 1.35e+154)) {
tmp = (y * ((1.0 + (0.5 * (x * x))) / x)) / z;
} else {
tmp = y * (cosh(x) / (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 ((x <= (-1.35d+154)) .or. (.not. (x <= 1.35d+154))) then
tmp = (y * ((1.0d0 + (0.5d0 * (x * x))) / x)) / z
else
tmp = y * (cosh(x) / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.35e+154) || !(x <= 1.35e+154)) {
tmp = (y * ((1.0 + (0.5 * (x * x))) / x)) / z;
} else {
tmp = y * (Math.cosh(x) / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.35e+154) or not (x <= 1.35e+154): tmp = (y * ((1.0 + (0.5 * (x * x))) / x)) / z else: tmp = y * (math.cosh(x) / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.35e+154) || !(x <= 1.35e+154)) tmp = Float64(Float64(y * Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) / x)) / z); else tmp = Float64(y * Float64(cosh(x) / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.35e+154) || ~((x <= 1.35e+154))) tmp = (y * ((1.0 + (0.5 * (x * x))) / x)) / z; else tmp = y * (cosh(x) / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.35e+154], N[Not[LessEqual[x, 1.35e+154]], $MachinePrecision]], N[(N[(y * N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154} \lor \neg \left(x \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\frac{y \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154 or 1.35000000000000003e154 < x Initial program 69.2%
associate-*r/100.0%
associate-/l/49.2%
associate-*l/49.2%
*-commutative49.2%
*-commutative49.2%
Simplified49.2%
*-commutative49.2%
associate-/r*100.0%
associate-*l/100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
unpow249.2%
Simplified100.0%
if -1.35000000000000003e154 < x < 1.35000000000000003e154Initial program 90.7%
associate-*r/94.9%
associate-/l/91.6%
associate-*l/91.6%
*-commutative91.6%
*-commutative91.6%
Simplified91.6%
Final simplification93.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.4e+117) (not (<= y 2.6e+218))) (/ (* y (+ (* x 0.5) (/ 1.0 x))) z) (* y (/ (+ 1.0 (* 0.5 (* x x))) (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.4e+117) || !(y <= 2.6e+218)) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z;
} else {
tmp = y * ((1.0 + (0.5 * (x * x))) / (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 <= (-4.4d+117)) .or. (.not. (y <= 2.6d+218))) then
tmp = (y * ((x * 0.5d0) + (1.0d0 / x))) / z
else
tmp = y * ((1.0d0 + (0.5d0 * (x * x))) / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.4e+117) || !(y <= 2.6e+218)) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z;
} else {
tmp = y * ((1.0 + (0.5 * (x * x))) / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.4e+117) or not (y <= 2.6e+218): tmp = (y * ((x * 0.5) + (1.0 / x))) / z else: tmp = y * ((1.0 + (0.5 * (x * x))) / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.4e+117) || !(y <= 2.6e+218)) tmp = Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z); else tmp = Float64(y * Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.4e+117) || ~((y <= 2.6e+218))) tmp = (y * ((x * 0.5) + (1.0 / x))) / z; else tmp = y * ((1.0 + (0.5 * (x * x))) / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.4e+117], N[Not[LessEqual[y, 2.6e+218]], $MachinePrecision]], N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+117} \lor \neg \left(y \leq 2.6 \cdot 10^{+218}\right):\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{x \cdot z}\\
\end{array}
\end{array}
if y < -4.40000000000000028e117 or 2.60000000000000002e218 < y Initial program 94.8%
associate-*r/94.8%
associate-/l/72.7%
associate-*l/72.7%
*-commutative72.7%
*-commutative72.7%
Simplified72.7%
*-commutative72.7%
associate-/r*100.0%
associate-*l/94.8%
Applied egg-rr94.8%
Taylor expanded in x around 0 87.9%
if -4.40000000000000028e117 < y < 2.60000000000000002e218Initial program 82.7%
associate-*r/96.6%
associate-/l/83.1%
associate-*l/83.0%
*-commutative83.0%
*-commutative83.0%
Simplified83.0%
Taylor expanded in x around 0 65.0%
unpow265.0%
Simplified65.0%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (or (<= x 1.85e-266) (not (<= x 2.1e-150))) (* (/ y x) (/ (+ 1.0 (* 0.5 (* x x))) z)) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= 1.85e-266) || !(x <= 2.1e-150)) {
tmp = (y / x) * ((1.0 + (0.5 * (x * x))) / z);
} else {
tmp = y / (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 ((x <= 1.85d-266) .or. (.not. (x <= 2.1d-150))) then
tmp = (y / x) * ((1.0d0 + (0.5d0 * (x * x))) / z)
else
tmp = y / (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= 1.85e-266) || !(x <= 2.1e-150)) {
tmp = (y / x) * ((1.0 + (0.5 * (x * x))) / z);
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= 1.85e-266) or not (x <= 2.1e-150): tmp = (y / x) * ((1.0 + (0.5 * (x * x))) / z) else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= 1.85e-266) || !(x <= 2.1e-150)) tmp = Float64(Float64(y / x) * Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) / z)); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= 1.85e-266) || ~((x <= 2.1e-150))) tmp = (y / x) * ((1.0 + (0.5 * (x * x))) / z); else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, 1.85e-266], N[Not[LessEqual[x, 2.1e-150]], $MachinePrecision]], N[(N[(y / x), $MachinePrecision] * N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.85 \cdot 10^{-266} \lor \neg \left(x \leq 2.1 \cdot 10^{-150}\right):\\
\;\;\;\;\frac{y}{x} \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if x < 1.8500000000000001e-266 or 2.1000000000000001e-150 < x Initial program 85.9%
*-commutative85.9%
associate-*r/85.9%
Simplified85.9%
Taylor expanded in x around 0 66.2%
unpow259.6%
Simplified66.2%
if 1.8500000000000001e-266 < x < 2.1000000000000001e-150Initial program 80.2%
associate-*r/80.2%
associate-/l/99.8%
associate-*l/99.4%
*-commutative99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in x around 0 99.8%
Final simplification70.1%
(FPCore (x y z) :precision binary64 (if (or (<= x 9e-269) (not (<= x 1.35e+154))) (* (/ y x) (/ (+ 1.0 (* 0.5 (* x x))) z)) (+ (* 0.5 (/ y (/ z x))) (/ y (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= 9e-269) || !(x <= 1.35e+154)) {
tmp = (y / x) * ((1.0 + (0.5 * (x * x))) / z);
} else {
tmp = (0.5 * (y / (z / x))) + (y / (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 ((x <= 9d-269) .or. (.not. (x <= 1.35d+154))) then
tmp = (y / x) * ((1.0d0 + (0.5d0 * (x * x))) / z)
else
tmp = (0.5d0 * (y / (z / x))) + (y / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= 9e-269) || !(x <= 1.35e+154)) {
tmp = (y / x) * ((1.0 + (0.5 * (x * x))) / z);
} else {
tmp = (0.5 * (y / (z / x))) + (y / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= 9e-269) or not (x <= 1.35e+154): tmp = (y / x) * ((1.0 + (0.5 * (x * x))) / z) else: tmp = (0.5 * (y / (z / x))) + (y / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= 9e-269) || !(x <= 1.35e+154)) tmp = Float64(Float64(y / x) * Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) / z)); else tmp = Float64(Float64(0.5 * Float64(y / Float64(z / x))) + Float64(y / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= 9e-269) || ~((x <= 1.35e+154))) tmp = (y / x) * ((1.0 + (0.5 * (x * x))) / z); else tmp = (0.5 * (y / (z / x))) + (y / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, 9e-269], N[Not[LessEqual[x, 1.35e+154]], $MachinePrecision]], N[(N[(y / x), $MachinePrecision] * N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9 \cdot 10^{-269} \lor \neg \left(x \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\frac{y}{x} \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{z}{x}} + \frac{y}{x \cdot z}\\
\end{array}
\end{array}
if x < 9.0000000000000003e-269 or 1.35000000000000003e154 < x Initial program 83.5%
*-commutative83.5%
associate-*r/83.5%
Simplified83.5%
Taylor expanded in x around 0 69.3%
unpow260.4%
Simplified69.3%
if 9.0000000000000003e-269 < x < 1.35000000000000003e154Initial program 88.7%
associate-*r/93.3%
associate-/l/93.0%
associate-*l/92.9%
*-commutative92.9%
*-commutative92.9%
Simplified92.9%
Taylor expanded in x around 0 72.7%
associate-/r*68.0%
+-commutative68.0%
associate-/l*66.9%
associate-/r*71.6%
Simplified71.6%
Final simplification70.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.5 (* x x)))))
(if (or (<= z -5.4e+17) (not (<= z 4e-188)))
(/ (* (/ y x) t_0) z)
(* y (/ t_0 (* x z))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (0.5 * (x * x));
double tmp;
if ((z <= -5.4e+17) || !(z <= 4e-188)) {
tmp = ((y / x) * t_0) / z;
} else {
tmp = y * (t_0 / (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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (0.5d0 * (x * x))
if ((z <= (-5.4d+17)) .or. (.not. (z <= 4d-188))) then
tmp = ((y / x) * t_0) / z
else
tmp = y * (t_0 / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (0.5 * (x * x));
double tmp;
if ((z <= -5.4e+17) || !(z <= 4e-188)) {
tmp = ((y / x) * t_0) / z;
} else {
tmp = y * (t_0 / (x * z));
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (0.5 * (x * x)) tmp = 0 if (z <= -5.4e+17) or not (z <= 4e-188): tmp = ((y / x) * t_0) / z else: tmp = y * (t_0 / (x * z)) return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(0.5 * Float64(x * x))) tmp = 0.0 if ((z <= -5.4e+17) || !(z <= 4e-188)) tmp = Float64(Float64(Float64(y / x) * t_0) / z); else tmp = Float64(y * Float64(t_0 / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (0.5 * (x * x)); tmp = 0.0; if ((z <= -5.4e+17) || ~((z <= 4e-188))) tmp = ((y / x) * t_0) / z; else tmp = y * (t_0 / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[z, -5.4e+17], N[Not[LessEqual[z, 4e-188]], $MachinePrecision]], N[(N[(N[(y / x), $MachinePrecision] * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(t$95$0 / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{+17} \lor \neg \left(z \leq 4 \cdot 10^{-188}\right):\\
\;\;\;\;\frac{\frac{y}{x} \cdot t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t_0}{x \cdot z}\\
\end{array}
\end{array}
if z < -5.4e17 or 3.9999999999999998e-188 < z Initial program 83.3%
Taylor expanded in x around 0 62.7%
unpow251.6%
Simplified62.7%
if -5.4e17 < z < 3.9999999999999998e-188Initial program 88.8%
associate-*r/99.9%
associate-/l/96.8%
associate-*l/96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in x around 0 87.3%
unpow287.3%
Simplified87.3%
Final simplification71.3%
(FPCore (x y z) :precision binary64 (/ (* y (/ (+ 1.0 (* 0.5 (* x x))) x)) z))
double code(double x, double y, double z) {
return (y * ((1.0 + (0.5 * (x * x))) / 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 = (y * ((1.0d0 + (0.5d0 * (x * x))) / x)) / z
end function
public static double code(double x, double y, double z) {
return (y * ((1.0 + (0.5 * (x * x))) / x)) / z;
}
def code(x, y, z): return (y * ((1.0 + (0.5 * (x * x))) / x)) / z
function code(x, y, z) return Float64(Float64(y * Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) / x)) / z) end
function tmp = code(x, y, z) tmp = (y * ((1.0 + (0.5 * (x * x))) / x)) / z; end
code[x_, y_, z_] := N[(N[(y * N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{y \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{x}}{z}
\end{array}
Initial program 85.3%
associate-*r/96.2%
associate-/l/80.9%
associate-*l/80.8%
*-commutative80.8%
*-commutative80.8%
Simplified80.8%
*-commutative80.8%
associate-/r*98.0%
associate-*l/96.2%
Applied egg-rr96.2%
Taylor expanded in x around 0 76.0%
unpow264.1%
Simplified76.0%
Final simplification76.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -28.0) (not (<= x 1.4))) (* 0.5 (/ y (/ z x))) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -28.0) || !(x <= 1.4)) {
tmp = 0.5 * (y / (z / x));
} else {
tmp = y / (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 ((x <= (-28.0d0)) .or. (.not. (x <= 1.4d0))) then
tmp = 0.5d0 * (y / (z / x))
else
tmp = y / (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -28.0) || !(x <= 1.4)) {
tmp = 0.5 * (y / (z / x));
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -28.0) or not (x <= 1.4): tmp = 0.5 * (y / (z / x)) else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -28.0) || !(x <= 1.4)) tmp = Float64(0.5 * Float64(y / Float64(z / x))); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -28.0) || ~((x <= 1.4))) tmp = 0.5 * (y / (z / x)); else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -28.0], N[Not[LessEqual[x, 1.4]], $MachinePrecision]], N[(0.5 * N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -28 \lor \neg \left(x \leq 1.4\right):\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if x < -28 or 1.3999999999999999 < x Initial program 79.7%
associate-*r/100.0%
associate-/l/68.1%
associate-*l/68.1%
*-commutative68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in x around 0 37.7%
unpow237.7%
Simplified37.7%
Taylor expanded in x around inf 42.7%
associate-/l*37.9%
Simplified37.9%
if -28 < x < 1.3999999999999999Initial program 91.8%
associate-*r/91.8%
associate-/l/95.8%
associate-*l/95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around 0 95.2%
Final simplification64.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -28.0) (not (<= x 1.4))) (* (/ 0.5 z) (* y x)) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -28.0) || !(x <= 1.4)) {
tmp = (0.5 / z) * (y * x);
} else {
tmp = y / (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 ((x <= (-28.0d0)) .or. (.not. (x <= 1.4d0))) then
tmp = (0.5d0 / z) * (y * x)
else
tmp = y / (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -28.0) || !(x <= 1.4)) {
tmp = (0.5 / z) * (y * x);
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -28.0) or not (x <= 1.4): tmp = (0.5 / z) * (y * x) else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -28.0) || !(x <= 1.4)) tmp = Float64(Float64(0.5 / z) * Float64(y * x)); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -28.0) || ~((x <= 1.4))) tmp = (0.5 / z) * (y * x); else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -28.0], N[Not[LessEqual[x, 1.4]], $MachinePrecision]], N[(N[(0.5 / z), $MachinePrecision] * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -28 \lor \neg \left(x \leq 1.4\right):\\
\;\;\;\;\frac{0.5}{z} \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if x < -28 or 1.3999999999999999 < x Initial program 79.7%
associate-*r/100.0%
associate-/l/68.1%
associate-*l/68.1%
*-commutative68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in x around 0 37.7%
unpow237.7%
Simplified37.7%
Taylor expanded in x around inf 42.7%
associate-*r/42.7%
*-commutative42.7%
associate-*l*42.7%
Simplified42.7%
associate-/l*37.9%
div-inv37.9%
clear-num37.9%
*-commutative37.9%
associate-*r/37.9%
*-commutative37.9%
associate-*r*37.9%
clear-num37.9%
div-inv37.9%
*-commutative37.9%
associate-*r/37.9%
div-inv37.9%
times-frac42.7%
Applied egg-rr42.7%
Taylor expanded in y around 0 42.7%
if -28 < x < 1.3999999999999999Initial program 91.8%
associate-*r/91.8%
associate-/l/95.8%
associate-*l/95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around 0 95.2%
Final simplification66.9%
(FPCore (x y z) :precision binary64 (/ (* y (+ (* x 0.5) (/ 1.0 x))) z))
double code(double x, double y, double z) {
return (y * ((x * 0.5) + (1.0 / 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 = (y * ((x * 0.5d0) + (1.0d0 / x))) / z
end function
public static double code(double x, double y, double z) {
return (y * ((x * 0.5) + (1.0 / x))) / z;
}
def code(x, y, z): return (y * ((x * 0.5) + (1.0 / x))) / z
function code(x, y, z) return Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z) end
function tmp = code(x, y, z) tmp = (y * ((x * 0.5) + (1.0 / x))) / z; end
code[x_, y_, z_] := N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}
\end{array}
Initial program 85.3%
associate-*r/96.2%
associate-/l/80.9%
associate-*l/80.8%
*-commutative80.8%
*-commutative80.8%
Simplified80.8%
*-commutative80.8%
associate-/r*98.0%
associate-*l/96.2%
Applied egg-rr96.2%
Taylor expanded in x around 0 65.0%
Final simplification65.0%
(FPCore (x y z) :precision binary64 (/ (+ (/ y x) (* x (* y 0.5))) z))
double code(double x, double y, double z) {
return ((y / x) + (x * (y * 0.5))) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((y / x) + (x * (y * 0.5d0))) / z
end function
public static double code(double x, double y, double z) {
return ((y / x) + (x * (y * 0.5))) / z;
}
def code(x, y, z): return ((y / x) + (x * (y * 0.5))) / z
function code(x, y, z) return Float64(Float64(Float64(y / x) + Float64(x * Float64(y * 0.5))) / z) end
function tmp = code(x, y, z) tmp = ((y / x) + (x * (y * 0.5))) / z; end
code[x_, y_, z_] := N[(N[(N[(y / x), $MachinePrecision] + N[(x * N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{x} + x \cdot \left(y \cdot 0.5\right)}{z}
\end{array}
Initial program 85.3%
Taylor expanded in x around 0 65.1%
associate-*r*65.1%
Simplified65.1%
Final simplification65.1%
(FPCore (x y z) :precision binary64 (if (<= z 1.4e-69) (/ (/ y z) x) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.4e-69) {
tmp = (y / z) / x;
} else {
tmp = y / (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 (z <= 1.4d-69) then
tmp = (y / z) / x
else
tmp = y / (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.4e-69) {
tmp = (y / z) / x;
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.4e-69: tmp = (y / z) / x else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.4e-69) tmp = Float64(Float64(y / z) / x); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.4e-69) tmp = (y / z) / x; else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.4e-69], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.4 \cdot 10^{-69}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if z < 1.3999999999999999e-69Initial program 87.1%
associate-*r/97.1%
associate-/l/84.8%
associate-*l/84.7%
*-commutative84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in x around 0 48.0%
div-inv48.1%
associate-/r*56.2%
Applied egg-rr56.2%
if 1.3999999999999999e-69 < z Initial program 81.6%
associate-*r/94.4%
associate-/l/73.1%
associate-*l/73.0%
*-commutative73.0%
*-commutative73.0%
Simplified73.0%
Taylor expanded in x around 0 45.4%
Final simplification52.6%
(FPCore (x y z) :precision binary64 (/ y (* x z)))
double code(double x, double y, double z) {
return 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 = y / (x * z)
end function
public static double code(double x, double y, double z) {
return y / (x * z);
}
def code(x, y, z): return y / (x * z)
function code(x, y, z) return Float64(y / Float64(x * z)) end
function tmp = code(x, y, z) tmp = y / (x * z); end
code[x_, y_, z_] := N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{x \cdot z}
\end{array}
Initial program 85.3%
associate-*r/96.2%
associate-/l/80.9%
associate-*l/80.8%
*-commutative80.8%
*-commutative80.8%
Simplified80.8%
Taylor expanded in x around 0 47.2%
Final simplification47.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (/ y z) x) (cosh x))))
(if (< y -4.618902267687042e-52)
t_0
(if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
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) :: tmp
t_0 = ((y / z) / x) * cosh(x)
if (y < (-4.618902267687042d-52)) then
tmp = t_0
else if (y < 1.038530535935153d-39) then
tmp = ((cosh(x) * y) / x) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * Math.cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((Math.cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y / z) / x) * math.cosh(x) tmp = 0 if y < -4.618902267687042e-52: tmp = t_0 elif y < 1.038530535935153e-39: tmp = ((math.cosh(x) * y) / x) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) / x) * cosh(x)) tmp = 0.0 if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = Float64(Float64(Float64(cosh(x) * y) / x) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y / z) / x) * cosh(x); tmp = 0.0; if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = ((cosh(x) * y) / x) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]}, If[Less[y, -4.618902267687042e-52], t$95$0, If[Less[y, 1.038530535935153e-39], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{z}}{x} \cdot \cosh x\\
\mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
herbie shell --seed 2023199
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))