
(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 11 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 83.8%
Taylor expanded in t around 0 98.7%
associate--l+98.7%
associate-*r/98.7%
metadata-eval98.7%
associate-/r*98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ 2.0 (* t z))) (t_2 (- (/ x y) 2.0)))
(if (<= t -1.35e-7)
t_2
(if (<= t -9.5e-275)
t_1
(if (<= t 2.3e-306) (/ 2.0 t) (if (<= t 1.6e+17) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 / (t * z);
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -1.35e-7) {
tmp = t_2;
} else if (t <= -9.5e-275) {
tmp = t_1;
} else if (t <= 2.3e-306) {
tmp = 2.0 / t;
} else if (t <= 1.6e+17) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = 2.0d0 / (t * z)
t_2 = (x / y) - 2.0d0
if (t <= (-1.35d-7)) then
tmp = t_2
else if (t <= (-9.5d-275)) then
tmp = t_1
else if (t <= 2.3d-306) then
tmp = 2.0d0 / t
else if (t <= 1.6d+17) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 / (t * z);
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -1.35e-7) {
tmp = t_2;
} else if (t <= -9.5e-275) {
tmp = t_1;
} else if (t <= 2.3e-306) {
tmp = 2.0 / t;
} else if (t <= 1.6e+17) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 / (t * z) t_2 = (x / y) - 2.0 tmp = 0 if t <= -1.35e-7: tmp = t_2 elif t <= -9.5e-275: tmp = t_1 elif t <= 2.3e-306: tmp = 2.0 / t elif t <= 1.6e+17: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 / Float64(t * z)) t_2 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -1.35e-7) tmp = t_2; elseif (t <= -9.5e-275) tmp = t_1; elseif (t <= 2.3e-306) tmp = Float64(2.0 / t); elseif (t <= 1.6e+17) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 / (t * z); t_2 = (x / y) - 2.0; tmp = 0.0; if (t <= -1.35e-7) tmp = t_2; elseif (t <= -9.5e-275) tmp = t_1; elseif (t <= 2.3e-306) tmp = 2.0 / t; elseif (t <= 1.6e+17) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -1.35e-7], t$95$2, If[LessEqual[t, -9.5e-275], t$95$1, If[LessEqual[t, 2.3e-306], N[(2.0 / t), $MachinePrecision], If[LessEqual[t, 1.6e+17], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2}{t \cdot z}\\
t_2 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -1.35 \cdot 10^{-7}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -9.5 \cdot 10^{-275}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{-306}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -1.35000000000000004e-7 or 1.6e17 < t Initial program 73.7%
Taylor expanded in t around inf 89.8%
if -1.35000000000000004e-7 < t < -9.49999999999999961e-275 or 2.29999999999999989e-306 < t < 1.6e17Initial program 96.8%
Taylor expanded in t around 0 96.9%
associate--l+96.9%
associate-*r/96.9%
metadata-eval96.9%
associate-/r*96.9%
Simplified96.9%
Taylor expanded in z around 0 59.5%
if -9.49999999999999961e-275 < t < 2.29999999999999989e-306Initial program 99.5%
Taylor expanded in t around 0 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 78.8%
Final simplification77.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -9.2e-8)
t_1
(if (<= t -4.6e-270)
(/ (/ 2.0 t) z)
(if (<= t 3.8e-305)
(/ 2.0 t)
(if (<= t 1.6e+17) (/ 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 <= -9.2e-8) {
tmp = t_1;
} else if (t <= -4.6e-270) {
tmp = (2.0 / t) / z;
} else if (t <= 3.8e-305) {
tmp = 2.0 / t;
} else if (t <= 1.6e+17) {
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 <= (-9.2d-8)) then
tmp = t_1
else if (t <= (-4.6d-270)) then
tmp = (2.0d0 / t) / z
else if (t <= 3.8d-305) then
tmp = 2.0d0 / t
else if (t <= 1.6d+17) 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 <= -9.2e-8) {
tmp = t_1;
} else if (t <= -4.6e-270) {
tmp = (2.0 / t) / z;
} else if (t <= 3.8e-305) {
tmp = 2.0 / t;
} else if (t <= 1.6e+17) {
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 <= -9.2e-8: tmp = t_1 elif t <= -4.6e-270: tmp = (2.0 / t) / z elif t <= 3.8e-305: tmp = 2.0 / t elif t <= 1.6e+17: 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 <= -9.2e-8) tmp = t_1; elseif (t <= -4.6e-270) tmp = Float64(Float64(2.0 / t) / z); elseif (t <= 3.8e-305) tmp = Float64(2.0 / t); elseif (t <= 1.6e+17) 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 <= -9.2e-8) tmp = t_1; elseif (t <= -4.6e-270) tmp = (2.0 / t) / z; elseif (t <= 3.8e-305) tmp = 2.0 / t; elseif (t <= 1.6e+17) 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, -9.2e-8], t$95$1, If[LessEqual[t, -4.6e-270], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 3.8e-305], N[(2.0 / t), $MachinePrecision], If[LessEqual[t, 1.6e+17], 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 -9.2 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -4.6 \cdot 10^{-270}:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{-305}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+17}:\\
\;\;\;\;\frac{2}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.2000000000000003e-8 or 1.6e17 < t Initial program 73.7%
Taylor expanded in t around inf 89.8%
if -9.2000000000000003e-8 < t < -4.6000000000000003e-270Initial program 99.6%
Taylor expanded in z around 0 76.0%
associate-/r*76.1%
Simplified76.1%
Taylor expanded in x around 0 63.4%
associate-/r*63.5%
Simplified63.5%
if -4.6000000000000003e-270 < t < 3.8e-305Initial program 99.5%
Taylor expanded in t around 0 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 78.8%
if 3.8e-305 < t < 1.6e17Initial program 94.4%
Taylor expanded in t around 0 94.5%
associate--l+94.5%
associate-*r/94.5%
metadata-eval94.5%
associate-/r*94.5%
Simplified94.5%
Taylor expanded in z around 0 56.3%
Final simplification77.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+20) (not (<= (/ x y) 1e+42))) (+ (/ x y) (/ (/ 2.0 t) z)) (+ (/ 2.0 (* t z)) (+ (/ 2.0 t) -2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+20) || !((x / y) <= 1e+42)) {
tmp = (x / y) + ((2.0 / t) / z);
} else {
tmp = (2.0 / (t * z)) + ((2.0 / t) + -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 (((x / y) <= (-2d+20)) .or. (.not. ((x / y) <= 1d+42))) then
tmp = (x / y) + ((2.0d0 / t) / z)
else
tmp = (2.0d0 / (t * z)) + ((2.0d0 / t) + (-2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+20) || !((x / y) <= 1e+42)) {
tmp = (x / y) + ((2.0 / t) / z);
} else {
tmp = (2.0 / (t * z)) + ((2.0 / t) + -2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+20) or not ((x / y) <= 1e+42): tmp = (x / y) + ((2.0 / t) / z) else: tmp = (2.0 / (t * z)) + ((2.0 / t) + -2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+20) || !(Float64(x / y) <= 1e+42)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z)); else tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(Float64(2.0 / t) + -2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2e+20) || ~(((x / y) <= 1e+42))) tmp = (x / y) + ((2.0 / t) / z); else tmp = (2.0 / (t * z)) + ((2.0 / t) + -2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+20], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e+42]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+20} \lor \neg \left(\frac{x}{y} \leq 10^{+42}\right):\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -2e20 or 1.00000000000000004e42 < (/.f64 x y) Initial program 82.7%
Taylor expanded in z around 0 93.9%
associate-/r*93.9%
Simplified93.9%
if -2e20 < (/.f64 x y) < 1.00000000000000004e42Initial program 84.7%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in x around 0 95.8%
sub-neg95.8%
associate-*r/95.8%
metadata-eval95.8%
+-commutative95.8%
associate-*r/95.8%
metadata-eval95.8%
metadata-eval95.8%
associate-+r+95.8%
Simplified95.8%
Final simplification94.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -1300000000000.0) (/ x y) (if (<= (/ x y) 0.0011) -2.0 (if (<= (/ x y) 5.3e+41) (/ 2.0 t) (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1300000000000.0) {
tmp = x / y;
} else if ((x / y) <= 0.0011) {
tmp = -2.0;
} else if ((x / y) <= 5.3e+41) {
tmp = 2.0 / t;
} 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) <= (-1300000000000.0d0)) then
tmp = x / y
else if ((x / y) <= 0.0011d0) then
tmp = -2.0d0
else if ((x / y) <= 5.3d+41) then
tmp = 2.0d0 / t
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) <= -1300000000000.0) {
tmp = x / y;
} else if ((x / y) <= 0.0011) {
tmp = -2.0;
} else if ((x / y) <= 5.3e+41) {
tmp = 2.0 / t;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1300000000000.0: tmp = x / y elif (x / y) <= 0.0011: tmp = -2.0 elif (x / y) <= 5.3e+41: tmp = 2.0 / t else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1300000000000.0) tmp = Float64(x / y); elseif (Float64(x / y) <= 0.0011) tmp = -2.0; elseif (Float64(x / y) <= 5.3e+41) tmp = Float64(2.0 / t); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -1300000000000.0) tmp = x / y; elseif ((x / y) <= 0.0011) tmp = -2.0; elseif ((x / y) <= 5.3e+41) tmp = 2.0 / t; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1300000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 0.0011], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 5.3e+41], N[(2.0 / t), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1300000000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 0.0011:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 5.3 \cdot 10^{+41}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.3e12 or 5.2999999999999997e41 < (/.f64 x y) Initial program 82.8%
Taylor expanded in x around inf 77.4%
if -1.3e12 < (/.f64 x y) < 0.00110000000000000007Initial program 86.1%
Taylor expanded in t around inf 44.2%
Taylor expanded in x around 0 42.7%
if 0.00110000000000000007 < (/.f64 x y) < 5.2999999999999997e41Initial program 72.9%
Taylor expanded in t around 0 74.2%
associate-*r/74.2%
metadata-eval74.2%
Simplified74.2%
Taylor expanded in z around inf 55.0%
Final simplification59.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.75e-36) (not (<= z 2.5e-13))) (+ (/ 2.0 t) (+ (/ x y) -2.0)) (+ (/ x y) (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e-36) || !(z <= 2.5e-13)) {
tmp = (2.0 / t) + ((x / y) + -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 <= (-1.75d-36)) .or. (.not. (z <= 2.5d-13))) then
tmp = (2.0d0 / t) + ((x / y) + (-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 <= -1.75e-36) || !(z <= 2.5e-13)) {
tmp = (2.0 / t) + ((x / y) + -2.0);
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.75e-36) or not (z <= 2.5e-13): tmp = (2.0 / t) + ((x / y) + -2.0) else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.75e-36) || !(z <= 2.5e-13)) tmp = Float64(Float64(2.0 / t) + Float64(Float64(x / y) + -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 <= -1.75e-36) || ~((z <= 2.5e-13))) tmp = (2.0 / t) + ((x / y) + -2.0); else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.75e-36], N[Not[LessEqual[z, 2.5e-13]], $MachinePrecision]], N[(N[(2.0 / t), $MachinePrecision] + N[(N[(x / y), $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 -1.75 \cdot 10^{-36} \lor \neg \left(z \leq 2.5 \cdot 10^{-13}\right):\\
\;\;\;\;\frac{2}{t} + \left(\frac{x}{y} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -1.75e-36 or 2.49999999999999995e-13 < z Initial program 71.7%
Taylor expanded in t around 0 100.0%
associate--l+100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in z around inf 98.7%
associate--l+98.7%
associate-*r/98.7%
metadata-eval98.7%
sub-neg98.7%
metadata-eval98.7%
Simplified98.7%
if -1.75e-36 < z < 2.49999999999999995e-13Initial program 97.3%
Taylor expanded in z around 0 87.5%
associate-/r*87.6%
Simplified87.6%
Final simplification93.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -220000000.0) (not (<= t 5e+19))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -220000000.0) || !(t <= 5e+19)) {
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 <= (-220000000.0d0)) .or. (.not. (t <= 5d+19))) 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 <= -220000000.0) || !(t <= 5e+19)) {
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 <= -220000000.0) or not (t <= 5e+19): 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 <= -220000000.0) || !(t <= 5e+19)) 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 <= -220000000.0) || ~((t <= 5e+19))) 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, -220000000.0], N[Not[LessEqual[t, 5e+19]], $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 -220000000 \lor \neg \left(t \leq 5 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -2.2e8 or 5e19 < t Initial program 73.2%
Taylor expanded in t around inf 90.9%
if -2.2e8 < t < 5e19Initial program 97.0%
Taylor expanded in t around 0 85.5%
associate-*r/85.5%
metadata-eval85.5%
Simplified85.5%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (<= t -1.18e-7) (+ (/ 2.0 t) (+ (/ x y) -2.0)) (if (<= t 5e+19) (/ (+ 2.0 (/ 2.0 z)) t) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.18e-7) {
tmp = (2.0 / t) + ((x / y) + -2.0);
} else if (t <= 5e+19) {
tmp = (2.0 + (2.0 / z)) / t;
} else {
tmp = (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 (t <= (-1.18d-7)) then
tmp = (2.0d0 / t) + ((x / y) + (-2.0d0))
else if (t <= 5d+19) then
tmp = (2.0d0 + (2.0d0 / z)) / t
else
tmp = (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 (t <= -1.18e-7) {
tmp = (2.0 / t) + ((x / y) + -2.0);
} else if (t <= 5e+19) {
tmp = (2.0 + (2.0 / z)) / t;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.18e-7: tmp = (2.0 / t) + ((x / y) + -2.0) elif t <= 5e+19: tmp = (2.0 + (2.0 / z)) / t else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.18e-7) tmp = Float64(Float64(2.0 / t) + Float64(Float64(x / y) + -2.0)); elseif (t <= 5e+19) tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.18e-7) tmp = (2.0 / t) + ((x / y) + -2.0); elseif (t <= 5e+19) tmp = (2.0 + (2.0 / z)) / t; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.18e-7], N[(N[(2.0 / t), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5e+19], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.18 \cdot 10^{-7}:\\
\;\;\;\;\frac{2}{t} + \left(\frac{x}{y} + -2\right)\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+19}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if t < -1.18e-7Initial program 74.6%
Taylor expanded in t around 0 100.0%
associate--l+100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in z around inf 90.7%
associate--l+90.7%
associate-*r/90.7%
metadata-eval90.7%
sub-neg90.7%
metadata-eval90.7%
Simplified90.7%
if -1.18e-7 < t < 5e19Initial program 97.0%
Taylor expanded in t around 0 85.8%
associate-*r/85.8%
metadata-eval85.8%
Simplified85.8%
if 5e19 < t Initial program 72.2%
Taylor expanded in t around inf 91.1%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.7e-6) (not (<= t 1.65e-51))) (- (/ x y) 2.0) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.7e-6) || !(t <= 1.65e-51)) {
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 <= (-1.7d-6)) .or. (.not. (t <= 1.65d-51))) 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 <= -1.7e-6) || !(t <= 1.65e-51)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.7e-6) or not (t <= 1.65e-51): tmp = (x / y) - 2.0 else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.7e-6) || !(t <= 1.65e-51)) 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 <= -1.7e-6) || ~((t <= 1.65e-51))) tmp = (x / y) - 2.0; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.7e-6], N[Not[LessEqual[t, 1.65e-51]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{-6} \lor \neg \left(t \leq 1.65 \cdot 10^{-51}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if t < -1.70000000000000003e-6 or 1.64999999999999986e-51 < t Initial program 75.4%
Taylor expanded in t around inf 86.0%
if -1.70000000000000003e-6 < t < 1.64999999999999986e-51Initial program 96.7%
Taylor expanded in t around 0 87.9%
associate-*r/87.9%
metadata-eval87.9%
Simplified87.9%
Taylor expanded in z around inf 34.9%
Final simplification65.8%
(FPCore (x y z t) :precision binary64 (if (<= t -5.7e+20) -2.0 (if (<= t 1.6e+17) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.7e+20) {
tmp = -2.0;
} else if (t <= 1.6e+17) {
tmp = 2.0 / t;
} else {
tmp = -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 (t <= (-5.7d+20)) then
tmp = -2.0d0
else if (t <= 1.6d+17) then
tmp = 2.0d0 / t
else
tmp = -2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.7e+20) {
tmp = -2.0;
} else if (t <= 1.6e+17) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.7e+20: tmp = -2.0 elif t <= 1.6e+17: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.7e+20) tmp = -2.0; elseif (t <= 1.6e+17) tmp = Float64(2.0 / t); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5.7e+20) tmp = -2.0; elseif (t <= 1.6e+17) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.7e+20], -2.0, If[LessEqual[t, 1.6e+17], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.7 \cdot 10^{+20}:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+17}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -5.7e20 or 1.6e17 < t Initial program 73.4%
Taylor expanded in t around inf 90.2%
Taylor expanded in x around 0 37.5%
if -5.7e20 < t < 1.6e17Initial program 97.0%
Taylor expanded in t around 0 85.4%
associate-*r/85.4%
metadata-eval85.4%
Simplified85.4%
Taylor expanded in z around inf 32.0%
Final simplification35.1%
(FPCore (x y z t) :precision binary64 -2.0)
double code(double x, double y, double z, double t) {
return -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 = -2.0d0
end function
public static double code(double x, double y, double z, double t) {
return -2.0;
}
def code(x, y, z, t): return -2.0
function code(x, y, z, t) return -2.0 end
function tmp = code(x, y, z, t) tmp = -2.0; end
code[x_, y_, z_, t_] := -2.0
\begin{array}{l}
\\
-2
\end{array}
Initial program 83.8%
Taylor expanded in t around inf 58.4%
Taylor expanded in x around 0 22.1%
Final simplification22.1%
(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 2024096
(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))))