
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / y) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / y) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ (/ x y) (/ (+ 2.0 (* (- 1.0 t) (* 2.0 z))) (* z t))))) (if (<= t_1 INFINITY) t_1 (+ (/ x y) (+ (/ 2.0 t) -2.0)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (x / y) + ((2.0 / t) + -2.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (x / y) + ((2.0 / t) + -2.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t)) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (x / y) + ((2.0 / t) + -2.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(1.0 - t) * Float64(2.0 * z))) / Float64(z * t))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t)); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (x / y) + ((2.0 / t) + -2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(1.0 - t), $MachinePrecision] * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{2 + \left(1 - t\right) \cdot \left(2 \cdot z\right)}{z \cdot t}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\end{array}
\end{array}
if (+.f64 (/.f64 x y) (/.f64 (+.f64 2 (*.f64 (*.f64 z 2) (-.f64 1 t))) (*.f64 t z))) < +inf.0Initial program 99.8%
if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 2 (*.f64 (*.f64 z 2) (-.f64 1 t))) (*.f64 t z))) Initial program 0.0%
Taylor expanded in z around inf 88.9%
associate-*r/88.9%
Simplified88.9%
Taylor expanded in t around 0 88.9%
sub-neg88.9%
associate-*r/88.9%
metadata-eval88.9%
metadata-eval88.9%
Simplified88.9%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -3.5e+114)
t_1
(if (<= t -2.1e+90)
(+ -2.0 (/ (/ 2.0 t) z))
(if (or (<= t -5.5e-19) (not (<= t 650000.0)))
t_1
(/ (+ 2.0 (/ 2.0 z)) t))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -3.5e+114) {
tmp = t_1;
} else if (t <= -2.1e+90) {
tmp = -2.0 + ((2.0 / t) / z);
} else if ((t <= -5.5e-19) || !(t <= 650000.0)) {
tmp = t_1;
} else {
tmp = (2.0 + (2.0 / z)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x / y) - 2.0d0
if (t <= (-3.5d+114)) then
tmp = t_1
else if (t <= (-2.1d+90)) then
tmp = (-2.0d0) + ((2.0d0 / t) / z)
else if ((t <= (-5.5d-19)) .or. (.not. (t <= 650000.0d0))) then
tmp = t_1
else
tmp = (2.0d0 + (2.0d0 / z)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -3.5e+114) {
tmp = t_1;
} else if (t <= -2.1e+90) {
tmp = -2.0 + ((2.0 / t) / z);
} else if ((t <= -5.5e-19) || !(t <= 650000.0)) {
tmp = t_1;
} else {
tmp = (2.0 + (2.0 / z)) / t;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if t <= -3.5e+114: tmp = t_1 elif t <= -2.1e+90: tmp = -2.0 + ((2.0 / t) / z) elif (t <= -5.5e-19) or not (t <= 650000.0): tmp = t_1 else: tmp = (2.0 + (2.0 / z)) / t return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -3.5e+114) tmp = t_1; elseif (t <= -2.1e+90) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); elseif ((t <= -5.5e-19) || !(t <= 650000.0)) tmp = t_1; else tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (t <= -3.5e+114) tmp = t_1; elseif (t <= -2.1e+90) tmp = -2.0 + ((2.0 / t) / z); elseif ((t <= -5.5e-19) || ~((t <= 650000.0))) tmp = t_1; else tmp = (2.0 + (2.0 / z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -3.5e+114], t$95$1, If[LessEqual[t, -2.1e+90], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, -5.5e-19], N[Not[LessEqual[t, 650000.0]], $MachinePrecision]], t$95$1, N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -3.5 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.1 \cdot 10^{+90}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\mathbf{elif}\;t \leq -5.5 \cdot 10^{-19} \lor \neg \left(t \leq 650000\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -3.5000000000000001e114 or -2.09999999999999981e90 < t < -5.4999999999999996e-19 or 6.5e5 < t Initial program 79.7%
Taylor expanded in t around inf 85.1%
if -3.5000000000000001e114 < t < -2.09999999999999981e90Initial program 85.5%
Taylor expanded in t around inf 85.5%
*-commutative85.5%
*-commutative85.5%
*-commutative85.5%
associate-*l*85.5%
Simplified85.5%
Taylor expanded in x around 0 99.8%
associate--l+99.8%
associate-*r/99.8%
metadata-eval99.8%
associate-/r*99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 99.6%
if -5.4999999999999996e-19 < t < 6.5e5Initial program 96.9%
Taylor expanded in t around 0 82.5%
associate-*r/82.5%
metadata-eval82.5%
Simplified82.5%
Final simplification84.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.1e-6) (not (<= t 1.0))) (+ (/ (/ 2.0 t) z) (+ (/ x y) -2.0)) (+ (/ x y) (/ (+ 2.0 (* 2.0 z)) (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.1e-6) || !(t <= 1.0)) {
tmp = ((2.0 / t) / z) + ((x / y) + -2.0);
} else {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-4.1d-6)) .or. (.not. (t <= 1.0d0))) then
tmp = ((2.0d0 / t) / z) + ((x / y) + (-2.0d0))
else
tmp = (x / y) + ((2.0d0 + (2.0d0 * z)) / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.1e-6) || !(t <= 1.0)) {
tmp = ((2.0 / t) / z) + ((x / y) + -2.0);
} else {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.1e-6) or not (t <= 1.0): tmp = ((2.0 / t) / z) + ((x / y) + -2.0) else: tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.1e-6) || !(t <= 1.0)) tmp = Float64(Float64(Float64(2.0 / t) / z) + Float64(Float64(x / y) + -2.0)); else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 * z)) / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.1e-6) || ~((t <= 1.0))) tmp = ((2.0 / t) / z) + ((x / y) + -2.0); else tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.1e-6], N[Not[LessEqual[t, 1.0]], $MachinePrecision]], N[(N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.1 \cdot 10^{-6} \lor \neg \left(t \leq 1\right):\\
\;\;\;\;\frac{\frac{2}{t}}{z} + \left(\frac{x}{y} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{z \cdot t}\\
\end{array}
\end{array}
if t < -4.0999999999999997e-6 or 1 < t Initial program 79.6%
Taylor expanded in t around inf 79.2%
*-commutative79.2%
*-commutative79.2%
*-commutative79.2%
associate-*l*79.2%
Simplified79.2%
Taylor expanded in x around 0 99.5%
associate--l+99.5%
associate-*r/99.5%
metadata-eval99.5%
associate-/r*99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
if -4.0999999999999997e-6 < t < 1Initial program 97.0%
Taylor expanded in t around 0 96.7%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.9) (not (<= z 1.0))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (+ (/ (/ 2.0 t) z) (+ (/ x y) -2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.9) || !(z <= 1.0)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = ((2.0 / t) / z) + ((x / y) + -2.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2.9d0)) .or. (.not. (z <= 1.0d0))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.0d0))
else
tmp = ((2.0d0 / t) / z) + ((x / y) + (-2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.9) || !(z <= 1.0)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = ((2.0 / t) / z) + ((x / y) + -2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.9) or not (z <= 1.0): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = ((2.0 / t) / z) + ((x / y) + -2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.9) || !(z <= 1.0)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(Float64(Float64(2.0 / t) / z) + Float64(Float64(x / y) + -2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.9) || ~((z <= 1.0))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = ((2.0 / t) / z) + ((x / y) + -2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.9], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{t}}{z} + \left(\frac{x}{y} + -2\right)\\
\end{array}
\end{array}
if z < -2.89999999999999991 or 1 < z Initial program 80.8%
Taylor expanded in z around inf 99.4%
associate-*r/99.4%
Simplified99.4%
Taylor expanded in t around 0 99.4%
sub-neg99.4%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
if -2.89999999999999991 < z < 1Initial program 96.8%
Taylor expanded in t around inf 96.3%
*-commutative96.3%
*-commutative96.3%
*-commutative96.3%
associate-*l*96.3%
Simplified96.3%
Taylor expanded in x around 0 96.3%
associate--l+96.3%
associate-*r/96.3%
metadata-eval96.3%
associate-/r*96.3%
sub-neg96.3%
metadata-eval96.3%
Simplified96.3%
Final simplification97.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -75.0) (- (/ x y) 2.0) (if (<= (/ x y) 2.45e+92) (+ -2.0 (/ (/ 2.0 t) z)) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -75.0) {
tmp = (x / y) - 2.0;
} else if ((x / y) <= 2.45e+92) {
tmp = -2.0 + ((2.0 / t) / z);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= (-75.0d0)) then
tmp = (x / y) - 2.0d0
else if ((x / y) <= 2.45d+92) then
tmp = (-2.0d0) + ((2.0d0 / t) / z)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -75.0) {
tmp = (x / y) - 2.0;
} else if ((x / y) <= 2.45e+92) {
tmp = -2.0 + ((2.0 / t) / z);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -75.0: tmp = (x / y) - 2.0 elif (x / y) <= 2.45e+92: tmp = -2.0 + ((2.0 / t) / z) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -75.0) tmp = Float64(Float64(x / y) - 2.0); elseif (Float64(x / y) <= 2.45e+92) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -75.0) tmp = (x / y) - 2.0; elseif ((x / y) <= 2.45e+92) tmp = -2.0 + ((2.0 / t) / z); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -75.0], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.45e+92], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -75:\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{elif}\;\frac{x}{y} \leq 2.45 \cdot 10^{+92}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -75Initial program 83.3%
Taylor expanded in t around inf 70.7%
if -75 < (/.f64 x y) < 2.4500000000000001e92Initial program 91.5%
Taylor expanded in t around inf 65.5%
*-commutative65.5%
*-commutative65.5%
*-commutative65.5%
associate-*l*65.5%
Simplified65.5%
Taylor expanded in x around 0 73.8%
associate--l+73.8%
associate-*r/73.8%
metadata-eval73.8%
associate-/r*73.8%
sub-neg73.8%
metadata-eval73.8%
Simplified73.8%
Taylor expanded in x around 0 71.8%
if 2.4500000000000001e92 < (/.f64 x y) Initial program 90.8%
Taylor expanded in x around inf 73.1%
Final simplification71.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.2e-61) (not (<= z 5.5e-45))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (+ -2.0 (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.2e-61) || !(z <= 5.5e-45)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = -2.0 + ((2.0 / t) / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4.2d-61)) .or. (.not. (z <= 5.5d-45))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.0d0))
else
tmp = (-2.0d0) + ((2.0d0 / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.2e-61) || !(z <= 5.5e-45)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = -2.0 + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.2e-61) or not (z <= 5.5e-45): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = -2.0 + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.2e-61) || !(z <= 5.5e-45)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.2e-61) || ~((z <= 5.5e-45))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = -2.0 + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.2e-61], N[Not[LessEqual[z, 5.5e-45]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-61} \lor \neg \left(z \leq 5.5 \cdot 10^{-45}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -4.1999999999999998e-61 or 5.5000000000000003e-45 < z Initial program 83.4%
Taylor expanded in z around inf 94.8%
associate-*r/94.8%
Simplified94.8%
Taylor expanded in t around 0 94.8%
sub-neg94.8%
associate-*r/94.8%
metadata-eval94.8%
metadata-eval94.8%
Simplified94.8%
if -4.1999999999999998e-61 < z < 5.5000000000000003e-45Initial program 96.4%
Taylor expanded in t around inf 96.4%
*-commutative96.4%
*-commutative96.4%
*-commutative96.4%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in x around 0 96.4%
associate--l+96.4%
associate-*r/96.4%
metadata-eval96.4%
associate-/r*96.4%
sub-neg96.4%
metadata-eval96.4%
Simplified96.4%
Taylor expanded in x around 0 78.2%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7e-8) (not (<= z 3e-7))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (+ (/ x y) (/ 2.0 (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7e-8) || !(z <= 3e-7)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (x / y) + (2.0 / (z * t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-7d-8)) .or. (.not. (z <= 3d-7))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.0d0))
else
tmp = (x / y) + (2.0d0 / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7e-8) || !(z <= 3e-7)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (x / y) + (2.0 / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7e-8) or not (z <= 3e-7): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = (x / y) + (2.0 / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7e-8) || !(z <= 3e-7)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7e-8) || ~((z <= 3e-7))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = (x / y) + (2.0 / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7e-8], N[Not[LessEqual[z, 3e-7]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-8} \lor \neg \left(z \leq 3 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -7.00000000000000048e-8 or 2.9999999999999999e-7 < z Initial program 81.3%
Taylor expanded in z around inf 98.6%
associate-*r/98.6%
Simplified98.6%
Taylor expanded in t around 0 98.6%
sub-neg98.6%
associate-*r/98.6%
metadata-eval98.6%
metadata-eval98.6%
Simplified98.6%
if -7.00000000000000048e-8 < z < 2.9999999999999999e-7Initial program 96.8%
Taylor expanded in z around 0 89.6%
Final simplification93.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e-11) (not (<= z 0.00029))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (+ (/ x y) (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-11) || !(z <= 0.00029)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-9d-11)) .or. (.not. (z <= 0.00029d0))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.0d0))
else
tmp = (x / y) + ((2.0d0 / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-11) || !(z <= 0.00029)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e-11) or not (z <= 0.00029): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e-11) || !(z <= 0.00029)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9e-11) || ~((z <= 0.00029))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e-11], N[Not[LessEqual[z, 0.00029]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-11} \lor \neg \left(z \leq 0.00029\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -8.9999999999999999e-11 or 2.9e-4 < z Initial program 81.3%
Taylor expanded in z around inf 98.6%
associate-*r/98.6%
Simplified98.6%
Taylor expanded in t around 0 98.6%
sub-neg98.6%
associate-*r/98.6%
metadata-eval98.6%
metadata-eval98.6%
Simplified98.6%
if -8.9999999999999999e-11 < z < 2.9e-4Initial program 96.8%
Taylor expanded in z around 0 89.6%
associate-/r*89.6%
Simplified89.6%
Final simplification93.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.6e-64) (not (<= z 2.9e-37))) (- (/ x y) 2.0) (/ 2.0 (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.6e-64) || !(z <= 2.9e-37)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-9.6d-64)) .or. (.not. (z <= 2.9d-37))) then
tmp = (x / y) - 2.0d0
else
tmp = 2.0d0 / (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.6e-64) || !(z <= 2.9e-37)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.6e-64) or not (z <= 2.9e-37): tmp = (x / y) - 2.0 else: tmp = 2.0 / (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.6e-64) || !(z <= 2.9e-37)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 / Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9.6e-64) || ~((z <= 2.9e-37))) tmp = (x / y) - 2.0; else tmp = 2.0 / (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.6e-64], N[Not[LessEqual[z, 2.9e-37]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.6 \cdot 10^{-64} \lor \neg \left(z \leq 2.9 \cdot 10^{-37}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -9.59999999999999994e-64 or 2.90000000000000005e-37 < z Initial program 83.2%
Taylor expanded in t around inf 63.1%
if -9.59999999999999994e-64 < z < 2.90000000000000005e-37Initial program 96.4%
Taylor expanded in t around inf 96.4%
*-commutative96.4%
*-commutative96.4%
*-commutative96.4%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in x around 0 96.4%
associate--l+96.4%
associate-*r/96.4%
metadata-eval96.4%
associate-/r*96.4%
sub-neg96.4%
metadata-eval96.4%
Simplified96.4%
Taylor expanded in t around 0 72.1%
Final simplification67.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.5e-66) (not (<= z 3.4e-37))) (- (/ x y) 2.0) (/ (/ 2.0 t) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e-66) || !(z <= 3.4e-37)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / t) / z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5.5d-66)) .or. (.not. (z <= 3.4d-37))) then
tmp = (x / y) - 2.0d0
else
tmp = (2.0d0 / t) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e-66) || !(z <= 3.4e-37)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / t) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.5e-66) or not (z <= 3.4e-37): tmp = (x / y) - 2.0 else: tmp = (2.0 / t) / z return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.5e-66) || !(z <= 3.4e-37)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(2.0 / t) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.5e-66) || ~((z <= 3.4e-37))) tmp = (x / y) - 2.0; else tmp = (2.0 / t) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.5e-66], N[Not[LessEqual[z, 3.4e-37]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-66} \lor \neg \left(z \leq 3.4 \cdot 10^{-37}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -5.50000000000000053e-66 or 3.40000000000000018e-37 < z Initial program 83.2%
Taylor expanded in t around inf 63.1%
if -5.50000000000000053e-66 < z < 3.40000000000000018e-37Initial program 96.4%
Taylor expanded in z around 0 90.2%
associate-/r*90.2%
Simplified90.2%
frac-add78.1%
div-inv77.7%
fma-define77.7%
Applied egg-rr77.7%
*-commutative77.7%
associate-*l/77.6%
*-commutative77.6%
Simplified77.6%
Taylor expanded in x around 0 64.3%
associate-*r/64.3%
Simplified64.3%
Taylor expanded in y around 0 72.1%
associate-/r*72.2%
Simplified72.2%
Final simplification67.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.9e-66) (not (<= z 4.2e-37))) (- (/ x y) 2.0) (/ (/ 2.0 z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.9e-66) || !(z <= 4.2e-37)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / z) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2.9d-66)) .or. (.not. (z <= 4.2d-37))) then
tmp = (x / y) - 2.0d0
else
tmp = (2.0d0 / z) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.9e-66) || !(z <= 4.2e-37)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.9e-66) or not (z <= 4.2e-37): tmp = (x / y) - 2.0 else: tmp = (2.0 / z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.9e-66) || !(z <= 4.2e-37)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(2.0 / z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.9e-66) || ~((z <= 4.2e-37))) tmp = (x / y) - 2.0; else tmp = (2.0 / z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.9e-66], N[Not[LessEqual[z, 4.2e-37]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-66} \lor \neg \left(z \leq 4.2 \cdot 10^{-37}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{z}}{t}\\
\end{array}
\end{array}
if z < -2.90000000000000011e-66 or 4.2000000000000002e-37 < z Initial program 83.2%
Taylor expanded in t around inf 63.1%
if -2.90000000000000011e-66 < z < 4.2000000000000002e-37Initial program 96.4%
Taylor expanded in z around 0 90.2%
associate-/r*90.2%
Simplified90.2%
frac-add78.1%
div-inv77.7%
fma-define77.7%
Applied egg-rr77.7%
*-commutative77.7%
associate-*l/77.6%
*-commutative77.6%
Simplified77.6%
Taylor expanded in x around 0 64.3%
associate-*r/64.3%
Simplified64.3%
Taylor expanded in y around 0 72.1%
*-commutative72.1%
associate-/r*72.2%
Simplified72.2%
Final simplification67.3%
(FPCore (x y z t) :precision binary64 (- (/ x y) 2.0))
double code(double x, double y, double z, double t) {
return (x / y) - 2.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / y) - 2.0d0
end function
public static double code(double x, double y, double z, double t) {
return (x / y) - 2.0;
}
def code(x, y, z, t): return (x / y) - 2.0
function code(x, y, z, t) return Float64(Float64(x / y) - 2.0) end
function tmp = code(x, y, z, t) tmp = (x / y) - 2.0; end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} - 2
\end{array}
Initial program 89.3%
Taylor expanded in t around inf 48.4%
Final simplification48.4%
(FPCore (x y z t) :precision binary64 (/ x y))
double code(double x, double y, double z, double t) {
return x / y;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / y
end function
public static double code(double x, double y, double z, double t) {
return x / y;
}
def code(x, y, z, t): return x / y
function code(x, y, z, t) return Float64(x / y) end
function tmp = code(x, y, z, t) tmp = x / y; end
code[x_, y_, z_, t_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y}
\end{array}
Initial program 89.3%
Taylor expanded in x around inf 32.8%
Final simplification32.8%
(FPCore (x y z t) :precision binary64 (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y))))
double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((2.0d0 / z) + 2.0d0) / t) - (2.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
def code(x, y, z, t): return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(2.0 / z) + 2.0) / t) - Float64(2.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = (((2.0 / z) + 2.0) / t) - (2.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(2.0 / z), $MachinePrecision] + 2.0), $MachinePrecision] / t), $MachinePrecision] - N[(2.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{z} + 2}{t} - \left(2 - \frac{x}{y}\right)
\end{array}
herbie shell --seed 2024034
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:herbie-target
(- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))