
(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 17 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 (if (<= (+ (/ x y) (/ (+ 2.0 (* (- 1.0 t) (* 2.0 z))) (* z t))) INFINITY) (fma (fma z (- 1.0 t) 1.0) (/ 2.0 (* z t)) (/ x y)) (- (/ x y) 2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t))) <= ((double) INFINITY)) {
tmp = fma(fma(z, (1.0 - t), 1.0), (2.0 / (z * t)), (x / y));
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(1.0 - t) * Float64(2.0 * z))) / Float64(z * t))) <= Inf) tmp = fma(fma(z, Float64(1.0 - t), 1.0), Float64(2.0 / Float64(z * t)), Float64(x / y)); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(1.0 - t), $MachinePrecision] * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(z * N[(1.0 - t), $MachinePrecision] + 1.0), $MachinePrecision] * N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} + \frac{2 + \left(1 - t\right) \cdot \left(2 \cdot z\right)}{z \cdot t} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, 1 - t, 1\right), \frac{2}{z \cdot t}, \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) < +inf.0Initial program 99.4%
+-commutative99.4%
remove-double-neg99.4%
distribute-frac-neg99.4%
unsub-neg99.4%
*-commutative99.4%
associate-*r*99.4%
distribute-rgt1-in99.4%
associate-/l*99.7%
fma-neg99.7%
*-commutative99.7%
fma-define99.7%
*-commutative99.7%
distribute-frac-neg99.7%
remove-double-neg99.7%
Simplified99.7%
if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) Initial program 0.0%
Taylor expanded in t around inf 100.0%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ (/ x y) (/ (+ 2.0 (* (- 1.0 t) (* 2.0 z))) (* z t))))) (if (<= t_1 INFINITY) t_1 (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t)) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(1.0 - t) * Float64(2.0 * z))) / Float64(z * t))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + ((2.0 + ((1.0 - t) * (2.0 * z))) / (z * t)); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(1.0 - t), $MachinePrecision] * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{2 + \left(1 - t\right) \cdot \left(2 \cdot z\right)}{z \cdot t}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) < +inf.0Initial program 99.4%
if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) Initial program 0.0%
Taylor expanded in t around inf 100.0%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -5e+16)
(/ x y)
(if (<= (/ x y) 5e-54)
(- -2.0 (/ -2.0 t))
(if (<= (/ x y) 1e-16) (/ (/ 2.0 z) t) (- (/ x y) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+16) {
tmp = x / y;
} else if ((x / y) <= 5e-54) {
tmp = -2.0 - (-2.0 / t);
} else if ((x / y) <= 1e-16) {
tmp = (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 ((x / y) <= (-5d+16)) then
tmp = x / y
else if ((x / y) <= 5d-54) then
tmp = (-2.0d0) - ((-2.0d0) / t)
else if ((x / y) <= 1d-16) then
tmp = (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 ((x / y) <= -5e+16) {
tmp = x / y;
} else if ((x / y) <= 5e-54) {
tmp = -2.0 - (-2.0 / t);
} else if ((x / y) <= 1e-16) {
tmp = (2.0 / z) / t;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+16: tmp = x / y elif (x / y) <= 5e-54: tmp = -2.0 - (-2.0 / t) elif (x / y) <= 1e-16: tmp = (2.0 / z) / t else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+16) tmp = Float64(x / y); elseif (Float64(x / y) <= 5e-54) tmp = Float64(-2.0 - Float64(-2.0 / t)); elseif (Float64(x / y) <= 1e-16) tmp = Float64(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 ((x / y) <= -5e+16) tmp = x / y; elseif ((x / y) <= 5e-54) tmp = -2.0 - (-2.0 / t); elseif ((x / y) <= 1e-16) tmp = (2.0 / z) / t; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+16], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e-54], N[(-2.0 - N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-16], N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-54}:\\
\;\;\;\;-2 - \frac{-2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-16}:\\
\;\;\;\;\frac{\frac{2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -5e16Initial program 82.2%
Taylor expanded in x around inf 72.3%
if -5e16 < (/.f64 x y) < 5.00000000000000015e-54Initial program 90.2%
Taylor expanded in z around inf 61.5%
div-sub61.5%
sub-neg61.5%
*-inverses61.5%
metadata-eval61.5%
distribute-lft-in61.5%
associate-*r/61.5%
metadata-eval61.5%
metadata-eval61.5%
Simplified61.5%
Taylor expanded in x around 0 60.8%
sub-neg60.8%
metadata-eval60.8%
associate-*r/60.8%
metadata-eval60.8%
+-commutative60.8%
metadata-eval60.8%
distribute-neg-frac60.8%
unsub-neg60.8%
Simplified60.8%
if 5.00000000000000015e-54 < (/.f64 x y) < 9.9999999999999998e-17Initial program 99.6%
Taylor expanded in z around 0 80.0%
associate-/l/80.2%
Simplified80.2%
if 9.9999999999999998e-17 < (/.f64 x y) Initial program 85.4%
Taylor expanded in t around inf 77.6%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -5e+16)
(/ x y)
(if (<= (/ x y) 5e-54)
(- -2.0 (/ -2.0 t))
(if (<= (/ x y) 1e-16) (/ (/ 2.0 t) z) (- (/ x y) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+16) {
tmp = x / y;
} else if ((x / y) <= 5e-54) {
tmp = -2.0 - (-2.0 / t);
} else if ((x / y) <= 1e-16) {
tmp = (2.0 / t) / z;
} 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 ((x / y) <= (-5d+16)) then
tmp = x / y
else if ((x / y) <= 5d-54) then
tmp = (-2.0d0) - ((-2.0d0) / t)
else if ((x / y) <= 1d-16) then
tmp = (2.0d0 / t) / z
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 ((x / y) <= -5e+16) {
tmp = x / y;
} else if ((x / y) <= 5e-54) {
tmp = -2.0 - (-2.0 / t);
} else if ((x / y) <= 1e-16) {
tmp = (2.0 / t) / z;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+16: tmp = x / y elif (x / y) <= 5e-54: tmp = -2.0 - (-2.0 / t) elif (x / y) <= 1e-16: tmp = (2.0 / t) / z else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+16) tmp = Float64(x / y); elseif (Float64(x / y) <= 5e-54) tmp = Float64(-2.0 - Float64(-2.0 / t)); elseif (Float64(x / y) <= 1e-16) tmp = Float64(Float64(2.0 / t) / z); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e+16) tmp = x / y; elseif ((x / y) <= 5e-54) tmp = -2.0 - (-2.0 / t); elseif ((x / y) <= 1e-16) tmp = (2.0 / t) / z; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+16], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e-54], N[(-2.0 - N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-16], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-54}:\\
\;\;\;\;-2 - \frac{-2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-16}:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -5e16Initial program 82.2%
Taylor expanded in x around inf 72.3%
if -5e16 < (/.f64 x y) < 5.00000000000000015e-54Initial program 90.2%
Taylor expanded in z around inf 61.5%
div-sub61.5%
sub-neg61.5%
*-inverses61.5%
metadata-eval61.5%
distribute-lft-in61.5%
associate-*r/61.5%
metadata-eval61.5%
metadata-eval61.5%
Simplified61.5%
Taylor expanded in x around 0 60.8%
sub-neg60.8%
metadata-eval60.8%
associate-*r/60.8%
metadata-eval60.8%
+-commutative60.8%
metadata-eval60.8%
distribute-neg-frac60.8%
unsub-neg60.8%
Simplified60.8%
if 5.00000000000000015e-54 < (/.f64 x y) < 9.9999999999999998e-17Initial program 99.6%
Taylor expanded in z around 0 80.0%
associate-/l/80.2%
Simplified80.2%
Taylor expanded in z around 0 80.0%
associate-/r*80.0%
Simplified80.0%
if 9.9999999999999998e-17 < (/.f64 x y) Initial program 85.4%
Taylor expanded in t around inf 77.6%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -5e+16)
(/ x y)
(if (<= (/ x y) 5e-54)
(- -2.0 (/ -2.0 t))
(if (<= (/ x y) 1e-16) (/ 2.0 (* z t)) (- (/ x y) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+16) {
tmp = x / y;
} else if ((x / y) <= 5e-54) {
tmp = -2.0 - (-2.0 / t);
} else if ((x / y) <= 1e-16) {
tmp = 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 ((x / y) <= (-5d+16)) then
tmp = x / y
else if ((x / y) <= 5d-54) then
tmp = (-2.0d0) - ((-2.0d0) / t)
else if ((x / y) <= 1d-16) then
tmp = 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 ((x / y) <= -5e+16) {
tmp = x / y;
} else if ((x / y) <= 5e-54) {
tmp = -2.0 - (-2.0 / t);
} else if ((x / y) <= 1e-16) {
tmp = 2.0 / (z * t);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+16: tmp = x / y elif (x / y) <= 5e-54: tmp = -2.0 - (-2.0 / t) elif (x / y) <= 1e-16: tmp = 2.0 / (z * t) else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+16) tmp = Float64(x / y); elseif (Float64(x / y) <= 5e-54) tmp = Float64(-2.0 - Float64(-2.0 / t)); elseif (Float64(x / y) <= 1e-16) tmp = Float64(2.0 / Float64(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 ((x / y) <= -5e+16) tmp = x / y; elseif ((x / y) <= 5e-54) tmp = -2.0 - (-2.0 / t); elseif ((x / y) <= 1e-16) tmp = 2.0 / (z * t); else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+16], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e-54], N[(-2.0 - N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-16], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-54}:\\
\;\;\;\;-2 - \frac{-2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-16}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -5e16Initial program 82.2%
Taylor expanded in x around inf 72.3%
if -5e16 < (/.f64 x y) < 5.00000000000000015e-54Initial program 90.2%
Taylor expanded in z around inf 61.5%
div-sub61.5%
sub-neg61.5%
*-inverses61.5%
metadata-eval61.5%
distribute-lft-in61.5%
associate-*r/61.5%
metadata-eval61.5%
metadata-eval61.5%
Simplified61.5%
Taylor expanded in x around 0 60.8%
sub-neg60.8%
metadata-eval60.8%
associate-*r/60.8%
metadata-eval60.8%
+-commutative60.8%
metadata-eval60.8%
distribute-neg-frac60.8%
unsub-neg60.8%
Simplified60.8%
if 5.00000000000000015e-54 < (/.f64 x y) < 9.9999999999999998e-17Initial program 99.6%
Taylor expanded in z around 0 80.0%
if 9.9999999999999998e-17 < (/.f64 x y) Initial program 85.4%
Taylor expanded in t around inf 77.6%
Final simplification69.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t)))
(if (or (<= (/ x y) -2000000.0) (not (<= (/ x y) 0.2)))
(+ (/ x y) t_1)
(+ -2.0 t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (2.0 + (2.0 / z)) / t;
double tmp;
if (((x / y) <= -2000000.0) || !((x / y) <= 0.2)) {
tmp = (x / y) + t_1;
} else {
tmp = -2.0 + 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 = (2.0d0 + (2.0d0 / z)) / t
if (((x / y) <= (-2000000.0d0)) .or. (.not. ((x / y) <= 0.2d0))) then
tmp = (x / y) + t_1
else
tmp = (-2.0d0) + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (2.0 + (2.0 / z)) / t;
double tmp;
if (((x / y) <= -2000000.0) || !((x / y) <= 0.2)) {
tmp = (x / y) + t_1;
} else {
tmp = -2.0 + t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 + (2.0 / z)) / t tmp = 0 if ((x / y) <= -2000000.0) or not ((x / y) <= 0.2): tmp = (x / y) + t_1 else: tmp = -2.0 + t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(2.0 + Float64(2.0 / z)) / t) tmp = 0.0 if ((Float64(x / y) <= -2000000.0) || !(Float64(x / y) <= 0.2)) tmp = Float64(Float64(x / y) + t_1); else tmp = Float64(-2.0 + t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (2.0 + (2.0 / z)) / t; tmp = 0.0; if (((x / y) <= -2000000.0) || ~(((x / y) <= 0.2))) tmp = (x / y) + t_1; else tmp = -2.0 + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, If[Or[LessEqual[N[(x / y), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.2]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + t$95$1), $MachinePrecision], N[(-2.0 + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2 + \frac{2}{z}}{t}\\
\mathbf{if}\;\frac{x}{y} \leq -2000000 \lor \neg \left(\frac{x}{y} \leq 0.2\right):\\
\;\;\;\;\frac{x}{y} + t\_1\\
\mathbf{else}:\\
\;\;\;\;-2 + t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -2e6 or 0.20000000000000001 < (/.f64 x y) Initial program 85.0%
Taylor expanded in z around 0 74.4%
+-commutative74.4%
associate-/l*86.3%
*-commutative86.3%
div-sub86.3%
*-inverses86.3%
associate-*l*86.3%
associate-*r/86.3%
metadata-eval86.3%
sub-neg86.3%
metadata-eval86.3%
distribute-lft-in86.3%
associate-*r/86.3%
metadata-eval86.3%
metadata-eval86.3%
Simplified86.3%
Taylor expanded in t around 0 85.8%
Taylor expanded in x around 0 98.1%
associate-+r+98.1%
+-commutative98.1%
distribute-lft-out98.1%
associate-/l/98.1%
*-lft-identity98.1%
associate-*l/98.1%
distribute-lft-out98.1%
*-commutative98.1%
associate-*r*98.1%
associate-*r/98.1%
metadata-eval98.1%
distribute-rgt-in98.1%
associate-*l/98.1%
*-lft-identity98.1%
Simplified98.1%
if -2e6 < (/.f64 x y) < 0.20000000000000001Initial program 89.4%
Taylor expanded in x around 0 98.1%
associate-*r/98.1%
metadata-eval98.1%
associate-/l/98.1%
+-commutative98.1%
div-sub98.1%
sub-neg98.1%
*-inverses98.1%
metadata-eval98.1%
distribute-lft-in98.1%
metadata-eval98.1%
associate-+l+98.1%
+-commutative98.1%
associate-/l/98.1%
+-commutative98.1%
associate-/l/98.1%
*-rgt-identity98.1%
associate-*r/98.1%
distribute-rgt-out98.1%
Simplified98.1%
Taylor expanded in t around inf 98.1%
sub-neg98.1%
associate-/r*98.1%
metadata-eval98.1%
associate-*r/98.1%
associate-*l/98.1%
distribute-rgt-in98.1%
metadata-eval98.1%
associate-*l/98.1%
*-lft-identity98.1%
+-commutative98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t)))
(if (<= (/ x y) -2e-11)
(+ (/ x y) (/ (+ 2.0 (* 2.0 z)) (* z t)))
(if (<= (/ x y) 0.2) (+ -2.0 t_1) (+ (/ x y) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (2.0 + (2.0 / z)) / t;
double tmp;
if ((x / y) <= -2e-11) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
} else if ((x / y) <= 0.2) {
tmp = -2.0 + t_1;
} else {
tmp = (x / y) + 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 = (2.0d0 + (2.0d0 / z)) / t
if ((x / y) <= (-2d-11)) then
tmp = (x / y) + ((2.0d0 + (2.0d0 * z)) / (z * t))
else if ((x / y) <= 0.2d0) then
tmp = (-2.0d0) + t_1
else
tmp = (x / y) + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (2.0 + (2.0 / z)) / t;
double tmp;
if ((x / y) <= -2e-11) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
} else if ((x / y) <= 0.2) {
tmp = -2.0 + t_1;
} else {
tmp = (x / y) + t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 + (2.0 / z)) / t tmp = 0 if (x / y) <= -2e-11: tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t)) elif (x / y) <= 0.2: tmp = -2.0 + t_1 else: tmp = (x / y) + t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(2.0 + Float64(2.0 / z)) / t) tmp = 0.0 if (Float64(x / y) <= -2e-11) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 * z)) / Float64(z * t))); elseif (Float64(x / y) <= 0.2) tmp = Float64(-2.0 + t_1); else tmp = Float64(Float64(x / y) + t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (2.0 + (2.0 / z)) / t; tmp = 0.0; if ((x / y) <= -2e-11) tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t)); elseif ((x / y) <= 0.2) tmp = -2.0 + t_1; else tmp = (x / y) + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -2e-11], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 0.2], N[(-2.0 + t$95$1), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2 + \frac{2}{z}}{t}\\
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{z \cdot t}\\
\mathbf{elif}\;\frac{x}{y} \leq 0.2:\\
\;\;\;\;-2 + t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -1.99999999999999988e-11Initial program 83.8%
Taylor expanded in t around 0 96.3%
if -1.99999999999999988e-11 < (/.f64 x y) < 0.20000000000000001Initial program 89.0%
Taylor expanded in x around 0 98.0%
associate-*r/98.0%
metadata-eval98.0%
associate-/l/98.1%
+-commutative98.1%
div-sub98.1%
sub-neg98.1%
*-inverses98.1%
metadata-eval98.1%
distribute-lft-in98.1%
metadata-eval98.1%
associate-+l+98.1%
+-commutative98.1%
associate-/l/98.0%
+-commutative98.0%
associate-/l/98.1%
*-rgt-identity98.1%
associate-*r/98.0%
distribute-rgt-out98.0%
Simplified98.0%
Taylor expanded in t around inf 98.0%
sub-neg98.0%
associate-/r*98.1%
metadata-eval98.1%
associate-*r/98.1%
associate-*l/98.0%
distribute-rgt-in98.0%
metadata-eval98.0%
associate-*l/98.1%
*-lft-identity98.1%
+-commutative98.1%
Simplified98.1%
if 0.20000000000000001 < (/.f64 x y) Initial program 86.8%
Taylor expanded in z around 0 79.1%
+-commutative79.1%
associate-/l*92.3%
*-commutative92.3%
div-sub92.3%
*-inverses92.3%
associate-*l*92.3%
associate-*r/92.3%
metadata-eval92.3%
sub-neg92.3%
metadata-eval92.3%
distribute-lft-in92.3%
associate-*r/92.3%
metadata-eval92.3%
metadata-eval92.3%
Simplified92.3%
Taylor expanded in t around 0 92.0%
Taylor expanded in x around 0 99.7%
associate-+r+99.7%
+-commutative99.7%
distribute-lft-out99.7%
associate-/l/99.8%
*-lft-identity99.8%
associate-*l/99.7%
distribute-lft-out99.7%
*-commutative99.7%
associate-*r*99.7%
associate-*r/99.7%
metadata-eval99.7%
distribute-rgt-in99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Final simplification98.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+16) (not (<= (/ x y) 40000000000.0))) (+ (/ 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 (((x / y) <= -5e+16) || !((x / y) <= 40000000000.0)) {
tmp = (x / y) + (2.0 / t);
} 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) <= (-5d+16)) .or. (.not. ((x / y) <= 40000000000.0d0))) then
tmp = (x / y) + (2.0d0 / t)
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) <= -5e+16) || !((x / y) <= 40000000000.0)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+16) or not ((x / y) <= 40000000000.0): tmp = (x / y) + (2.0 / t) 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) <= -5e+16) || !(Float64(x / y) <= 40000000000.0)) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); 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) <= -5e+16) || ~(((x / y) <= 40000000000.0))) tmp = (x / y) + (2.0 / t); 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], -5e+16], N[Not[LessEqual[N[(x / y), $MachinePrecision], 40000000000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $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 -5 \cdot 10^{+16} \lor \neg \left(\frac{x}{y} \leq 40000000000\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -5e16 or 4e10 < (/.f64 x y) Initial program 84.6%
Taylor expanded in z around inf 85.2%
div-sub85.2%
sub-neg85.2%
*-inverses85.2%
metadata-eval85.2%
distribute-lft-in85.2%
associate-*r/85.2%
metadata-eval85.2%
metadata-eval85.2%
Simplified85.2%
Taylor expanded in t around 0 85.0%
if -5e16 < (/.f64 x y) < 4e10Initial program 89.7%
Taylor expanded in x around 0 97.5%
associate-*r/97.5%
metadata-eval97.5%
associate-/l/97.5%
+-commutative97.5%
div-sub97.5%
sub-neg97.5%
*-inverses97.5%
metadata-eval97.5%
distribute-lft-in97.5%
metadata-eval97.5%
associate-+l+97.5%
+-commutative97.5%
associate-/l/97.5%
+-commutative97.5%
associate-/l/97.5%
*-rgt-identity97.5%
associate-*r/97.5%
distribute-rgt-out97.5%
Simplified97.5%
Taylor expanded in t around inf 97.5%
sub-neg97.5%
associate-/r*97.5%
metadata-eval97.5%
associate-*r/97.5%
associate-*l/97.5%
distribute-rgt-in97.5%
metadata-eval97.5%
associate-*l/97.5%
*-lft-identity97.5%
+-commutative97.5%
Simplified97.5%
Final simplification90.8%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -5e+16)
(+ (/ x y) (/ 2.0 t))
(if (<= (/ x y) 40000000000.0)
(+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))
(+ (/ x y) (+ -2.0 (/ 2.0 t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+16) {
tmp = (x / y) + (2.0 / t);
} else if ((x / y) <= 40000000000.0) {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
} else {
tmp = (x / y) + (-2.0 + (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) <= (-5d+16)) then
tmp = (x / y) + (2.0d0 / t)
else if ((x / y) <= 40000000000.0d0) then
tmp = (-2.0d0) + ((2.0d0 + (2.0d0 / z)) / t)
else
tmp = (x / y) + ((-2.0d0) + (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) <= -5e+16) {
tmp = (x / y) + (2.0 / t);
} else if ((x / y) <= 40000000000.0) {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
} else {
tmp = (x / y) + (-2.0 + (2.0 / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+16: tmp = (x / y) + (2.0 / t) elif (x / y) <= 40000000000.0: tmp = -2.0 + ((2.0 + (2.0 / z)) / t) else: tmp = (x / y) + (-2.0 + (2.0 / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+16) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); elseif (Float64(x / y) <= 40000000000.0) tmp = Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t)); else tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e+16) tmp = (x / y) + (2.0 / t); elseif ((x / y) <= 40000000000.0) tmp = -2.0 + ((2.0 + (2.0 / z)) / t); else tmp = (x / y) + (-2.0 + (2.0 / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+16], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 40000000000.0], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 40000000000:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -5e16Initial program 82.2%
Taylor expanded in z around inf 84.3%
div-sub84.3%
sub-neg84.3%
*-inverses84.3%
metadata-eval84.3%
distribute-lft-in84.3%
associate-*r/84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.3%
Taylor expanded in t around 0 84.3%
if -5e16 < (/.f64 x y) < 4e10Initial program 89.7%
Taylor expanded in x around 0 97.5%
associate-*r/97.5%
metadata-eval97.5%
associate-/l/97.5%
+-commutative97.5%
div-sub97.5%
sub-neg97.5%
*-inverses97.5%
metadata-eval97.5%
distribute-lft-in97.5%
metadata-eval97.5%
associate-+l+97.5%
+-commutative97.5%
associate-/l/97.5%
+-commutative97.5%
associate-/l/97.5%
*-rgt-identity97.5%
associate-*r/97.5%
distribute-rgt-out97.5%
Simplified97.5%
Taylor expanded in t around inf 97.5%
sub-neg97.5%
associate-/r*97.5%
metadata-eval97.5%
associate-*r/97.5%
associate-*l/97.5%
distribute-rgt-in97.5%
metadata-eval97.5%
associate-*l/97.5%
*-lft-identity97.5%
+-commutative97.5%
Simplified97.5%
if 4e10 < (/.f64 x y) Initial program 86.6%
Taylor expanded in z around inf 85.9%
div-sub85.9%
sub-neg85.9%
*-inverses85.9%
metadata-eval85.9%
distribute-lft-in85.9%
associate-*r/85.9%
metadata-eval85.9%
metadata-eval85.9%
Simplified85.9%
Final simplification90.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ x y) (/ 2.0 t))))
(if (<= z -1.1e-64)
t_1
(if (<= z 4e-153) (/ (/ 2.0 t) z) (if (<= z 4e-9) (- (/ x y) 2.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + (2.0 / t);
double tmp;
if (z <= -1.1e-64) {
tmp = t_1;
} else if (z <= 4e-153) {
tmp = (2.0 / t) / z;
} else if (z <= 4e-9) {
tmp = (x / y) - 2.0;
} 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 / t)
if (z <= (-1.1d-64)) then
tmp = t_1
else if (z <= 4d-153) then
tmp = (2.0d0 / t) / z
else if (z <= 4d-9) then
tmp = (x / y) - 2.0d0
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 / t);
double tmp;
if (z <= -1.1e-64) {
tmp = t_1;
} else if (z <= 4e-153) {
tmp = (2.0 / t) / z;
} else if (z <= 4e-9) {
tmp = (x / y) - 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + (2.0 / t) tmp = 0 if z <= -1.1e-64: tmp = t_1 elif z <= 4e-153: tmp = (2.0 / t) / z elif z <= 4e-9: tmp = (x / y) - 2.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + Float64(2.0 / t)) tmp = 0.0 if (z <= -1.1e-64) tmp = t_1; elseif (z <= 4e-153) tmp = Float64(Float64(2.0 / t) / z); elseif (z <= 4e-9) tmp = Float64(Float64(x / y) - 2.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + (2.0 / t); tmp = 0.0; if (z <= -1.1e-64) tmp = t_1; elseif (z <= 4e-153) tmp = (2.0 / t) / z; elseif (z <= 4e-9) tmp = (x / y) - 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.1e-64], t$95$1, If[LessEqual[z, 4e-153], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 4e-9], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{2}{t}\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-153}:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.1e-64 or 4.00000000000000025e-9 < z Initial program 78.5%
Taylor expanded in z around inf 97.2%
div-sub97.2%
sub-neg97.2%
*-inverses97.2%
metadata-eval97.2%
distribute-lft-in97.2%
associate-*r/97.2%
metadata-eval97.2%
metadata-eval97.2%
Simplified97.2%
Taylor expanded in t around 0 81.4%
if -1.1e-64 < z < 4.00000000000000016e-153Initial program 98.6%
Taylor expanded in z around 0 69.9%
associate-/l/69.9%
Simplified69.9%
Taylor expanded in z around 0 69.9%
associate-/r*69.9%
Simplified69.9%
if 4.00000000000000016e-153 < z < 4.00000000000000025e-9Initial program 96.3%
Taylor expanded in t around inf 65.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -185.0) (not (<= t 3.7e-26))) (- (/ x y) 2.0) (* (+ 2.0 (/ 2.0 z)) (/ 1.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -185.0) || !(t <= 3.7e-26)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 + (2.0 / z)) * (1.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 <= (-185.0d0)) .or. (.not. (t <= 3.7d-26))) then
tmp = (x / y) - 2.0d0
else
tmp = (2.0d0 + (2.0d0 / z)) * (1.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -185.0) || !(t <= 3.7e-26)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 + (2.0 / z)) * (1.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -185.0) or not (t <= 3.7e-26): tmp = (x / y) - 2.0 else: tmp = (2.0 + (2.0 / z)) * (1.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -185.0) || !(t <= 3.7e-26)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(2.0 + Float64(2.0 / z)) * Float64(1.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -185.0) || ~((t <= 3.7e-26))) tmp = (x / y) - 2.0; else tmp = (2.0 + (2.0 / z)) * (1.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -185.0], N[Not[LessEqual[t, 3.7e-26]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -185 \lor \neg \left(t \leq 3.7 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\left(2 + \frac{2}{z}\right) \cdot \frac{1}{t}\\
\end{array}
\end{array}
if t < -185 or 3.6999999999999999e-26 < t Initial program 77.0%
Taylor expanded in t around inf 83.9%
if -185 < t < 3.6999999999999999e-26Initial program 98.1%
Taylor expanded in t around 0 78.7%
associate-*r/78.7%
metadata-eval78.7%
Simplified78.7%
clear-num78.7%
associate-/r/78.7%
Applied egg-rr78.7%
Final simplification81.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+16) (not (<= (/ x y) 2e+20))) (/ x y) (- -2.0 (/ -2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+16) || !((x / y) <= 2e+20)) {
tmp = x / y;
} else {
tmp = -2.0 - (-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) <= (-5d+16)) .or. (.not. ((x / y) <= 2d+20))) then
tmp = x / y
else
tmp = (-2.0d0) - ((-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) <= -5e+16) || !((x / y) <= 2e+20)) {
tmp = x / y;
} else {
tmp = -2.0 - (-2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+16) or not ((x / y) <= 2e+20): tmp = x / y else: tmp = -2.0 - (-2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+16) || !(Float64(x / y) <= 2e+20)) tmp = Float64(x / y); else tmp = Float64(-2.0 - Float64(-2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e+16) || ~(((x / y) <= 2e+20))) tmp = x / y; else tmp = -2.0 - (-2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+16], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+20]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(-2.0 - N[(-2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+16} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 - \frac{-2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -5e16 or 2e20 < (/.f64 x y) Initial program 84.3%
Taylor expanded in x around inf 77.1%
if -5e16 < (/.f64 x y) < 2e20Initial program 89.9%
Taylor expanded in z around inf 59.8%
div-sub59.8%
sub-neg59.8%
*-inverses59.8%
metadata-eval59.8%
distribute-lft-in59.8%
associate-*r/59.8%
metadata-eval59.8%
metadata-eval59.8%
Simplified59.8%
Taylor expanded in x around 0 56.8%
sub-neg56.8%
metadata-eval56.8%
associate-*r/56.8%
metadata-eval56.8%
+-commutative56.8%
metadata-eval56.8%
distribute-neg-frac56.8%
unsub-neg56.8%
Simplified56.8%
Final simplification67.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+16) (/ x y) (if (<= (/ x y) 5e-25) (- -2.0 (/ -2.0 t)) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+16) {
tmp = x / y;
} else if ((x / y) <= 5e-25) {
tmp = -2.0 - (-2.0 / 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 ((x / y) <= (-5d+16)) then
tmp = x / y
else if ((x / y) <= 5d-25) then
tmp = (-2.0d0) - ((-2.0d0) / 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 ((x / y) <= -5e+16) {
tmp = x / y;
} else if ((x / y) <= 5e-25) {
tmp = -2.0 - (-2.0 / t);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+16: tmp = x / y elif (x / y) <= 5e-25: tmp = -2.0 - (-2.0 / t) else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+16) tmp = Float64(x / y); elseif (Float64(x / y) <= 5e-25) tmp = Float64(-2.0 - Float64(-2.0 / 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 ((x / y) <= -5e+16) tmp = x / y; elseif ((x / y) <= 5e-25) tmp = -2.0 - (-2.0 / t); else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+16], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e-25], N[(-2.0 - N[(-2.0 / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-25}:\\
\;\;\;\;-2 - \frac{-2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -5e16Initial program 82.2%
Taylor expanded in x around inf 72.3%
if -5e16 < (/.f64 x y) < 4.99999999999999962e-25Initial program 90.5%
Taylor expanded in z around inf 60.3%
div-sub60.3%
sub-neg60.3%
*-inverses60.3%
metadata-eval60.3%
distribute-lft-in60.3%
associate-*r/60.3%
metadata-eval60.3%
metadata-eval60.3%
Simplified60.3%
Taylor expanded in x around 0 59.6%
sub-neg59.6%
metadata-eval59.6%
associate-*r/59.6%
metadata-eval59.6%
+-commutative59.6%
metadata-eval59.6%
distribute-neg-frac59.6%
unsub-neg59.6%
Simplified59.6%
if 4.99999999999999962e-25 < (/.f64 x y) Initial program 85.9%
Taylor expanded in t around inf 74.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -750.0) (not (<= t 3.8e-26))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -750.0) || !(t <= 3.8e-26)) {
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 <= (-750.0d0)) .or. (.not. (t <= 3.8d-26))) 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 <= -750.0) || !(t <= 3.8e-26)) {
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 <= -750.0) or not (t <= 3.8e-26): 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 <= -750.0) || !(t <= 3.8e-26)) 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 <= -750.0) || ~((t <= 3.8e-26))) 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, -750.0], N[Not[LessEqual[t, 3.8e-26]], $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 -750 \lor \neg \left(t \leq 3.8 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -750 or 3.80000000000000015e-26 < t Initial program 77.0%
Taylor expanded in t around inf 83.9%
if -750 < t < 3.80000000000000015e-26Initial program 98.1%
Taylor expanded in t around 0 78.7%
associate-*r/78.7%
metadata-eval78.7%
Simplified78.7%
Final simplification81.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+16) (not (<= (/ x y) 0.2))) (/ x y) -2.0))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+16) || !((x / y) <= 0.2)) {
tmp = x / y;
} 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 (((x / y) <= (-5d+16)) .or. (.not. ((x / y) <= 0.2d0))) then
tmp = x / y
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 (((x / y) <= -5e+16) || !((x / y) <= 0.2)) {
tmp = x / y;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+16) or not ((x / y) <= 0.2): tmp = x / y else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+16) || !(Float64(x / y) <= 0.2)) tmp = Float64(x / y); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e+16) || ~(((x / y) <= 0.2))) tmp = x / y; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+16], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.2]], $MachinePrecision]], N[(x / y), $MachinePrecision], -2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+16} \lor \neg \left(\frac{x}{y} \leq 0.2\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if (/.f64 x y) < -5e16 or 0.20000000000000001 < (/.f64 x y) Initial program 84.7%
Taylor expanded in x around inf 75.5%
if -5e16 < (/.f64 x y) < 0.20000000000000001Initial program 89.6%
Taylor expanded in x around 0 97.5%
associate-*r/97.5%
metadata-eval97.5%
associate-/l/97.5%
+-commutative97.5%
div-sub97.5%
sub-neg97.5%
*-inverses97.5%
metadata-eval97.5%
distribute-lft-in97.5%
metadata-eval97.5%
associate-+l+97.5%
+-commutative97.5%
associate-/l/97.5%
+-commutative97.5%
associate-/l/97.5%
*-rgt-identity97.5%
associate-*r/97.5%
distribute-rgt-out97.5%
Simplified97.5%
Taylor expanded in z around inf 56.9%
Taylor expanded in t around inf 30.3%
Final simplification54.7%
(FPCore (x y z t) :precision binary64 (if (<= t -1.0) -2.0 (if (<= t 2.0) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.0) {
tmp = -2.0;
} else if (t <= 2.0) {
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 <= (-1.0d0)) then
tmp = -2.0d0
else if (t <= 2.0d0) 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 <= -1.0) {
tmp = -2.0;
} else if (t <= 2.0) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.0: tmp = -2.0 elif t <= 2.0: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.0) tmp = -2.0; elseif (t <= 2.0) 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 <= -1.0) tmp = -2.0; elseif (t <= 2.0) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.0], -2.0, If[LessEqual[t, 2.0], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 2:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1 or 2 < t Initial program 75.3%
Taylor expanded in x around 0 42.8%
associate-*r/42.8%
metadata-eval42.8%
associate-/l/42.9%
+-commutative42.9%
div-sub42.9%
sub-neg42.9%
*-inverses42.9%
metadata-eval42.9%
distribute-lft-in42.9%
metadata-eval42.9%
associate-+l+42.9%
+-commutative42.9%
associate-/l/42.8%
+-commutative42.8%
associate-/l/42.9%
*-rgt-identity42.9%
associate-*r/42.9%
distribute-rgt-out42.9%
Simplified42.9%
Taylor expanded in z around inf 29.2%
Taylor expanded in t around inf 28.7%
if -1 < t < 2Initial program 98.2%
Taylor expanded in z around inf 60.4%
div-sub60.4%
sub-neg60.4%
*-inverses60.4%
metadata-eval60.4%
distribute-lft-in60.4%
associate-*r/60.4%
metadata-eval60.4%
metadata-eval60.4%
Simplified60.4%
Taylor expanded in t around 0 35.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 87.0%
Taylor expanded in x around 0 59.4%
associate-*r/59.4%
metadata-eval59.4%
associate-/l/59.4%
+-commutative59.4%
div-sub59.4%
sub-neg59.4%
*-inverses59.4%
metadata-eval59.4%
distribute-lft-in59.4%
metadata-eval59.4%
associate-+l+59.4%
+-commutative59.4%
associate-/l/59.4%
+-commutative59.4%
associate-/l/59.4%
*-rgt-identity59.4%
associate-*r/59.4%
distribute-rgt-out59.4%
Simplified59.4%
Taylor expanded in z around inf 32.3%
Taylor expanded in t around inf 15.4%
(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 2024139
(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))))