
(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 (+ -2.0 (+ (+ (/ 2.0 t) (/ (/ 2.0 t) z)) (/ x y))))
double code(double x, double y, double z, double t) {
return -2.0 + (((2.0 / t) + ((2.0 / t) / z)) + (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) + (((2.0d0 / t) + ((2.0d0 / t) / z)) + (x / y))
end function
public static double code(double x, double y, double z, double t) {
return -2.0 + (((2.0 / t) + ((2.0 / t) / z)) + (x / y));
}
def code(x, y, z, t): return -2.0 + (((2.0 / t) + ((2.0 / t) / z)) + (x / y))
function code(x, y, z, t) return Float64(-2.0 + Float64(Float64(Float64(2.0 / t) + Float64(Float64(2.0 / t) / z)) + Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = -2.0 + (((2.0 / t) + ((2.0 / t) / z)) + (x / y)); end
code[x_, y_, z_, t_] := N[(-2.0 + N[(N[(N[(2.0 / t), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-2 + \left(\left(\frac{2}{t} + \frac{\frac{2}{t}}{z}\right) + \frac{x}{y}\right)
\end{array}
Initial program 84.6%
Taylor expanded in t around 0 99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
associate-+r+99.2%
metadata-eval99.2%
associate-*r/99.2%
+-commutative99.2%
associate-*r/99.2%
metadata-eval99.2%
associate-*r/99.2%
metadata-eval99.2%
associate-/r*99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= (/ x y) -550000.0)
t_1
(if (<= (/ x y) 5500000000000.0)
(+ -2.0 (/ 2.0 t))
(if (<= (/ x y) 1.9e+125)
(/ 2.0 (* t z))
(if (<= (/ x y) 4e+168) (/ 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 ((x / y) <= -550000.0) {
tmp = t_1;
} else if ((x / y) <= 5500000000000.0) {
tmp = -2.0 + (2.0 / t);
} else if ((x / y) <= 1.9e+125) {
tmp = 2.0 / (t * z);
} else if ((x / y) <= 4e+168) {
tmp = 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 ((x / y) <= (-550000.0d0)) then
tmp = t_1
else if ((x / y) <= 5500000000000.0d0) then
tmp = (-2.0d0) + (2.0d0 / t)
else if ((x / y) <= 1.9d+125) then
tmp = 2.0d0 / (t * z)
else if ((x / y) <= 4d+168) then
tmp = 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 ((x / y) <= -550000.0) {
tmp = t_1;
} else if ((x / y) <= 5500000000000.0) {
tmp = -2.0 + (2.0 / t);
} else if ((x / y) <= 1.9e+125) {
tmp = 2.0 / (t * z);
} else if ((x / y) <= 4e+168) {
tmp = 2.0 / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if (x / y) <= -550000.0: tmp = t_1 elif (x / y) <= 5500000000000.0: tmp = -2.0 + (2.0 / t) elif (x / y) <= 1.9e+125: tmp = 2.0 / (t * z) elif (x / y) <= 4e+168: tmp = 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 (Float64(x / y) <= -550000.0) tmp = t_1; elseif (Float64(x / y) <= 5500000000000.0) tmp = Float64(-2.0 + Float64(2.0 / t)); elseif (Float64(x / y) <= 1.9e+125) tmp = Float64(2.0 / Float64(t * z)); elseif (Float64(x / y) <= 4e+168) tmp = 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 ((x / y) <= -550000.0) tmp = t_1; elseif ((x / y) <= 5500000000000.0) tmp = -2.0 + (2.0 / t); elseif ((x / y) <= 1.9e+125) tmp = 2.0 / (t * z); elseif ((x / y) <= 4e+168) tmp = 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[N[(x / y), $MachinePrecision], -550000.0], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 5500000000000.0], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.9e+125], N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 4e+168], N[(2.0 / t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;\frac{x}{y} \leq -550000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq 5500000000000:\\
\;\;\;\;-2 + \frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 1.9 \cdot 10^{+125}:\\
\;\;\;\;\frac{2}{t \cdot z}\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+168}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 x y) < -5.5e5 or 3.9999999999999997e168 < (/.f64 x y) Initial program 85.7%
Taylor expanded in t around inf 78.6%
if -5.5e5 < (/.f64 x y) < 5.5e12Initial program 81.8%
Taylor expanded in t around 0 99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
associate-*r/99.9%
+-commutative99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in z around inf 68.2%
associate-*r/68.2%
metadata-eval68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in x around 0 66.4%
if 5.5e12 < (/.f64 x y) < 1.90000000000000001e125Initial program 99.9%
Taylor expanded in t around 0 68.9%
associate-*r/68.9%
metadata-eval68.9%
Simplified68.9%
Taylor expanded in z around 0 52.9%
Taylor expanded in z around 0 52.9%
if 1.90000000000000001e125 < (/.f64 x y) < 3.9999999999999997e168Initial program 99.2%
Taylor expanded in t around 0 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
Final simplification70.8%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -50000000.0)
(+ (/ x y) (/ 2.0 (* t z)))
(if (<= (/ x y) 1e+121)
(+ -2.0 (* (/ 2.0 t) (+ 1.0 (/ 1.0 z))))
(+ -2.0 (+ (/ 2.0 t) (/ x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -50000000.0) {
tmp = (x / y) + (2.0 / (t * z));
} else if ((x / y) <= 1e+121) {
tmp = -2.0 + ((2.0 / t) * (1.0 + (1.0 / z)));
} else {
tmp = -2.0 + ((2.0 / t) + (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) <= (-50000000.0d0)) then
tmp = (x / y) + (2.0d0 / (t * z))
else if ((x / y) <= 1d+121) then
tmp = (-2.0d0) + ((2.0d0 / t) * (1.0d0 + (1.0d0 / z)))
else
tmp = (-2.0d0) + ((2.0d0 / t) + (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) <= -50000000.0) {
tmp = (x / y) + (2.0 / (t * z));
} else if ((x / y) <= 1e+121) {
tmp = -2.0 + ((2.0 / t) * (1.0 + (1.0 / z)));
} else {
tmp = -2.0 + ((2.0 / t) + (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -50000000.0: tmp = (x / y) + (2.0 / (t * z)) elif (x / y) <= 1e+121: tmp = -2.0 + ((2.0 / t) * (1.0 + (1.0 / z))) else: tmp = -2.0 + ((2.0 / t) + (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -50000000.0) tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(t * z))); elseif (Float64(x / y) <= 1e+121) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) * Float64(1.0 + Float64(1.0 / z)))); else tmp = Float64(-2.0 + Float64(Float64(2.0 / t) + Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -50000000.0) tmp = (x / y) + (2.0 / (t * z)); elseif ((x / y) <= 1e+121) tmp = -2.0 + ((2.0 / t) * (1.0 + (1.0 / z))); else tmp = -2.0 + ((2.0 / t) + (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -50000000.0], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e+121], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] * N[(1.0 + N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -50000000:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t \cdot z}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{+121}:\\
\;\;\;\;-2 + \frac{2}{t} \cdot \left(1 + \frac{1}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;-2 + \left(\frac{2}{t} + \frac{x}{y}\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -5e7Initial program 87.3%
Taylor expanded in z around 0 91.8%
if -5e7 < (/.f64 x y) < 1.00000000000000004e121Initial program 83.6%
Taylor expanded in t around 0 99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
associate-*r/99.9%
+-commutative99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in x around 0 94.8%
associate-*r/94.8%
associate-*l/94.8%
associate-*r/94.8%
metadata-eval94.8%
associate-/r*94.8%
*-rgt-identity94.8%
associate-*r/94.7%
distribute-lft-out94.7%
Simplified94.7%
if 1.00000000000000004e121 < (/.f64 x y) Initial program 84.5%
Taylor expanded in t around 0 94.9%
sub-neg94.9%
metadata-eval94.9%
+-commutative94.9%
associate-+r+94.9%
metadata-eval94.9%
associate-*r/94.9%
+-commutative94.9%
associate-*r/94.9%
metadata-eval94.9%
associate-*r/94.9%
metadata-eval94.9%
associate-/r*94.9%
Simplified94.9%
Taylor expanded in z around inf 97.7%
associate-*r/97.7%
metadata-eval97.7%
+-commutative97.7%
Simplified97.7%
Final simplification94.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)) (t_2 (+ -2.0 (/ 2.0 t))))
(if (<= z -1.55e+209)
t_2
(if (<= z -9.5e-37)
t_1
(if (<= z 4.8e-104)
(+ -2.0 (/ 2.0 (* t z)))
(if (or (<= z 4.5e+82) (and (not (<= z 1.8e+134)) (<= z 2.5e+244)))
t_1
t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double t_2 = -2.0 + (2.0 / t);
double tmp;
if (z <= -1.55e+209) {
tmp = t_2;
} else if (z <= -9.5e-37) {
tmp = t_1;
} else if (z <= 4.8e-104) {
tmp = -2.0 + (2.0 / (t * z));
} else if ((z <= 4.5e+82) || (!(z <= 1.8e+134) && (z <= 2.5e+244))) {
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 = (x / y) - 2.0d0
t_2 = (-2.0d0) + (2.0d0 / t)
if (z <= (-1.55d+209)) then
tmp = t_2
else if (z <= (-9.5d-37)) then
tmp = t_1
else if (z <= 4.8d-104) then
tmp = (-2.0d0) + (2.0d0 / (t * z))
else if ((z <= 4.5d+82) .or. (.not. (z <= 1.8d+134)) .and. (z <= 2.5d+244)) 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 = (x / y) - 2.0;
double t_2 = -2.0 + (2.0 / t);
double tmp;
if (z <= -1.55e+209) {
tmp = t_2;
} else if (z <= -9.5e-37) {
tmp = t_1;
} else if (z <= 4.8e-104) {
tmp = -2.0 + (2.0 / (t * z));
} else if ((z <= 4.5e+82) || (!(z <= 1.8e+134) && (z <= 2.5e+244))) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 t_2 = -2.0 + (2.0 / t) tmp = 0 if z <= -1.55e+209: tmp = t_2 elif z <= -9.5e-37: tmp = t_1 elif z <= 4.8e-104: tmp = -2.0 + (2.0 / (t * z)) elif (z <= 4.5e+82) or (not (z <= 1.8e+134) and (z <= 2.5e+244)): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) t_2 = Float64(-2.0 + Float64(2.0 / t)) tmp = 0.0 if (z <= -1.55e+209) tmp = t_2; elseif (z <= -9.5e-37) tmp = t_1; elseif (z <= 4.8e-104) tmp = Float64(-2.0 + Float64(2.0 / Float64(t * z))); elseif ((z <= 4.5e+82) || (!(z <= 1.8e+134) && (z <= 2.5e+244))) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; t_2 = -2.0 + (2.0 / t); tmp = 0.0; if (z <= -1.55e+209) tmp = t_2; elseif (z <= -9.5e-37) tmp = t_1; elseif (z <= 4.8e-104) tmp = -2.0 + (2.0 / (t * z)); elseif ((z <= 4.5e+82) || (~((z <= 1.8e+134)) && (z <= 2.5e+244))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.55e+209], t$95$2, If[LessEqual[z, -9.5e-37], t$95$1, If[LessEqual[z, 4.8e-104], N[(-2.0 + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.5e+82], And[N[Not[LessEqual[z, 1.8e+134]], $MachinePrecision], LessEqual[z, 2.5e+244]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
t_2 := -2 + \frac{2}{t}\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+209}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-104}:\\
\;\;\;\;-2 + \frac{2}{t \cdot z}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+82} \lor \neg \left(z \leq 1.8 \cdot 10^{+134}\right) \land z \leq 2.5 \cdot 10^{+244}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.55e209 or 4.4999999999999997e82 < z < 1.79999999999999994e134 or 2.50000000000000011e244 < z Initial program 73.8%
Taylor expanded in t around 0 100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
associate-*r/100.0%
+-commutative100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 85.6%
if -1.55e209 < z < -9.49999999999999927e-37 or 4.8000000000000001e-104 < z < 4.4999999999999997e82 or 1.79999999999999994e134 < z < 2.50000000000000011e244Initial program 78.2%
Taylor expanded in t around inf 72.9%
if -9.49999999999999927e-37 < z < 4.8000000000000001e-104Initial program 97.8%
Taylor expanded in t around 0 97.8%
sub-neg97.8%
metadata-eval97.8%
+-commutative97.8%
associate-+r+97.8%
metadata-eval97.8%
associate-*r/97.8%
+-commutative97.8%
associate-*r/97.8%
metadata-eval97.8%
associate-*r/97.8%
metadata-eval97.8%
associate-/r*97.8%
Simplified97.8%
Taylor expanded in z around 0 74.9%
*-commutative74.9%
Simplified74.9%
Final simplification76.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)) (t_2 (+ -2.0 (/ 2.0 t))))
(if (<= z -1.55e+209)
t_2
(if (<= z -3.5e-35)
t_1
(if (<= z 2.6e-103)
(+ -2.0 (/ (/ 2.0 t) z))
(if (or (<= z 4.8e+82) (and (not (<= z 2.1e+134)) (<= z 3.4e+246)))
t_1
t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double t_2 = -2.0 + (2.0 / t);
double tmp;
if (z <= -1.55e+209) {
tmp = t_2;
} else if (z <= -3.5e-35) {
tmp = t_1;
} else if (z <= 2.6e-103) {
tmp = -2.0 + ((2.0 / t) / z);
} else if ((z <= 4.8e+82) || (!(z <= 2.1e+134) && (z <= 3.4e+246))) {
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 = (x / y) - 2.0d0
t_2 = (-2.0d0) + (2.0d0 / t)
if (z <= (-1.55d+209)) then
tmp = t_2
else if (z <= (-3.5d-35)) then
tmp = t_1
else if (z <= 2.6d-103) then
tmp = (-2.0d0) + ((2.0d0 / t) / z)
else if ((z <= 4.8d+82) .or. (.not. (z <= 2.1d+134)) .and. (z <= 3.4d+246)) 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 = (x / y) - 2.0;
double t_2 = -2.0 + (2.0 / t);
double tmp;
if (z <= -1.55e+209) {
tmp = t_2;
} else if (z <= -3.5e-35) {
tmp = t_1;
} else if (z <= 2.6e-103) {
tmp = -2.0 + ((2.0 / t) / z);
} else if ((z <= 4.8e+82) || (!(z <= 2.1e+134) && (z <= 3.4e+246))) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 t_2 = -2.0 + (2.0 / t) tmp = 0 if z <= -1.55e+209: tmp = t_2 elif z <= -3.5e-35: tmp = t_1 elif z <= 2.6e-103: tmp = -2.0 + ((2.0 / t) / z) elif (z <= 4.8e+82) or (not (z <= 2.1e+134) and (z <= 3.4e+246)): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) t_2 = Float64(-2.0 + Float64(2.0 / t)) tmp = 0.0 if (z <= -1.55e+209) tmp = t_2; elseif (z <= -3.5e-35) tmp = t_1; elseif (z <= 2.6e-103) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); elseif ((z <= 4.8e+82) || (!(z <= 2.1e+134) && (z <= 3.4e+246))) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; t_2 = -2.0 + (2.0 / t); tmp = 0.0; if (z <= -1.55e+209) tmp = t_2; elseif (z <= -3.5e-35) tmp = t_1; elseif (z <= 2.6e-103) tmp = -2.0 + ((2.0 / t) / z); elseif ((z <= 4.8e+82) || (~((z <= 2.1e+134)) && (z <= 3.4e+246))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.55e+209], t$95$2, If[LessEqual[z, -3.5e-35], t$95$1, If[LessEqual[z, 2.6e-103], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.8e+82], And[N[Not[LessEqual[z, 2.1e+134]], $MachinePrecision], LessEqual[z, 3.4e+246]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
t_2 := -2 + \frac{2}{t}\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+209}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-35}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-103}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+82} \lor \neg \left(z \leq 2.1 \cdot 10^{+134}\right) \land z \leq 3.4 \cdot 10^{+246}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.55e209 or 4.79999999999999996e82 < z < 2.1000000000000001e134 or 3.39999999999999988e246 < z Initial program 73.8%
Taylor expanded in t around 0 100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
associate-*r/100.0%
+-commutative100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 85.6%
if -1.55e209 < z < -3.49999999999999996e-35 or 2.59999999999999996e-103 < z < 4.79999999999999996e82 or 2.1000000000000001e134 < z < 3.39999999999999988e246Initial program 78.2%
Taylor expanded in t around inf 72.9%
if -3.49999999999999996e-35 < z < 2.59999999999999996e-103Initial program 97.8%
Taylor expanded in t around 0 97.8%
sub-neg97.8%
metadata-eval97.8%
+-commutative97.8%
associate-+r+97.8%
metadata-eval97.8%
associate-*r/97.8%
+-commutative97.8%
associate-*r/97.8%
metadata-eval97.8%
associate-*r/97.8%
metadata-eval97.8%
associate-/r*97.8%
Simplified97.8%
Taylor expanded in x around 0 74.9%
associate-*r/74.9%
associate-*l/74.9%
associate-*r/74.9%
metadata-eval74.9%
associate-/r*74.9%
*-rgt-identity74.9%
associate-*r/74.8%
distribute-lft-out74.8%
Simplified74.8%
Taylor expanded in z around 0 74.9%
associate-/r*74.9%
Simplified74.9%
Final simplification76.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t)) (t_2 (- (/ x y) 2.0)))
(if (<= t -4.6e-46)
t_2
(if (<= t -4.2e-160)
t_1
(if (<= t -2.4e-202) (/ x y) (if (<= t 1.42e+19) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (2.0 + (2.0 / z)) / t;
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -4.6e-46) {
tmp = t_2;
} else if (t <= -4.2e-160) {
tmp = t_1;
} else if (t <= -2.4e-202) {
tmp = x / y;
} else if (t <= 1.42e+19) {
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 + (2.0d0 / z)) / t
t_2 = (x / y) - 2.0d0
if (t <= (-4.6d-46)) then
tmp = t_2
else if (t <= (-4.2d-160)) then
tmp = t_1
else if (t <= (-2.4d-202)) then
tmp = x / y
else if (t <= 1.42d+19) 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 + (2.0 / z)) / t;
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -4.6e-46) {
tmp = t_2;
} else if (t <= -4.2e-160) {
tmp = t_1;
} else if (t <= -2.4e-202) {
tmp = x / y;
} else if (t <= 1.42e+19) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 + (2.0 / z)) / t t_2 = (x / y) - 2.0 tmp = 0 if t <= -4.6e-46: tmp = t_2 elif t <= -4.2e-160: tmp = t_1 elif t <= -2.4e-202: tmp = x / y elif t <= 1.42e+19: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(2.0 + Float64(2.0 / z)) / t) t_2 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -4.6e-46) tmp = t_2; elseif (t <= -4.2e-160) tmp = t_1; elseif (t <= -2.4e-202) tmp = Float64(x / y); elseif (t <= 1.42e+19) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (2.0 + (2.0 / z)) / t; t_2 = (x / y) - 2.0; tmp = 0.0; if (t <= -4.6e-46) tmp = t_2; elseif (t <= -4.2e-160) tmp = t_1; elseif (t <= -2.4e-202) tmp = x / y; elseif (t <= 1.42e+19) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -4.6e-46], t$95$2, If[LessEqual[t, -4.2e-160], t$95$1, If[LessEqual[t, -2.4e-202], N[(x / y), $MachinePrecision], If[LessEqual[t, 1.42e+19], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2 + \frac{2}{z}}{t}\\
t_2 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -4.6 \cdot 10^{-46}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -4.2 \cdot 10^{-160}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -2.4 \cdot 10^{-202}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t \leq 1.42 \cdot 10^{+19}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -4.5999999999999998e-46 or 1.42e19 < t Initial program 72.3%
Taylor expanded in t around inf 83.4%
if -4.5999999999999998e-46 < t < -4.2000000000000001e-160 or -2.4000000000000001e-202 < t < 1.42e19Initial program 98.0%
Taylor expanded in t around 0 87.0%
associate-*r/87.0%
metadata-eval87.0%
Simplified87.0%
if -4.2000000000000001e-160 < t < -2.4000000000000001e-202Initial program 100.0%
Taylor expanded in x around inf 86.0%
Final simplification85.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -245000.0) (not (<= (/ x y) 4e+168))) (/ x y) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -245000.0) || !((x / y) <= 4e+168)) {
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) <= (-245000.0d0)) .or. (.not. ((x / y) <= 4d+168))) 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) <= -245000.0) || !((x / y) <= 4e+168)) {
tmp = x / y;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -245000.0) or not ((x / y) <= 4e+168): 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) <= -245000.0) || !(Float64(x / y) <= 4e+168)) 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) <= -245000.0) || ~(((x / y) <= 4e+168))) 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], -245000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e+168]], $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 -245000 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+168}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -245000 or 3.9999999999999997e168 < (/.f64 x y) Initial program 85.7%
Taylor expanded in x around inf 77.3%
if -245000 < (/.f64 x y) < 3.9999999999999997e168Initial program 83.9%
Taylor expanded in t around 0 99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
associate-*r/99.9%
+-commutative99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in z around inf 67.2%
associate-*r/67.2%
metadata-eval67.2%
+-commutative67.2%
Simplified67.2%
Taylor expanded in x around 0 62.8%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1050000.0) (not (<= (/ x y) 4e+168))) (- (/ x y) 2.0) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1050000.0) || !((x / y) <= 4e+168)) {
tmp = (x / y) - 2.0;
} 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) <= (-1050000.0d0)) .or. (.not. ((x / y) <= 4d+168))) then
tmp = (x / y) - 2.0d0
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) <= -1050000.0) || !((x / y) <= 4e+168)) {
tmp = (x / y) - 2.0;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1050000.0) or not ((x / y) <= 4e+168): tmp = (x / y) - 2.0 else: tmp = -2.0 + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1050000.0) || !(Float64(x / y) <= 4e+168)) tmp = Float64(Float64(x / y) - 2.0); 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) <= -1050000.0) || ~(((x / y) <= 4e+168))) tmp = (x / y) - 2.0; else tmp = -2.0 + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1050000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e+168]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1050000 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+168}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.05e6 or 3.9999999999999997e168 < (/.f64 x y) Initial program 85.7%
Taylor expanded in t around inf 78.6%
if -1.05e6 < (/.f64 x y) < 3.9999999999999997e168Initial program 83.9%
Taylor expanded in t around 0 99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
associate-*r/99.9%
+-commutative99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in z around inf 67.2%
associate-*r/67.2%
metadata-eval67.2%
+-commutative67.2%
Simplified67.2%
Taylor expanded in x around 0 62.8%
Final simplification68.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.4e-34) (not (<= z 1.7e-105))) (+ -2.0 (+ (/ 2.0 t) (/ x y))) (+ -2.0 (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.4e-34) || !(z <= 1.7e-105)) {
tmp = -2.0 + ((2.0 / t) + (x / y));
} else {
tmp = -2.0 + ((2.0 / t) / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.4d-34)) .or. (.not. (z <= 1.7d-105))) then
tmp = (-2.0d0) + ((2.0d0 / t) + (x / y))
else
tmp = (-2.0d0) + ((2.0d0 / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.4e-34) || !(z <= 1.7e-105)) {
tmp = -2.0 + ((2.0 / t) + (x / y));
} else {
tmp = -2.0 + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.4e-34) or not (z <= 1.7e-105): tmp = -2.0 + ((2.0 / t) + (x / y)) else: tmp = -2.0 + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.4e-34) || !(z <= 1.7e-105)) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) + Float64(x / y))); else tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.4e-34) || ~((z <= 1.7e-105))) tmp = -2.0 + ((2.0 / t) + (x / y)); else tmp = -2.0 + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.4e-34], N[Not[LessEqual[z, 1.7e-105]], $MachinePrecision]], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-34} \lor \neg \left(z \leq 1.7 \cdot 10^{-105}\right):\\
\;\;\;\;-2 + \left(\frac{2}{t} + \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -1.39999999999999998e-34 or 1.69999999999999996e-105 < z Initial program 77.1%
Taylor expanded in t around 0 100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
associate-*r/100.0%
+-commutative100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in z around inf 94.3%
associate-*r/94.3%
metadata-eval94.3%
+-commutative94.3%
Simplified94.3%
if -1.39999999999999998e-34 < z < 1.69999999999999996e-105Initial program 97.7%
Taylor expanded in t around 0 97.8%
sub-neg97.8%
metadata-eval97.8%
+-commutative97.8%
associate-+r+97.8%
metadata-eval97.8%
associate-*r/97.8%
+-commutative97.8%
associate-*r/97.8%
metadata-eval97.8%
associate-*r/97.8%
metadata-eval97.8%
associate-/r*97.7%
Simplified97.7%
Taylor expanded in x around 0 75.4%
associate-*r/75.4%
associate-*l/75.4%
associate-*r/75.4%
metadata-eval75.4%
associate-/r*75.5%
*-rgt-identity75.5%
associate-*r/75.4%
distribute-lft-out75.4%
Simplified75.4%
Taylor expanded in z around 0 75.4%
associate-/r*75.5%
Simplified75.5%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.1e-6) (not (<= z 2.5e-19))) (+ -2.0 (+ (/ 2.0 t) (/ x y))) (+ (/ x y) (/ 2.0 (* t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.1e-6) || !(z <= 2.5e-19)) {
tmp = -2.0 + ((2.0 / t) + (x / y));
} 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 <= (-4.1d-6)) .or. (.not. (z <= 2.5d-19))) then
tmp = (-2.0d0) + ((2.0d0 / t) + (x / y))
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 <= -4.1e-6) || !(z <= 2.5e-19)) {
tmp = -2.0 + ((2.0 / t) + (x / y));
} else {
tmp = (x / y) + (2.0 / (t * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.1e-6) or not (z <= 2.5e-19): tmp = -2.0 + ((2.0 / t) + (x / y)) else: tmp = (x / y) + (2.0 / (t * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.1e-6) || !(z <= 2.5e-19)) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) + Float64(x / y))); else tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(t * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.1e-6) || ~((z <= 2.5e-19))) tmp = -2.0 + ((2.0 / t) + (x / y)); else tmp = (x / y) + (2.0 / (t * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.1e-6], N[Not[LessEqual[z, 2.5e-19]], $MachinePrecision]], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-6} \lor \neg \left(z \leq 2.5 \cdot 10^{-19}\right):\\
\;\;\;\;-2 + \left(\frac{2}{t} + \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t \cdot z}\\
\end{array}
\end{array}
if z < -4.0999999999999997e-6 or 2.5000000000000002e-19 < z Initial program 73.4%
Taylor expanded in t around 0 100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
associate-*r/100.0%
+-commutative100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in z around inf 99.5%
associate-*r/99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
if -4.0999999999999997e-6 < z < 2.5000000000000002e-19Initial program 98.2%
Taylor expanded in z around 0 86.4%
Final simplification93.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -32000.0) (not (<= (/ x y) 4e+168))) (/ x y) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -32000.0) || !((x / y) <= 4e+168)) {
tmp = x / y;
} else {
tmp = 2.0 / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-32000.0d0)) .or. (.not. ((x / y) <= 4d+168))) then
tmp = x / y
else
tmp = 2.0d0 / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -32000.0) || !((x / y) <= 4e+168)) {
tmp = x / y;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -32000.0) or not ((x / y) <= 4e+168): tmp = x / y else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -32000.0) || !(Float64(x / y) <= 4e+168)) tmp = Float64(x / y); else tmp = Float64(2.0 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -32000.0) || ~(((x / y) <= 4e+168))) tmp = x / y; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -32000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e+168]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -32000 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+168}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -32000 or 3.9999999999999997e168 < (/.f64 x y) Initial program 85.7%
Taylor expanded in x around inf 77.3%
if -32000 < (/.f64 x y) < 3.9999999999999997e168Initial program 83.9%
Taylor expanded in t around 0 63.5%
associate-*r/63.5%
metadata-eval63.5%
Simplified63.5%
Taylor expanded in z around inf 31.7%
Final simplification49.1%
(FPCore (x y z t) :precision binary64 (/ 2.0 t))
double code(double x, double y, double z, double t) {
return 2.0 / t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 2.0d0 / t
end function
public static double code(double x, double y, double z, double t) {
return 2.0 / t;
}
def code(x, y, z, t): return 2.0 / t
function code(x, y, z, t) return Float64(2.0 / t) end
function tmp = code(x, y, z, t) tmp = 2.0 / t; end
code[x_, y_, z_, t_] := N[(2.0 / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{t}
\end{array}
Initial program 84.6%
Taylor expanded in t around 0 48.8%
associate-*r/48.8%
metadata-eval48.8%
Simplified48.8%
Taylor expanded in z around inf 22.3%
Final simplification22.3%
(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 2023333
(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))))