
(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 10 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 (+ (/ x y) (+ (/ (/ 2.0 t) z) (+ (/ 2.0 t) -2.0))))
double code(double x, double y, double z, double t) {
return (x / y) + (((2.0 / t) / z) + ((2.0 / t) + -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 / t) / z) + ((2.0d0 / t) + (-2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + (((2.0 / t) / z) + ((2.0 / t) + -2.0));
}
def code(x, y, z, t): return (x / y) + (((2.0 / t) / z) + ((2.0 / t) + -2.0))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(Float64(2.0 / t) / z) + Float64(Float64(2.0 / t) + -2.0))) end
function tmp = code(x, y, z, t) tmp = (x / y) + (((2.0 / t) / z) + ((2.0 / t) + -2.0)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \left(\frac{\frac{2}{t}}{z} + \left(\frac{2}{t} + -2\right)\right)
\end{array}
Initial program 84.6%
Taylor expanded in t around 0 99.1%
associate--l+99.1%
associate-*r/99.1%
metadata-eval99.1%
associate-/r*99.1%
metadata-eval99.1%
associate-*r/99.1%
sub-neg99.1%
associate-*r/99.1%
metadata-eval99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1e+21) (not (<= (/ x y) 5e+41))) (+ (/ x y) (/ 2.0 (* t z))) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+21) || !((x / y) <= 5e+41)) {
tmp = (x / y) + (2.0 / (t * z));
} else {
tmp = -2.0 + ((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) :: tmp
if (((x / y) <= (-1d+21)) .or. (.not. ((x / y) <= 5d+41))) then
tmp = (x / y) + (2.0d0 / (t * z))
else
tmp = (-2.0d0) + ((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 tmp;
if (((x / y) <= -1e+21) || !((x / y) <= 5e+41)) {
tmp = (x / y) + (2.0 / (t * z));
} else {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e+21) or not ((x / y) <= 5e+41): tmp = (x / y) + (2.0 / (t * z)) else: tmp = -2.0 + ((2.0 + (2.0 / z)) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1e+21) || !(Float64(x / y) <= 5e+41)) tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(t * z))); else tmp = Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1e+21) || ~(((x / y) <= 5e+41))) tmp = (x / y) + (2.0 / (t * z)); else tmp = -2.0 + ((2.0 + (2.0 / z)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e+21], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e+41]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+21} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{+41}\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -1e21 or 5.00000000000000022e41 < (/.f64 x y) Initial program 83.4%
Taylor expanded in z around 0 88.3%
if -1e21 < (/.f64 x y) < 5.00000000000000022e41Initial program 85.5%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-/r*99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 99.5%
sub-neg99.5%
associate-*r/99.5%
metadata-eval99.5%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.6%
Final simplification94.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= z -2.4e+113)
t_1
(if (<= z -2.4e+43)
(/ 2.0 t)
(if (or (<= z -3e-28) (not (<= z 1.55e-81))) t_1 (/ 2.0 (* t z)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -2.4e+113) {
tmp = t_1;
} else if (z <= -2.4e+43) {
tmp = 2.0 / t;
} else if ((z <= -3e-28) || !(z <= 1.55e-81)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x / y) - 2.0d0
if (z <= (-2.4d+113)) then
tmp = t_1
else if (z <= (-2.4d+43)) then
tmp = 2.0d0 / t
else if ((z <= (-3d-28)) .or. (.not. (z <= 1.55d-81))) then
tmp = t_1
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 t_1 = (x / y) - 2.0;
double tmp;
if (z <= -2.4e+113) {
tmp = t_1;
} else if (z <= -2.4e+43) {
tmp = 2.0 / t;
} else if ((z <= -3e-28) || !(z <= 1.55e-81)) {
tmp = t_1;
} else {
tmp = 2.0 / (t * z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if z <= -2.4e+113: tmp = t_1 elif z <= -2.4e+43: tmp = 2.0 / t elif (z <= -3e-28) or not (z <= 1.55e-81): tmp = t_1 else: tmp = 2.0 / (t * z) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (z <= -2.4e+113) tmp = t_1; elseif (z <= -2.4e+43) tmp = Float64(2.0 / t); elseif ((z <= -3e-28) || !(z <= 1.55e-81)) tmp = t_1; else tmp = Float64(2.0 / Float64(t * z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (z <= -2.4e+113) tmp = t_1; elseif (z <= -2.4e+43) tmp = 2.0 / t; elseif ((z <= -3e-28) || ~((z <= 1.55e-81))) tmp = t_1; else tmp = 2.0 / (t * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[z, -2.4e+113], t$95$1, If[LessEqual[z, -2.4e+43], N[(2.0 / t), $MachinePrecision], If[Or[LessEqual[z, -3e-28], N[Not[LessEqual[z, 1.55e-81]], $MachinePrecision]], t$95$1, N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+113}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{+43}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-28} \lor \neg \left(z \leq 1.55 \cdot 10^{-81}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z}\\
\end{array}
\end{array}
if z < -2.39999999999999983e113 or -2.40000000000000023e43 < z < -3.00000000000000003e-28 or 1.54999999999999994e-81 < z Initial program 74.1%
Taylor expanded in t around inf 68.4%
if -2.39999999999999983e113 < z < -2.40000000000000023e43Initial program 93.5%
Taylor expanded in t around 0 100.0%
associate--l+100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
associate-*r/100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
+-commutative100.0%
metadata-eval100.0%
associate-+l+100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in t around 0 93.9%
Taylor expanded in x around 0 75.6%
if -3.00000000000000003e-28 < z < 1.54999999999999994e-81Initial program 97.8%
Taylor expanded in t around 0 97.8%
associate--l+97.8%
associate-*r/97.8%
metadata-eval97.8%
associate-/r*97.8%
metadata-eval97.8%
associate-*r/97.8%
sub-neg97.8%
associate-*r/97.8%
metadata-eval97.8%
metadata-eval97.8%
Simplified97.8%
Taylor expanded in z around 0 68.0%
Final simplification68.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.8e-28) (not (<= z 5.4e-86))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e-28) || !(z <= 5.4e-86)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} 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) :: tmp
if ((z <= (-5.8d-28)) .or. (.not. (z <= 5.4d-86))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.0d0))
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 tmp;
if ((z <= -5.8e-28) || !(z <= 5.4e-86)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (2.0 + (2.0 / z)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.8e-28) or not (z <= 5.4e-86): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = (2.0 + (2.0 / z)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.8e-28) || !(z <= 5.4e-86)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.8e-28) || ~((z <= 5.4e-86))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = (2.0 + (2.0 / z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e-28], N[Not[LessEqual[z, 5.4e-86]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{-28} \lor \neg \left(z \leq 5.4 \cdot 10^{-86}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if z < -5.80000000000000026e-28 or 5.39999999999999985e-86 < z Initial program 76.4%
Taylor expanded in t around 0 100.0%
associate--l+100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-/r*99.9%
metadata-eval99.9%
associate-*r/99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 93.7%
sub-neg93.7%
associate-*r/93.7%
metadata-eval93.7%
+-commutative93.7%
metadata-eval93.7%
associate-+l+93.7%
+-commutative93.7%
Simplified93.7%
if -5.80000000000000026e-28 < z < 5.39999999999999985e-86Initial program 97.8%
Taylor expanded in t around 0 68.4%
associate-*r/68.4%
metadata-eval68.4%
Simplified68.4%
Final simplification84.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.1e-27) (not (<= z 4.7e-30))) (+ (/ 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 <= -3.1e-27) || !(z <= 4.7e-30)) {
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 <= (-3.1d-27)) .or. (.not. (z <= 4.7d-30))) 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 <= -3.1e-27) || !(z <= 4.7e-30)) {
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 <= -3.1e-27) or not (z <= 4.7e-30): 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 <= -3.1e-27) || !(z <= 4.7e-30)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(t * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.1e-27) || ~((z <= 4.7e-30))) 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, -3.1e-27], N[Not[LessEqual[z, 4.7e-30]], $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[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{-27} \lor \neg \left(z \leq 4.7 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t \cdot z}\\
\end{array}
\end{array}
if z < -3.0999999999999998e-27 or 4.69999999999999969e-30 < z Initial program 74.1%
Taylor expanded in t around 0 100.0%
associate--l+100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-/r*100.0%
metadata-eval100.0%
associate-*r/100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 97.3%
sub-neg97.3%
associate-*r/97.3%
metadata-eval97.3%
+-commutative97.3%
metadata-eval97.3%
associate-+l+97.3%
+-commutative97.3%
Simplified97.3%
if -3.0999999999999998e-27 < z < 4.69999999999999969e-30Initial program 98.0%
Taylor expanded in z around 0 85.4%
Final simplification92.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -7.2e-24)
t_1
(if (<= t 5.5e-38)
(+ (/ x y) (/ 2.0 t))
(if (<= t 40000000000.0) (/ 2.0 (* t z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -7.2e-24) {
tmp = t_1;
} else if (t <= 5.5e-38) {
tmp = (x / y) + (2.0 / t);
} else if (t <= 40000000000.0) {
tmp = 2.0 / (t * z);
} else {
tmp = t_1;
}
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 <= (-7.2d-24)) then
tmp = t_1
else if (t <= 5.5d-38) then
tmp = (x / y) + (2.0d0 / t)
else if (t <= 40000000000.0d0) then
tmp = 2.0d0 / (t * z)
else
tmp = t_1
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 <= -7.2e-24) {
tmp = t_1;
} else if (t <= 5.5e-38) {
tmp = (x / y) + (2.0 / t);
} else if (t <= 40000000000.0) {
tmp = 2.0 / (t * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if t <= -7.2e-24: tmp = t_1 elif t <= 5.5e-38: tmp = (x / y) + (2.0 / t) elif t <= 40000000000.0: tmp = 2.0 / (t * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -7.2e-24) tmp = t_1; elseif (t <= 5.5e-38) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); elseif (t <= 40000000000.0) tmp = Float64(2.0 / Float64(t * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (t <= -7.2e-24) tmp = t_1; elseif (t <= 5.5e-38) tmp = (x / y) + (2.0 / t); elseif (t <= 40000000000.0) tmp = 2.0 / (t * z); else tmp = t_1; 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, -7.2e-24], t$95$1, If[LessEqual[t, 5.5e-38], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 40000000000.0], N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -7.2 \cdot 10^{-24}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-38}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{elif}\;t \leq 40000000000:\\
\;\;\;\;\frac{2}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -7.2000000000000002e-24 or 4e10 < t Initial program 68.8%
Taylor expanded in t around inf 84.3%
if -7.2000000000000002e-24 < t < 5.50000000000000005e-38Initial program 98.1%
Taylor expanded in t around 0 98.3%
associate--l+98.3%
associate-*r/98.3%
metadata-eval98.3%
associate-/r*98.3%
metadata-eval98.3%
associate-*r/98.3%
sub-neg98.3%
associate-*r/98.3%
metadata-eval98.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in z around inf 61.9%
sub-neg61.9%
associate-*r/61.9%
metadata-eval61.9%
+-commutative61.9%
metadata-eval61.9%
associate-+l+61.9%
+-commutative61.9%
Simplified61.9%
Taylor expanded in t around 0 61.9%
if 5.50000000000000005e-38 < t < 4e10Initial program 99.7%
Taylor expanded in t around 0 99.7%
associate--l+99.7%
associate-*r/99.7%
metadata-eval99.7%
associate-/r*99.5%
metadata-eval99.5%
associate-*r/99.5%
sub-neg99.5%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around 0 71.3%
Final simplification72.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -8e-18) (not (<= (/ x y) 1.4e+42))) (/ x y) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -8e-18) || !((x / y) <= 1.4e+42)) {
tmp = x / y;
} else {
tmp = 2.0 / 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 (((x / y) <= (-8d-18)) .or. (.not. ((x / y) <= 1.4d+42))) then
tmp = x / y
else
tmp = 2.0d0 / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -8e-18) || !((x / y) <= 1.4e+42)) {
tmp = x / y;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -8e-18) or not ((x / y) <= 1.4e+42): tmp = x / y else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -8e-18) || !(Float64(x / y) <= 1.4e+42)) tmp = Float64(x / y); else tmp = Float64(2.0 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -8e-18) || ~(((x / y) <= 1.4e+42))) tmp = x / y; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -8e-18], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1.4e+42]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -8 \cdot 10^{-18} \lor \neg \left(\frac{x}{y} \leq 1.4 \cdot 10^{+42}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -8.0000000000000006e-18 or 1.4e42 < (/.f64 x y) Initial program 84.3%
Taylor expanded in x around inf 70.5%
if -8.0000000000000006e-18 < (/.f64 x y) < 1.4e42Initial program 84.8%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-/r*99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 62.9%
sub-neg62.9%
associate-*r/62.9%
metadata-eval62.9%
+-commutative62.9%
metadata-eval62.9%
associate-+l+62.9%
+-commutative62.9%
Simplified62.9%
Taylor expanded in t around 0 28.5%
Taylor expanded in x around 0 28.3%
Final simplification47.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2e+33) (not (<= t 36000000000.0))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2e+33) || !(t <= 36000000000.0)) {
tmp = (x / y) - 2.0;
} 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) :: tmp
if ((t <= (-2d+33)) .or. (.not. (t <= 36000000000.0d0))) then
tmp = (x / y) - 2.0d0
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 tmp;
if ((t <= -2e+33) || !(t <= 36000000000.0)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 + (2.0 / z)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2e+33) or not (t <= 36000000000.0): tmp = (x / y) - 2.0 else: tmp = (2.0 + (2.0 / z)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2e+33) || !(t <= 36000000000.0)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2e+33) || ~((t <= 36000000000.0))) tmp = (x / y) - 2.0; else tmp = (2.0 + (2.0 / z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2e+33], N[Not[LessEqual[t, 36000000000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{+33} \lor \neg \left(t \leq 36000000000\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -1.9999999999999999e33 or 3.6e10 < t Initial program 66.3%
Taylor expanded in t around inf 88.3%
if -1.9999999999999999e33 < t < 3.6e10Initial program 98.3%
Taylor expanded in t around 0 77.7%
associate-*r/77.7%
metadata-eval77.7%
Simplified77.7%
Final simplification82.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.1e-94) (not (<= t 1.35e-149))) (- (/ x y) 2.0) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.1e-94) || !(t <= 1.35e-149)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / 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-94)) .or. (.not. (t <= 1.35d-149))) then
tmp = (x / y) - 2.0d0
else
tmp = 2.0d0 / 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-94) || !(t <= 1.35e-149)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.1e-94) or not (t <= 1.35e-149): tmp = (x / y) - 2.0 else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.1e-94) || !(t <= 1.35e-149)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.1e-94) || ~((t <= 1.35e-149))) tmp = (x / y) - 2.0; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.1e-94], N[Not[LessEqual[t, 1.35e-149]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.1 \cdot 10^{-94} \lor \neg \left(t \leq 1.35 \cdot 10^{-149}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if t < -4.10000000000000001e-94 or 1.35000000000000007e-149 < t Initial program 77.7%
Taylor expanded in t around inf 72.1%
if -4.10000000000000001e-94 < t < 1.35000000000000007e-149Initial program 98.5%
Taylor expanded in t around 0 98.8%
associate--l+98.8%
associate-*r/98.8%
metadata-eval98.8%
associate-/r*98.7%
metadata-eval98.7%
associate-*r/98.7%
sub-neg98.7%
associate-*r/98.7%
metadata-eval98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in z around inf 57.9%
sub-neg57.9%
associate-*r/57.9%
metadata-eval57.9%
+-commutative57.9%
metadata-eval57.9%
associate-+l+57.9%
+-commutative57.9%
Simplified57.9%
Taylor expanded in t around 0 57.9%
Taylor expanded in x around 0 46.4%
Final simplification63.6%
(FPCore (x y z t) :precision binary64 (/ 2.0 t))
double code(double x, double y, double z, double t) {
return 2.0 / t;
}
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 / t
end function
public static double code(double x, double y, double z, double t) {
return 2.0 / t;
}
def code(x, y, z, t): return 2.0 / t
function code(x, y, z, t) return Float64(2.0 / t) end
function tmp = code(x, y, z, t) tmp = 2.0 / t; end
code[x_, y_, z_, t_] := N[(2.0 / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{t}
\end{array}
Initial program 84.6%
Taylor expanded in t around 0 99.1%
associate--l+99.1%
associate-*r/99.1%
metadata-eval99.1%
associate-/r*99.1%
metadata-eval99.1%
associate-*r/99.1%
sub-neg99.1%
associate-*r/99.1%
metadata-eval99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in z around inf 71.2%
sub-neg71.2%
associate-*r/71.2%
metadata-eval71.2%
+-commutative71.2%
metadata-eval71.2%
associate-+l+71.2%
+-commutative71.2%
Simplified71.2%
Taylor expanded in t around 0 51.6%
Taylor expanded in x around 0 21.0%
Final simplification21.0%
(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 2023318
(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))))