
(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 12 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(2.0 / Float64(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[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \left(\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)\right)
\end{array}
Initial program 87.4%
Taylor expanded in t around inf 99.6%
sub-neg99.6%
metadata-eval99.6%
associate-*r/99.6%
+-commutative99.6%
metadata-eval99.6%
associate-+l+99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2000.0) (not (<= (/ x y) 0.5))) (+ (/ x y) (/ (+ 2.0 (* 2.0 z)) (* t z))) (+ (/ 2.0 t) (- (/ 2.0 (* t z)) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2000.0) || !((x / y) <= 0.5)) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z));
} else {
tmp = (2.0 / t) + ((2.0 / (t * z)) - 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) <= (-2000.0d0)) .or. (.not. ((x / y) <= 0.5d0))) then
tmp = (x / y) + ((2.0d0 + (2.0d0 * z)) / (t * z))
else
tmp = (2.0d0 / t) + ((2.0d0 / (t * z)) - 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) <= -2000.0) || !((x / y) <= 0.5)) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z));
} else {
tmp = (2.0 / t) + ((2.0 / (t * z)) - 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2000.0) or not ((x / y) <= 0.5): tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z)) else: tmp = (2.0 / t) + ((2.0 / (t * z)) - 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2000.0) || !(Float64(x / y) <= 0.5)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 * z)) / Float64(t * z))); else tmp = Float64(Float64(2.0 / t) + Float64(Float64(2.0 / Float64(t * z)) - 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2000.0) || ~(((x / y) <= 0.5))) tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z)); else tmp = (2.0 / t) + ((2.0 / (t * z)) - 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.5]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2000 \lor \neg \left(\frac{x}{y} \leq 0.5\right):\\
\;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + \left(\frac{2}{t \cdot z} - 2\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -2e3 or 0.5 < (/.f64 x y) Initial program 85.0%
Taylor expanded in t around 0 97.9%
if -2e3 < (/.f64 x y) < 0.5Initial program 89.3%
Taylor expanded in t around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
associate-*r/100.0%
+-commutative100.0%
metadata-eval100.0%
associate-+l+100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.1%
associate--l+99.1%
associate-*r/99.1%
metadata-eval99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -4e+44) (not (<= (/ x y) 4e+21))) (+ (/ x y) (/ (/ 2.0 z) t)) (+ (/ 2.0 t) (- (/ 2.0 (* t z)) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4e+44) || !((x / y) <= 4e+21)) {
tmp = (x / y) + ((2.0 / z) / t);
} else {
tmp = (2.0 / t) + ((2.0 / (t * z)) - 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) <= (-4d+44)) .or. (.not. ((x / y) <= 4d+21))) then
tmp = (x / y) + ((2.0d0 / z) / t)
else
tmp = (2.0d0 / t) + ((2.0d0 / (t * z)) - 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) <= -4e+44) || !((x / y) <= 4e+21)) {
tmp = (x / y) + ((2.0 / z) / t);
} else {
tmp = (2.0 / t) + ((2.0 / (t * z)) - 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -4e+44) or not ((x / y) <= 4e+21): tmp = (x / y) + ((2.0 / z) / t) else: tmp = (2.0 / t) + ((2.0 / (t * z)) - 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -4e+44) || !(Float64(x / y) <= 4e+21)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / z) / t)); else tmp = Float64(Float64(2.0 / t) + Float64(Float64(2.0 / Float64(t * z)) - 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -4e+44) || ~(((x / y) <= 4e+21))) tmp = (x / y) + ((2.0 / z) / t); else tmp = (2.0 / t) + ((2.0 / (t * z)) - 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -4e+44], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e+21]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+44} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+21}\right):\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + \left(\frac{2}{t \cdot z} - 2\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -4.0000000000000004e44 or 4e21 < (/.f64 x y) Initial program 83.8%
Taylor expanded in y around 0 93.7%
Taylor expanded in z around 0 91.4%
associate-*r/91.4%
times-frac91.4%
Simplified91.4%
Taylor expanded in x around 0 93.3%
+-commutative93.3%
associate-*r/93.3%
metadata-eval93.3%
*-commutative93.3%
associate-/r*93.4%
Simplified93.4%
if -4.0000000000000004e44 < (/.f64 x y) < 4e21Initial program 89.9%
Taylor expanded in t around inf 99.9%
sub-neg99.9%
metadata-eval99.9%
associate-*r/99.9%
+-commutative99.9%
metadata-eval99.9%
associate-+l+99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 97.0%
associate--l+97.0%
associate-*r/97.0%
metadata-eval97.0%
associate-*r/97.0%
metadata-eval97.0%
Simplified97.0%
Final simplification95.5%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -2.0) (/ x y) (if (<= (/ x y) 6e-225) -2.0 (if (<= (/ x y) 2.4e+21) (/ 2.0 t) (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2.0) {
tmp = x / y;
} else if ((x / y) <= 6e-225) {
tmp = -2.0;
} else if ((x / y) <= 2.4e+21) {
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) <= (-2.0d0)) then
tmp = x / y
else if ((x / y) <= 6d-225) then
tmp = -2.0d0
else if ((x / y) <= 2.4d+21) 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) <= -2.0) {
tmp = x / y;
} else if ((x / y) <= 6e-225) {
tmp = -2.0;
} else if ((x / y) <= 2.4e+21) {
tmp = 2.0 / t;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2.0: tmp = x / y elif (x / y) <= 6e-225: tmp = -2.0 elif (x / y) <= 2.4e+21: tmp = 2.0 / t else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2.0) tmp = Float64(x / y); elseif (Float64(x / y) <= 6e-225) tmp = -2.0; elseif (Float64(x / y) <= 2.4e+21) 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) <= -2.0) tmp = x / y; elseif ((x / y) <= 6e-225) tmp = -2.0; elseif ((x / y) <= 2.4e+21) tmp = 2.0 / t; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 6e-225], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 2.4e+21], N[(2.0 / t), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 6 \cdot 10^{-225}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 2.4 \cdot 10^{+21}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2 or 2.4e21 < (/.f64 x y) Initial program 84.1%
Taylor expanded in x around inf 78.6%
if -2 < (/.f64 x y) < 6.00000000000000035e-225Initial program 88.8%
Taylor expanded in t around inf 41.7%
Taylor expanded in x around 0 41.3%
if 6.00000000000000035e-225 < (/.f64 x y) < 2.4e21Initial program 91.8%
Taylor expanded in z around inf 76.3%
associate-*r/76.3%
Simplified76.3%
Taylor expanded in t around 0 43.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -9.2e-30)
t_1
(if (<= t 1.12e-97)
(+ (/ 2.0 (* t z)) (/ 2.0 t))
(if (<= t 5.5e-15) (+ (/ x y) (/ 2.0 t)) 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-30) {
tmp = t_1;
} else if (t <= 1.12e-97) {
tmp = (2.0 / (t * z)) + (2.0 / t);
} else if (t <= 5.5e-15) {
tmp = (x / y) + (2.0 / t);
} 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-30)) then
tmp = t_1
else if (t <= 1.12d-97) then
tmp = (2.0d0 / (t * z)) + (2.0d0 / t)
else if (t <= 5.5d-15) then
tmp = (x / y) + (2.0d0 / t)
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-30) {
tmp = t_1;
} else if (t <= 1.12e-97) {
tmp = (2.0 / (t * z)) + (2.0 / t);
} else if (t <= 5.5e-15) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if t <= -9.2e-30: tmp = t_1 elif t <= 1.12e-97: tmp = (2.0 / (t * z)) + (2.0 / t) elif t <= 5.5e-15: tmp = (x / y) + (2.0 / t) 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-30) tmp = t_1; elseif (t <= 1.12e-97) tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(2.0 / t)); elseif (t <= 5.5e-15) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); 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-30) tmp = t_1; elseif (t <= 1.12e-97) tmp = (2.0 / (t * z)) + (2.0 / t); elseif (t <= 5.5e-15) tmp = (x / y) + (2.0 / t); 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-30], t$95$1, If[LessEqual[t, 1.12e-97], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e-15], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $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^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{-97}:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{2}{t}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-15}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.19999999999999937e-30 or 5.5000000000000002e-15 < t Initial program 78.1%
Taylor expanded in t around inf 82.6%
if -9.19999999999999937e-30 < t < 1.12e-97Initial program 98.8%
Taylor expanded in t around 0 85.7%
associate-*r/85.7%
metadata-eval85.7%
Simplified85.7%
Taylor expanded in z around inf 85.8%
associate-*r/85.8%
metadata-eval85.8%
associate-*r/85.8%
metadata-eval85.8%
Simplified85.8%
if 1.12e-97 < t < 5.5000000000000002e-15Initial program 99.8%
Taylor expanded in z around inf 83.6%
associate-*r/83.6%
Simplified83.6%
Taylor expanded in t around 0 83.6%
Final simplification83.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -9.5e-30)
t_1
(if (<= t 5e-98)
(/ (+ 2.0 (/ 2.0 z)) t)
(if (<= t 5.5e-15) (+ (/ x y) (/ 2.0 t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -9.5e-30) {
tmp = t_1;
} else if (t <= 5e-98) {
tmp = (2.0 + (2.0 / z)) / t;
} else if (t <= 5.5e-15) {
tmp = (x / y) + (2.0 / t);
} 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.5d-30)) then
tmp = t_1
else if (t <= 5d-98) then
tmp = (2.0d0 + (2.0d0 / z)) / t
else if (t <= 5.5d-15) then
tmp = (x / y) + (2.0d0 / t)
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.5e-30) {
tmp = t_1;
} else if (t <= 5e-98) {
tmp = (2.0 + (2.0 / z)) / t;
} else if (t <= 5.5e-15) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if t <= -9.5e-30: tmp = t_1 elif t <= 5e-98: tmp = (2.0 + (2.0 / z)) / t elif t <= 5.5e-15: tmp = (x / y) + (2.0 / t) 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.5e-30) tmp = t_1; elseif (t <= 5e-98) tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); elseif (t <= 5.5e-15) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); 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.5e-30) tmp = t_1; elseif (t <= 5e-98) tmp = (2.0 + (2.0 / z)) / t; elseif (t <= 5.5e-15) tmp = (x / y) + (2.0 / t); 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.5e-30], t$95$1, If[LessEqual[t, 5e-98], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 5.5e-15], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -9.5 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-98}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-15}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.49999999999999939e-30 or 5.5000000000000002e-15 < t Initial program 78.1%
Taylor expanded in t around inf 82.6%
if -9.49999999999999939e-30 < t < 5.00000000000000018e-98Initial program 98.8%
Taylor expanded in t around 0 85.7%
associate-*r/85.7%
metadata-eval85.7%
Simplified85.7%
if 5.00000000000000018e-98 < t < 5.5000000000000002e-15Initial program 99.8%
Taylor expanded in z around inf 83.6%
associate-*r/83.6%
Simplified83.6%
Taylor expanded in t around 0 83.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2.0) (not (<= (/ x y) 2.0))) (+ (/ x y) (/ 2.0 t)) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2.0) || !((x / y) <= 2.0)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = (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) <= (-2.0d0)) .or. (.not. ((x / y) <= 2.0d0))) then
tmp = (x / y) + (2.0d0 / t)
else
tmp = (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) <= -2.0) || !((x / y) <= 2.0)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2.0) or not ((x / y) <= 2.0): tmp = (x / y) + (2.0 / t) else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2.0) || !(Float64(x / y) <= 2.0)) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); else tmp = 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) <= -2.0) || ~(((x / y) <= 2.0))) tmp = (x / y) + (2.0 / t); else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \lor \neg \left(\frac{x}{y} \leq 2\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -2 or 2 < (/.f64 x y) Initial program 85.0%
Taylor expanded in z around inf 85.1%
associate-*r/85.1%
Simplified85.1%
Taylor expanded in t around 0 84.3%
if -2 < (/.f64 x y) < 2Initial program 89.3%
Taylor expanded in t around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
associate-*r/100.0%
+-commutative100.0%
metadata-eval100.0%
associate-+l+100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 65.7%
sub-neg65.7%
associate-*r/65.7%
metadata-eval65.7%
+-commutative65.7%
metadata-eval65.7%
associate-+r+65.7%
+-commutative65.7%
Simplified65.7%
Taylor expanded in x around 0 64.8%
sub-neg64.8%
associate-*r/64.8%
metadata-eval64.8%
metadata-eval64.8%
+-commutative64.8%
Simplified64.8%
Final simplification73.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.6e-68) (not (<= z 1.55e-9))) (+ (/ 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 <= -8.6e-68) || !(z <= 1.55e-9)) {
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 <= (-8.6d-68)) .or. (.not. (z <= 1.55d-9))) 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 <= -8.6e-68) || !(z <= 1.55e-9)) {
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 <= -8.6e-68) or not (z <= 1.55e-9): 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 <= -8.6e-68) || !(z <= 1.55e-9)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -8.6e-68) || ~((z <= 1.55e-9))) 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, -8.6e-68], N[Not[LessEqual[z, 1.55e-9]], $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 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{-68} \lor \neg \left(z \leq 1.55 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{z}}{t}\\
\end{array}
\end{array}
if z < -8.6000000000000002e-68 or 1.55000000000000002e-9 < z Initial program 78.1%
Taylor expanded in t around inf 99.3%
sub-neg99.3%
metadata-eval99.3%
associate-*r/99.3%
+-commutative99.3%
metadata-eval99.3%
associate-+l+99.3%
associate-*r/99.3%
metadata-eval99.3%
associate-*r/99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in z around inf 97.6%
sub-neg97.6%
associate-*r/97.6%
metadata-eval97.6%
+-commutative97.6%
metadata-eval97.6%
associate-+r+97.6%
+-commutative97.6%
Simplified97.6%
if -8.6000000000000002e-68 < z < 1.55000000000000002e-9Initial program 99.9%
Taylor expanded in y around 0 88.8%
Taylor expanded in z around 0 77.0%
associate-*r/77.0%
times-frac69.0%
Simplified69.0%
Taylor expanded in x around 0 88.1%
+-commutative88.1%
associate-*r/88.1%
metadata-eval88.1%
*-commutative88.1%
associate-/r*88.0%
Simplified88.0%
Final simplification93.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.9e-34) (not (<= t 1.7e-98))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (+ (/ 2.0 (* t z)) (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.9e-34) || !(t <= 1.7e-98)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (2.0 / (t * z)) + (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.9d-34)) .or. (.not. (t <= 1.7d-98))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.0d0))
else
tmp = (2.0d0 / (t * z)) + (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.9e-34) || !(t <= 1.7e-98)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (2.0 / (t * z)) + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.9e-34) or not (t <= 1.7e-98): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = (2.0 / (t * z)) + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.9e-34) || !(t <= 1.7e-98)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.9e-34) || ~((t <= 1.7e-98))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = (2.0 / (t * z)) + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.9e-34], N[Not[LessEqual[t, 1.7e-98]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.9 \cdot 10^{-34} \lor \neg \left(t \leq 1.7 \cdot 10^{-98}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{2}{t}\\
\end{array}
\end{array}
if t < -4.89999999999999962e-34 or 1.7000000000000001e-98 < t Initial program 80.6%
Taylor expanded in t around inf 99.9%
sub-neg99.9%
metadata-eval99.9%
associate-*r/99.9%
+-commutative99.9%
metadata-eval99.9%
associate-+l+99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 84.9%
sub-neg84.9%
associate-*r/84.9%
metadata-eval84.9%
+-commutative84.9%
metadata-eval84.9%
associate-+r+84.9%
+-commutative84.9%
Simplified84.9%
if -4.89999999999999962e-34 < t < 1.7000000000000001e-98Initial program 98.8%
Taylor expanded in t around 0 85.7%
associate-*r/85.7%
metadata-eval85.7%
Simplified85.7%
Taylor expanded in z around inf 85.8%
associate-*r/85.8%
metadata-eval85.8%
associate-*r/85.8%
metadata-eval85.8%
Simplified85.8%
Final simplification85.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -58000000000000.0) (not (<= (/ x y) 2.4e+21))) (/ x y) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -58000000000000.0) || !((x / y) <= 2.4e+21)) {
tmp = x / y;
} else {
tmp = (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) <= (-58000000000000.0d0)) .or. (.not. ((x / y) <= 2.4d+21))) then
tmp = x / y
else
tmp = (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) <= -58000000000000.0) || !((x / y) <= 2.4e+21)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -58000000000000.0) or not ((x / y) <= 2.4e+21): tmp = x / y else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -58000000000000.0) || !(Float64(x / y) <= 2.4e+21)) tmp = Float64(x / y); else tmp = 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) <= -58000000000000.0) || ~(((x / y) <= 2.4e+21))) tmp = x / y; else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -58000000000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2.4e+21]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -58000000000000 \lor \neg \left(\frac{x}{y} \leq 2.4 \cdot 10^{+21}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -5.8e13 or 2.4e21 < (/.f64 x y) Initial program 83.8%
Taylor expanded in x around inf 79.8%
if -5.8e13 < (/.f64 x y) < 2.4e21Initial program 89.9%
Taylor expanded in t around inf 99.9%
sub-neg99.9%
metadata-eval99.9%
associate-*r/99.9%
+-commutative99.9%
metadata-eval99.9%
associate-+l+99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 66.8%
sub-neg66.8%
associate-*r/66.8%
metadata-eval66.8%
+-commutative66.8%
metadata-eval66.8%
associate-+r+66.8%
+-commutative66.8%
Simplified66.8%
Taylor expanded in x around 0 64.1%
sub-neg64.1%
associate-*r/64.1%
metadata-eval64.1%
metadata-eval64.1%
+-commutative64.1%
Simplified64.1%
Final simplification70.5%
(FPCore (x y z t) :precision binary64 (if (<= t -6.8e+16) -2.0 (if (<= t 1e-14) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.8e+16) {
tmp = -2.0;
} else if (t <= 1e-14) {
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 <= (-6.8d+16)) then
tmp = -2.0d0
else if (t <= 1d-14) 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 <= -6.8e+16) {
tmp = -2.0;
} else if (t <= 1e-14) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.8e+16: tmp = -2.0 elif t <= 1e-14: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.8e+16) tmp = -2.0; elseif (t <= 1e-14) 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 <= -6.8e+16) tmp = -2.0; elseif (t <= 1e-14) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.8e+16], -2.0, If[LessEqual[t, 1e-14], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.8 \cdot 10^{+16}:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 10^{-14}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -6.8e16 or 9.99999999999999999e-15 < t Initial program 76.3%
Taylor expanded in t around inf 84.0%
Taylor expanded in x around 0 41.8%
if -6.8e16 < t < 9.99999999999999999e-15Initial program 99.0%
Taylor expanded in z around inf 62.5%
associate-*r/62.5%
Simplified62.5%
Taylor expanded in t around 0 37.6%
(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 87.4%
Taylor expanded in t around inf 55.5%
Taylor expanded in x around 0 22.6%
(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 2024157
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:alt
(! :herbie-platform default (- (/ (+ (/ 2 z) 2) t) (- 2 (/ x y))))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))