
(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 16 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 (/ (* (/ (cosh x) x) y) z))
double code(double x, double y, double z) {
return ((cosh(x) / x) * 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 = ((cosh(x) / x) * y) / z
end function
public static double code(double x, double y, double z) {
return ((Math.cosh(x) / x) * y) / z;
}
def code(x, y, z): return ((math.cosh(x) / x) * y) / z
function code(x, y, z) return Float64(Float64(Float64(cosh(x) / x) * y) / z) end
function tmp = code(x, y, z) tmp = ((cosh(x) / x) * y) / z; end
code[x_, y_, z_] := N[(N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\cosh x}{x} \cdot y}{z}
\end{array}
Initial program 82.5%
associate-*r/95.8%
associate-/l/83.3%
associate-*l/82.2%
*-commutative82.2%
*-commutative82.2%
Simplified82.2%
*-commutative82.2%
associate-/r*94.3%
associate-*l/95.8%
Applied egg-rr95.8%
Final simplification95.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (cosh x) (/ y x)))) (if (<= t_0 INFINITY) (/ t_0 z) (* y (/ (cosh x) (* x z))))))
double code(double x, double y, double z) {
double t_0 = cosh(x) * (y / x);
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 / z;
} else {
tmp = y * (cosh(x) / (x * z));
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = Math.cosh(x) * (y / x);
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 / z;
} else {
tmp = y * (Math.cosh(x) / (x * z));
}
return tmp;
}
def code(x, y, z): t_0 = math.cosh(x) * (y / x) tmp = 0 if t_0 <= math.inf: tmp = t_0 / z else: tmp = y * (math.cosh(x) / (x * z)) return tmp
function code(x, y, z) t_0 = Float64(cosh(x) * Float64(y / x)) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 / z); else tmp = Float64(y * Float64(cosh(x) / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = cosh(x) * (y / x); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 / z; else tmp = y * (cosh(x) / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 / z), $MachinePrecision], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
\mathbf{if}\;t_0 \leq \infty:\\
\;\;\;\;\frac{t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < +inf.0Initial program 95.2%
if +inf.0 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 0.0%
associate-*r/100.0%
associate-/l/64.7%
associate-*l/64.7%
*-commutative64.7%
*-commutative64.7%
Simplified64.7%
Final simplification91.1%
(FPCore (x y z)
:precision binary64
(if (<= z -1.6e+174)
(* (/ 1.0 (* x (/ z x))) (/ (* x (* y (* z 0.5))) z))
(if (or (<= z -1.2e-40) (not (<= z 9.5e-17)))
(* y (/ (cosh x) (* x z)))
(* (cosh x) (/ (/ y z) x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e+174) {
tmp = (1.0 / (x * (z / x))) * ((x * (y * (z * 0.5))) / z);
} else if ((z <= -1.2e-40) || !(z <= 9.5e-17)) {
tmp = y * (cosh(x) / (x * z));
} else {
tmp = cosh(x) * ((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 (z <= (-1.6d+174)) then
tmp = (1.0d0 / (x * (z / x))) * ((x * (y * (z * 0.5d0))) / z)
else if ((z <= (-1.2d-40)) .or. (.not. (z <= 9.5d-17))) then
tmp = y * (cosh(x) / (x * z))
else
tmp = cosh(x) * ((y / z) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e+174) {
tmp = (1.0 / (x * (z / x))) * ((x * (y * (z * 0.5))) / z);
} else if ((z <= -1.2e-40) || !(z <= 9.5e-17)) {
tmp = y * (Math.cosh(x) / (x * z));
} else {
tmp = Math.cosh(x) * ((y / z) / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.6e+174: tmp = (1.0 / (x * (z / x))) * ((x * (y * (z * 0.5))) / z) elif (z <= -1.2e-40) or not (z <= 9.5e-17): tmp = y * (math.cosh(x) / (x * z)) else: tmp = math.cosh(x) * ((y / z) / x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.6e+174) tmp = Float64(Float64(1.0 / Float64(x * Float64(z / x))) * Float64(Float64(x * Float64(y * Float64(z * 0.5))) / z)); elseif ((z <= -1.2e-40) || !(z <= 9.5e-17)) tmp = Float64(y * Float64(cosh(x) / Float64(x * z))); else tmp = Float64(cosh(x) * Float64(Float64(y / z) / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.6e+174) tmp = (1.0 / (x * (z / x))) * ((x * (y * (z * 0.5))) / z); elseif ((z <= -1.2e-40) || ~((z <= 9.5e-17))) tmp = y * (cosh(x) / (x * z)); else tmp = cosh(x) * ((y / z) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.6e+174], N[(N[(1.0 / N[(x * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(x * N[(y * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.2e-40], N[Not[LessEqual[z, 9.5e-17]], $MachinePrecision]], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+174}:\\
\;\;\;\;\frac{1}{x \cdot \frac{z}{x}} \cdot \frac{x \cdot \left(y \cdot \left(z \cdot 0.5\right)\right)}{z}\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-40} \lor \neg \left(z \leq 9.5 \cdot 10^{-17}\right):\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if z < -1.6e174Initial program 80.3%
Taylor expanded in x around 0 53.1%
+-commutative53.1%
associate-/l*37.9%
*-commutative37.9%
Simplified37.9%
+-commutative37.9%
*-commutative37.9%
associate-*r/34.8%
frac-add4.4%
*-commutative4.4%
*-commutative4.4%
*-commutative4.4%
Applied egg-rr4.4%
+-commutative4.4%
*-commutative4.4%
associate-*l*4.4%
distribute-lft-out4.4%
*-commutative4.4%
*-commutative4.4%
associate-*l*4.4%
Simplified4.4%
Taylor expanded in x around inf 5.2%
associate-*r*5.2%
*-commutative5.2%
*-commutative5.2%
*-commutative5.2%
associate-*l*5.1%
*-commutative5.1%
associate-*l*5.1%
*-commutative5.1%
Simplified5.1%
*-un-lft-identity5.1%
*-commutative5.1%
times-frac61.4%
Applied egg-rr61.4%
if -1.6e174 < z < -1.19999999999999996e-40 or 9.50000000000000029e-17 < z Initial program 76.4%
associate-*r/91.4%
associate-/l/83.9%
associate-*l/83.7%
*-commutative83.7%
*-commutative83.7%
Simplified83.7%
if -1.19999999999999996e-40 < z < 9.50000000000000029e-17Initial program 87.7%
associate-*r/87.7%
associate-/l/89.7%
associate-/r*98.3%
Simplified98.3%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (if (<= z -1e+28) (* (/ y x) (/ (cosh x) z)) (if (<= z 1.1e-14) (* (cosh x) (/ (/ y z) x)) (* y (/ (cosh x) (* x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1e+28) {
tmp = (y / x) * (cosh(x) / z);
} else if (z <= 1.1e-14) {
tmp = cosh(x) * ((y / z) / x);
} 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 (z <= (-1d+28)) then
tmp = (y / x) * (cosh(x) / z)
else if (z <= 1.1d-14) then
tmp = cosh(x) * ((y / z) / x)
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 (z <= -1e+28) {
tmp = (y / x) * (Math.cosh(x) / z);
} else if (z <= 1.1e-14) {
tmp = Math.cosh(x) * ((y / z) / x);
} else {
tmp = y * (Math.cosh(x) / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1e+28: tmp = (y / x) * (math.cosh(x) / z) elif z <= 1.1e-14: tmp = math.cosh(x) * ((y / z) / x) else: tmp = y * (math.cosh(x) / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1e+28) tmp = Float64(Float64(y / x) * Float64(cosh(x) / z)); elseif (z <= 1.1e-14) tmp = Float64(cosh(x) * Float64(Float64(y / z) / x)); 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 (z <= -1e+28) tmp = (y / x) * (cosh(x) / z); elseif (z <= 1.1e-14) tmp = cosh(x) * ((y / z) / x); else tmp = y * (cosh(x) / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1e+28], N[(N[(y / x), $MachinePrecision] * N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e-14], N[(N[Cosh[x], $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+28}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{\cosh x}{z}\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-14}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\
\end{array}
\end{array}
if z < -9.99999999999999958e27Initial program 82.3%
*-commutative82.3%
associate-*r/82.2%
Simplified82.2%
if -9.99999999999999958e27 < z < 1.1e-14Initial program 87.8%
associate-*r/87.8%
associate-/l/89.7%
associate-/r*97.7%
Simplified97.7%
if 1.1e-14 < z Initial program 69.0%
associate-*r/89.4%
associate-/l/75.8%
associate-*l/75.6%
*-commutative75.6%
*-commutative75.6%
Simplified75.6%
Final simplification89.4%
(FPCore (x y z) :precision binary64 (* y (/ (cosh x) (* x z))))
double code(double x, double y, double z) {
return y * (cosh(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 * (cosh(x) / (x * z))
end function
public static double code(double x, double y, double z) {
return y * (Math.cosh(x) / (x * z));
}
def code(x, y, z): return y * (math.cosh(x) / (x * z))
function code(x, y, z) return Float64(y * Float64(cosh(x) / Float64(x * z))) end
function tmp = code(x, y, z) tmp = y * (cosh(x) / (x * z)); end
code[x_, y_, z_] := N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{\cosh x}{x \cdot z}
\end{array}
Initial program 82.5%
associate-*r/95.8%
associate-/l/83.3%
associate-*l/82.2%
*-commutative82.2%
*-commutative82.2%
Simplified82.2%
Final simplification82.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ 1.0 (* x (/ z x))) (/ (* x (* y (* z 0.5))) z))))
(if (<= x -1300000.0)
t_0
(if (<= x 1.4)
(/ (/ y z) x)
(if (<= x 2.95e+193)
(* (/ (* x y) (/ z x)) (/ (* z 0.5) (* x z)))
t_0)))))
double code(double x, double y, double z) {
double t_0 = (1.0 / (x * (z / x))) * ((x * (y * (z * 0.5))) / z);
double tmp;
if (x <= -1300000.0) {
tmp = t_0;
} else if (x <= 1.4) {
tmp = (y / z) / x;
} else if (x <= 2.95e+193) {
tmp = ((x * y) / (z / x)) * ((z * 0.5) / (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 = (1.0d0 / (x * (z / x))) * ((x * (y * (z * 0.5d0))) / z)
if (x <= (-1300000.0d0)) then
tmp = t_0
else if (x <= 1.4d0) then
tmp = (y / z) / x
else if (x <= 2.95d+193) then
tmp = ((x * y) / (z / x)) * ((z * 0.5d0) / (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 = (1.0 / (x * (z / x))) * ((x * (y * (z * 0.5))) / z);
double tmp;
if (x <= -1300000.0) {
tmp = t_0;
} else if (x <= 1.4) {
tmp = (y / z) / x;
} else if (x <= 2.95e+193) {
tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (1.0 / (x * (z / x))) * ((x * (y * (z * 0.5))) / z) tmp = 0 if x <= -1300000.0: tmp = t_0 elif x <= 1.4: tmp = (y / z) / x elif x <= 2.95e+193: tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(1.0 / Float64(x * Float64(z / x))) * Float64(Float64(x * Float64(y * Float64(z * 0.5))) / z)) tmp = 0.0 if (x <= -1300000.0) tmp = t_0; elseif (x <= 1.4) tmp = Float64(Float64(y / z) / x); elseif (x <= 2.95e+193) tmp = Float64(Float64(Float64(x * y) / Float64(z / x)) * Float64(Float64(z * 0.5) / Float64(x * z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (1.0 / (x * (z / x))) * ((x * (y * (z * 0.5))) / z); tmp = 0.0; if (x <= -1300000.0) tmp = t_0; elseif (x <= 1.4) tmp = (y / z) / x; elseif (x <= 2.95e+193) tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 / N[(x * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(x * N[(y * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1300000.0], t$95$0, If[LessEqual[x, 1.4], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 2.95e+193], N[(N[(N[(x * y), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision] * N[(N[(z * 0.5), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{x \cdot \frac{z}{x}} \cdot \frac{x \cdot \left(y \cdot \left(z \cdot 0.5\right)\right)}{z}\\
\mathbf{if}\;x \leq -1300000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{elif}\;x \leq 2.95 \cdot 10^{+193}:\\
\;\;\;\;\frac{x \cdot y}{\frac{z}{x}} \cdot \frac{z \cdot 0.5}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -1.3e6 or 2.9499999999999999e193 < x Initial program 65.8%
Taylor expanded in x around 0 42.1%
+-commutative42.1%
associate-/l*40.7%
*-commutative40.7%
Simplified40.7%
+-commutative40.7%
*-commutative40.7%
associate-*r/39.6%
frac-add40.6%
*-commutative40.6%
*-commutative40.6%
*-commutative40.6%
Applied egg-rr40.6%
+-commutative40.6%
*-commutative40.6%
associate-*l*40.6%
distribute-lft-out40.6%
*-commutative40.6%
*-commutative40.6%
associate-*l*47.4%
Simplified47.4%
Taylor expanded in x around inf 47.4%
associate-*r*47.4%
*-commutative47.4%
*-commutative47.4%
*-commutative47.4%
associate-*l*36.6%
*-commutative36.6%
associate-*l*36.6%
*-commutative36.6%
Simplified36.6%
*-un-lft-identity36.6%
*-commutative36.6%
times-frac58.8%
Applied egg-rr58.8%
if -1.3e6 < x < 1.3999999999999999Initial program 92.3%
associate-*r/92.3%
associate-/l/91.6%
associate-*l/89.5%
*-commutative89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in x around 0 89.4%
div-inv91.6%
associate-/r*93.5%
Applied egg-rr93.5%
if 1.3999999999999999 < x < 2.9499999999999999e193Initial program 79.5%
Taylor expanded in x around 0 17.4%
+-commutative17.4%
associate-/l*28.0%
*-commutative28.0%
Simplified28.0%
+-commutative28.0%
*-commutative28.0%
associate-*r/28.0%
frac-add27.4%
*-commutative27.4%
*-commutative27.4%
*-commutative27.4%
Applied egg-rr27.4%
+-commutative27.4%
*-commutative27.4%
associate-*l*27.4%
distribute-lft-out27.4%
*-commutative27.4%
*-commutative27.4%
associate-*l*29.7%
Simplified29.7%
Taylor expanded in x around inf 29.7%
associate-*r*29.7%
*-commutative29.7%
*-commutative29.7%
*-commutative29.7%
associate-*l*25.3%
*-commutative25.3%
associate-*l*25.3%
*-commutative25.3%
Simplified25.3%
associate-*r*27.6%
*-commutative27.6%
*-commutative27.6%
associate-*r*27.5%
times-frac40.4%
*-commutative40.4%
Applied egg-rr40.4%
Final simplification74.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (* x z))) (t_1 (+ t_0 (* 0.5 (/ (* x y) z)))))
(if (<= y -2e+37)
t_1
(if (<= y 1.25e-261)
(+ t_0 (* y (/ 0.5 (/ z x))))
(if (<= y 5e-11) (/ (+ (/ y x) (* x (* y 0.5))) z) t_1)))))
double code(double x, double y, double z) {
double t_0 = y / (x * z);
double t_1 = t_0 + (0.5 * ((x * y) / z));
double tmp;
if (y <= -2e+37) {
tmp = t_1;
} else if (y <= 1.25e-261) {
tmp = t_0 + (y * (0.5 / (z / x)));
} else if (y <= 5e-11) {
tmp = ((y / x) + (x * (y * 0.5))) / z;
} 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 / (x * z)
t_1 = t_0 + (0.5d0 * ((x * y) / z))
if (y <= (-2d+37)) then
tmp = t_1
else if (y <= 1.25d-261) then
tmp = t_0 + (y * (0.5d0 / (z / x)))
else if (y <= 5d-11) then
tmp = ((y / x) + (x * (y * 0.5d0))) / z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / (x * z);
double t_1 = t_0 + (0.5 * ((x * y) / z));
double tmp;
if (y <= -2e+37) {
tmp = t_1;
} else if (y <= 1.25e-261) {
tmp = t_0 + (y * (0.5 / (z / x)));
} else if (y <= 5e-11) {
tmp = ((y / x) + (x * (y * 0.5))) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y / (x * z) t_1 = t_0 + (0.5 * ((x * y) / z)) tmp = 0 if y <= -2e+37: tmp = t_1 elif y <= 1.25e-261: tmp = t_0 + (y * (0.5 / (z / x))) elif y <= 5e-11: tmp = ((y / x) + (x * (y * 0.5))) / z else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y / Float64(x * z)) t_1 = Float64(t_0 + Float64(0.5 * Float64(Float64(x * y) / z))) tmp = 0.0 if (y <= -2e+37) tmp = t_1; elseif (y <= 1.25e-261) tmp = Float64(t_0 + Float64(y * Float64(0.5 / Float64(z / x)))); elseif (y <= 5e-11) tmp = Float64(Float64(Float64(y / x) + Float64(x * Float64(y * 0.5))) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / (x * z); t_1 = t_0 + (0.5 * ((x * y) / z)); tmp = 0.0; if (y <= -2e+37) tmp = t_1; elseif (y <= 1.25e-261) tmp = t_0 + (y * (0.5 / (z / x))); elseif (y <= 5e-11) tmp = ((y / x) + (x * (y * 0.5))) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(0.5 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e+37], t$95$1, If[LessEqual[y, 1.25e-261], N[(t$95$0 + N[(y * N[(0.5 / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e-11], N[(N[(N[(y / x), $MachinePrecision] + N[(x * N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot z}\\
t_1 := t_0 + 0.5 \cdot \frac{x \cdot y}{z}\\
\mathbf{if}\;y \leq -2 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-261}:\\
\;\;\;\;t_0 + y \cdot \frac{0.5}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-11}:\\
\;\;\;\;\frac{\frac{y}{x} + x \cdot \left(y \cdot 0.5\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.99999999999999991e37 or 5.00000000000000018e-11 < y Initial program 90.8%
Taylor expanded in x around 0 82.4%
if -1.99999999999999991e37 < y < 1.24999999999999995e-261Initial program 78.2%
Taylor expanded in x around 0 55.5%
+-commutative55.5%
associate-/l*64.1%
*-commutative64.1%
Simplified64.1%
clear-num64.1%
un-div-inv64.1%
Applied egg-rr64.1%
associate-/r/65.2%
Applied egg-rr65.2%
if 1.24999999999999995e-261 < y < 5.00000000000000018e-11Initial program 72.5%
Taylor expanded in x around 0 61.2%
associate-*r*61.2%
Simplified61.2%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4) (not (<= x 1.4))) (* (/ (* x y) (/ z x)) (/ (* z 0.5) (* x z))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.4)) {
tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z));
} else {
tmp = (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 ((x <= (-1.4d0)) .or. (.not. (x <= 1.4d0))) then
tmp = ((x * y) / (z / x)) * ((z * 0.5d0) / (x * z))
else
tmp = (y / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.4)) {
tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4) or not (x <= 1.4): tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z)) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4) || !(x <= 1.4)) tmp = Float64(Float64(Float64(x * y) / Float64(z / x)) * Float64(Float64(z * 0.5) / Float64(x * z))); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.4) || ~((x <= 1.4))) tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z)); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4], N[Not[LessEqual[x, 1.4]], $MachinePrecision]], N[(N[(N[(x * y), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision] * N[(N[(z * 0.5), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \lor \neg \left(x \leq 1.4\right):\\
\;\;\;\;\frac{x \cdot y}{\frac{z}{x}} \cdot \frac{z \cdot 0.5}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -1.3999999999999999 or 1.3999999999999999 < x Initial program 70.9%
Taylor expanded in x around 0 32.8%
+-commutative32.8%
associate-/l*35.9%
*-commutative35.9%
Simplified35.9%
+-commutative35.9%
*-commutative35.9%
associate-*r/35.2%
frac-add35.6%
*-commutative35.6%
*-commutative35.6%
*-commutative35.6%
Applied egg-rr35.6%
+-commutative35.6%
*-commutative35.6%
associate-*l*35.6%
distribute-lft-out35.6%
*-commutative35.6%
*-commutative35.6%
associate-*l*40.8%
Simplified40.8%
Taylor expanded in x around inf 40.8%
associate-*r*40.8%
*-commutative40.8%
*-commutative40.8%
*-commutative40.8%
associate-*l*32.4%
*-commutative32.4%
associate-*l*32.4%
*-commutative32.4%
Simplified32.4%
associate-*r*38.4%
*-commutative38.4%
*-commutative38.4%
associate-*r*35.8%
times-frac44.0%
*-commutative44.0%
Applied egg-rr44.0%
if -1.3999999999999999 < x < 1.3999999999999999Initial program 92.3%
associate-*r/92.3%
associate-/l/91.6%
associate-*l/89.5%
*-commutative89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in x around 0 89.4%
div-inv91.6%
associate-/r*93.5%
Applied egg-rr93.5%
Final simplification70.9%
(FPCore (x y z)
:precision binary64
(if (<= x -1.4)
(* (/ (* x y) (/ z x)) (/ (* z 0.5) (* x z)))
(if (<= x 225.0)
(/ (/ y z) x)
(/ y (/ (* z z) (+ (/ z x) (* 0.5 (* x z))))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.4) {
tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z));
} else if (x <= 225.0) {
tmp = (y / z) / x;
} else {
tmp = y / ((z * z) / ((z / x) + (0.5 * (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.4d0)) then
tmp = ((x * y) / (z / x)) * ((z * 0.5d0) / (x * z))
else if (x <= 225.0d0) then
tmp = (y / z) / x
else
tmp = y / ((z * z) / ((z / x) + (0.5d0 * (x * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.4) {
tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z));
} else if (x <= 225.0) {
tmp = (y / z) / x;
} else {
tmp = y / ((z * z) / ((z / x) + (0.5 * (x * z))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.4: tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z)) elif x <= 225.0: tmp = (y / z) / x else: tmp = y / ((z * z) / ((z / x) + (0.5 * (x * z)))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.4) tmp = Float64(Float64(Float64(x * y) / Float64(z / x)) * Float64(Float64(z * 0.5) / Float64(x * z))); elseif (x <= 225.0) tmp = Float64(Float64(y / z) / x); else tmp = Float64(y / Float64(Float64(z * z) / Float64(Float64(z / x) + Float64(0.5 * Float64(x * z))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.4) tmp = ((x * y) / (z / x)) * ((z * 0.5) / (x * z)); elseif (x <= 225.0) tmp = (y / z) / x; else tmp = y / ((z * z) / ((z / x) + (0.5 * (x * z)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.4], N[(N[(N[(x * y), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision] * N[(N[(z * 0.5), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 225.0], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(y / N[(N[(z * z), $MachinePrecision] / N[(N[(z / x), $MachinePrecision] + N[(0.5 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4:\\
\;\;\;\;\frac{x \cdot y}{\frac{z}{x}} \cdot \frac{z \cdot 0.5}{x \cdot z}\\
\mathbf{elif}\;x \leq 225:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z \cdot z}{\frac{z}{x} + 0.5 \cdot \left(x \cdot z\right)}}\\
\end{array}
\end{array}
if x < -1.3999999999999999Initial program 69.0%
Taylor expanded in x around 0 37.1%
+-commutative37.1%
associate-/l*38.6%
*-commutative38.6%
Simplified38.6%
+-commutative38.6%
*-commutative38.6%
associate-*r/38.6%
frac-add40.7%
*-commutative40.7%
*-commutative40.7%
*-commutative40.7%
Applied egg-rr40.7%
+-commutative40.7%
*-commutative40.7%
associate-*l*40.7%
distribute-lft-out40.7%
*-commutative40.7%
*-commutative40.7%
associate-*l*44.1%
Simplified44.1%
Taylor expanded in x around inf 44.1%
associate-*r*44.1%
*-commutative44.1%
*-commutative44.1%
*-commutative44.1%
associate-*l*33.9%
*-commutative33.9%
associate-*l*33.9%
*-commutative33.9%
Simplified33.9%
associate-*r*42.6%
*-commutative42.6%
*-commutative42.6%
associate-*r*40.8%
times-frac47.6%
*-commutative47.6%
Applied egg-rr47.6%
if -1.3999999999999999 < x < 225Initial program 92.3%
associate-*r/92.3%
associate-/l/91.6%
associate-*l/89.5%
*-commutative89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in x around 0 89.4%
div-inv91.6%
associate-/r*93.5%
Applied egg-rr93.5%
if 225 < x Initial program 72.9%
Taylor expanded in x around 0 28.6%
+-commutative28.6%
associate-/l*33.2%
*-commutative33.2%
Simplified33.2%
associate-*r/31.9%
*-commutative31.9%
frac-add30.6%
*-commutative30.6%
*-commutative30.6%
*-commutative30.6%
Applied egg-rr30.6%
Taylor expanded in y around 0 37.4%
associate-/l*40.9%
unpow240.9%
Simplified40.9%
Final simplification71.0%
(FPCore (x y z) :precision binary64 (if (<= y 7.7e-295) (* y (+ (/ 1.0 (* x z)) (* 0.5 (/ x z)))) (/ (- (/ 1.0 x) (* x -0.5)) (/ z y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 7.7e-295) {
tmp = y * ((1.0 / (x * z)) + (0.5 * (x / z)));
} else {
tmp = ((1.0 / x) - (x * -0.5)) / (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 <= 7.7d-295) then
tmp = y * ((1.0d0 / (x * z)) + (0.5d0 * (x / z)))
else
tmp = ((1.0d0 / x) - (x * (-0.5d0))) / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 7.7e-295) {
tmp = y * ((1.0 / (x * z)) + (0.5 * (x / z)));
} else {
tmp = ((1.0 / x) - (x * -0.5)) / (z / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 7.7e-295: tmp = y * ((1.0 / (x * z)) + (0.5 * (x / z))) else: tmp = ((1.0 / x) - (x * -0.5)) / (z / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 7.7e-295) tmp = Float64(y * Float64(Float64(1.0 / Float64(x * z)) + Float64(0.5 * Float64(x / z)))); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(x * -0.5)) / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 7.7e-295) tmp = y * ((1.0 / (x * z)) + (0.5 * (x / z))); else tmp = ((1.0 / x) - (x * -0.5)) / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 7.7e-295], N[(y * N[(N[(1.0 / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.7 \cdot 10^{-295}:\\
\;\;\;\;y \cdot \left(\frac{1}{x \cdot z} + 0.5 \cdot \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - x \cdot -0.5}{\frac{z}{y}}\\
\end{array}
\end{array}
if y < 7.70000000000000018e-295Initial program 83.5%
associate-*r/96.3%
associate-/l/89.0%
associate-*l/88.6%
*-commutative88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in x around 0 69.4%
if 7.70000000000000018e-295 < y Initial program 81.5%
Taylor expanded in x around 0 61.4%
+-commutative61.4%
associate-/l*62.9%
*-commutative62.9%
Simplified62.9%
+-commutative62.9%
*-commutative62.9%
associate-*r/62.3%
frac-add41.0%
*-commutative41.0%
*-commutative41.0%
*-commutative41.0%
Applied egg-rr41.0%
+-commutative41.0%
*-commutative41.0%
associate-*l*41.0%
distribute-lft-out41.0%
*-commutative41.0%
*-commutative41.0%
associate-*l*46.9%
Simplified46.9%
Taylor expanded in z around -inf 65.7%
mul-1-neg65.7%
associate-/l*66.2%
*-commutative66.2%
Simplified66.2%
Final simplification67.9%
(FPCore (x y z) :precision binary64 (if (<= y 3.1e-290) (+ (/ y (* x z)) (* y (/ 0.5 (/ z x)))) (/ (- (/ 1.0 x) (* x -0.5)) (/ z y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.1e-290) {
tmp = (y / (x * z)) + (y * (0.5 / (z / x)));
} else {
tmp = ((1.0 / x) - (x * -0.5)) / (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.1d-290) then
tmp = (y / (x * z)) + (y * (0.5d0 / (z / x)))
else
tmp = ((1.0d0 / x) - (x * (-0.5d0))) / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.1e-290) {
tmp = (y / (x * z)) + (y * (0.5 / (z / x)));
} else {
tmp = ((1.0 / x) - (x * -0.5)) / (z / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.1e-290: tmp = (y / (x * z)) + (y * (0.5 / (z / x))) else: tmp = ((1.0 / x) - (x * -0.5)) / (z / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.1e-290) tmp = Float64(Float64(y / Float64(x * z)) + Float64(y * Float64(0.5 / Float64(z / x)))); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(x * -0.5)) / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.1e-290) tmp = (y / (x * z)) + (y * (0.5 / (z / x))); else tmp = ((1.0 / x) - (x * -0.5)) / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.1e-290], N[(N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * N[(0.5 / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{-290}:\\
\;\;\;\;\frac{y}{x \cdot z} + y \cdot \frac{0.5}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - x \cdot -0.5}{\frac{z}{y}}\\
\end{array}
\end{array}
if y < 3.0999999999999999e-290Initial program 83.5%
Taylor expanded in x around 0 67.8%
+-commutative67.8%
associate-/l*69.2%
*-commutative69.2%
Simplified69.2%
clear-num69.2%
un-div-inv69.2%
Applied egg-rr69.2%
associate-/r/69.9%
Applied egg-rr69.9%
if 3.0999999999999999e-290 < y Initial program 81.5%
Taylor expanded in x around 0 61.4%
+-commutative61.4%
associate-/l*62.9%
*-commutative62.9%
Simplified62.9%
+-commutative62.9%
*-commutative62.9%
associate-*r/62.3%
frac-add41.0%
*-commutative41.0%
*-commutative41.0%
*-commutative41.0%
Applied egg-rr41.0%
+-commutative41.0%
*-commutative41.0%
associate-*l*41.0%
distribute-lft-out41.0%
*-commutative41.0%
*-commutative41.0%
associate-*l*46.9%
Simplified46.9%
Taylor expanded in z around -inf 65.7%
mul-1-neg65.7%
associate-/l*66.2%
*-commutative66.2%
Simplified66.2%
Final simplification68.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4) (not (<= x 1.4))) (* (/ x z) (* y 0.5)) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.4)) {
tmp = (x / z) * (y * 0.5);
} else {
tmp = (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 ((x <= (-1.4d0)) .or. (.not. (x <= 1.4d0))) then
tmp = (x / z) * (y * 0.5d0)
else
tmp = (y / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.4)) {
tmp = (x / z) * (y * 0.5);
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4) or not (x <= 1.4): tmp = (x / z) * (y * 0.5) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4) || !(x <= 1.4)) tmp = Float64(Float64(x / z) * Float64(y * 0.5)); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.4) || ~((x <= 1.4))) tmp = (x / z) * (y * 0.5); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4], N[Not[LessEqual[x, 1.4]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(y * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \lor \neg \left(x \leq 1.4\right):\\
\;\;\;\;\frac{x}{z} \cdot \left(y \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -1.3999999999999999 or 1.3999999999999999 < x Initial program 70.9%
Taylor expanded in x around 0 32.8%
associate-*r*32.8%
Simplified32.8%
Taylor expanded in x around inf 32.8%
associate-*r/36.7%
*-commutative36.7%
*-commutative36.7%
associate-*l*36.0%
Simplified36.0%
if -1.3999999999999999 < x < 1.3999999999999999Initial program 92.3%
associate-*r/92.3%
associate-/l/91.6%
associate-*l/89.5%
*-commutative89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in x around 0 89.4%
div-inv91.6%
associate-/r*93.5%
Applied egg-rr93.5%
Final simplification67.2%
(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 82.5%
Taylor expanded in x around 0 65.1%
associate-*r*65.1%
Simplified65.1%
Final simplification65.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.8e+21) (not (<= z 1.85e-19))) (/ y (* x z)) (/ (/ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e+21) || !(z <= 1.85e-19)) {
tmp = y / (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 ((z <= (-1.8d+21)) .or. (.not. (z <= 1.85d-19))) then
tmp = y / (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 ((z <= -1.8e+21) || !(z <= 1.85e-19)) {
tmp = y / (x * z);
} else {
tmp = (y / x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.8e+21) or not (z <= 1.85e-19): tmp = y / (x * z) else: tmp = (y / x) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.8e+21) || !(z <= 1.85e-19)) tmp = Float64(y / Float64(x * z)); else tmp = Float64(Float64(y / x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.8e+21) || ~((z <= 1.85e-19))) tmp = y / (x * z); else tmp = (y / x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.8e+21], N[Not[LessEqual[z, 1.85e-19]], $MachinePrecision]], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+21} \lor \neg \left(z \leq 1.85 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\end{array}
\end{array}
if z < -1.8e21 or 1.85000000000000003e-19 < z Initial program 76.3%
Taylor expanded in x around 0 50.8%
if -1.8e21 < z < 1.85000000000000003e-19Initial program 87.7%
Taylor expanded in x around 0 60.4%
Final simplification56.1%
(FPCore (x y z) :precision binary64 (if (<= z 7e-18) (/ (/ y z) x) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 7e-18) {
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 <= 7d-18) 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 <= 7e-18) {
tmp = (y / z) / x;
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 7e-18: tmp = (y / z) / x else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 7e-18) 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 <= 7e-18) tmp = (y / z) / x; else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 7e-18], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{-18}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if z < 6.9999999999999997e-18Initial program 86.1%
associate-*r/97.5%
associate-/l/85.3%
associate-*l/83.8%
*-commutative83.8%
*-commutative83.8%
Simplified83.8%
Taylor expanded in x around 0 49.2%
div-inv50.7%
associate-/r*57.9%
Applied egg-rr57.9%
if 6.9999999999999997e-18 < z Initial program 69.6%
Taylor expanded in x around 0 55.3%
Final simplification57.4%
(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 82.5%
Taylor expanded in x around 0 51.7%
Final simplification51.7%
(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 2023257
(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))