
(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 (/ x y)) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
return (-2.0 + (x / y)) + ((2.0 + (2.0 / z)) / 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) + (x / y)) + ((2.0d0 + (2.0d0 / z)) / t)
end function
public static double code(double x, double y, double z, double t) {
return (-2.0 + (x / y)) + ((2.0 + (2.0 / z)) / t);
}
def code(x, y, z, t): return (-2.0 + (x / y)) + ((2.0 + (2.0 / z)) / t)
function code(x, y, z, t) return Float64(Float64(-2.0 + Float64(x / y)) + Float64(Float64(2.0 + Float64(2.0 / z)) / t)) end
function tmp = code(x, y, z, t) tmp = (-2.0 + (x / y)) + ((2.0 + (2.0 / z)) / t); end
code[x_, y_, z_, t_] := N[(N[(-2.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-2 + \frac{x}{y}\right) + \frac{2 + \frac{2}{z}}{t}
\end{array}
Initial program 85.4%
+-commutative85.4%
remove-double-neg85.4%
distribute-frac-neg85.4%
unsub-neg85.4%
*-commutative85.4%
associate-*r*85.4%
distribute-rgt1-in85.4%
associate-/l*85.4%
fma-neg85.4%
*-commutative85.4%
fma-define85.4%
*-commutative85.4%
distribute-frac-neg85.4%
remove-double-neg85.4%
Simplified85.4%
Taylor expanded in t around inf 99.1%
associate--l+99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
associate-*r/99.1%
distribute-lft-in99.1%
metadata-eval99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification99.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 -5e-21)
t_2
(if (<= t 5.7e-121)
t_1
(if (<= t 2.8e-97) (/ x y) (if (<= t 3e-63) 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 <= -5e-21) {
tmp = t_2;
} else if (t <= 5.7e-121) {
tmp = t_1;
} else if (t <= 2.8e-97) {
tmp = x / y;
} else if (t <= 3e-63) {
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 <= (-5d-21)) then
tmp = t_2
else if (t <= 5.7d-121) then
tmp = t_1
else if (t <= 2.8d-97) then
tmp = x / y
else if (t <= 3d-63) 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 <= -5e-21) {
tmp = t_2;
} else if (t <= 5.7e-121) {
tmp = t_1;
} else if (t <= 2.8e-97) {
tmp = x / y;
} else if (t <= 3e-63) {
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 <= -5e-21: tmp = t_2 elif t <= 5.7e-121: tmp = t_1 elif t <= 2.8e-97: tmp = x / y elif t <= 3e-63: 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 <= -5e-21) tmp = t_2; elseif (t <= 5.7e-121) tmp = t_1; elseif (t <= 2.8e-97) tmp = Float64(x / y); elseif (t <= 3e-63) 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 <= -5e-21) tmp = t_2; elseif (t <= 5.7e-121) tmp = t_1; elseif (t <= 2.8e-97) tmp = x / y; elseif (t <= 3e-63) 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, -5e-21], t$95$2, If[LessEqual[t, 5.7e-121], t$95$1, If[LessEqual[t, 2.8e-97], N[(x / y), $MachinePrecision], If[LessEqual[t, 3e-63], 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 -5 \cdot 10^{-21}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 5.7 \cdot 10^{-121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{-97}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-63}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -4.99999999999999973e-21 or 2.99999999999999979e-63 < t Initial program 77.2%
Taylor expanded in t around inf 76.9%
if -4.99999999999999973e-21 < t < 5.70000000000000014e-121 or 2.8000000000000002e-97 < t < 2.99999999999999979e-63Initial program 97.7%
Taylor expanded in t around 0 90.8%
associate-*r/90.8%
metadata-eval90.8%
Simplified90.8%
if 5.70000000000000014e-121 < t < 2.8000000000000002e-97Initial program 100.0%
Taylor expanded in x around inf 96.0%
Final simplification82.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= z -6.5e-121)
t_1
(if (<= z 2.7e-119)
(/ 2.0 (* z t))
(if (or (<= z 29.0) (not (<= z 4.5e+55))) t_1 (+ -2.0 (/ 2.0 t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -6.5e-121) {
tmp = t_1;
} else if (z <= 2.7e-119) {
tmp = 2.0 / (z * t);
} else if ((z <= 29.0) || !(z <= 4.5e+55)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x / y) - 2.0d0
if (z <= (-6.5d-121)) then
tmp = t_1
else if (z <= 2.7d-119) then
tmp = 2.0d0 / (z * t)
else if ((z <= 29.0d0) .or. (.not. (z <= 4.5d+55))) then
tmp = t_1
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 t_1 = (x / y) - 2.0;
double tmp;
if (z <= -6.5e-121) {
tmp = t_1;
} else if (z <= 2.7e-119) {
tmp = 2.0 / (z * t);
} else if ((z <= 29.0) || !(z <= 4.5e+55)) {
tmp = t_1;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if z <= -6.5e-121: tmp = t_1 elif z <= 2.7e-119: tmp = 2.0 / (z * t) elif (z <= 29.0) or not (z <= 4.5e+55): tmp = t_1 else: tmp = -2.0 + (2.0 / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (z <= -6.5e-121) tmp = t_1; elseif (z <= 2.7e-119) tmp = Float64(2.0 / Float64(z * t)); elseif ((z <= 29.0) || !(z <= 4.5e+55)) tmp = t_1; else tmp = Float64(-2.0 + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (z <= -6.5e-121) tmp = t_1; elseif (z <= 2.7e-119) tmp = 2.0 / (z * t); elseif ((z <= 29.0) || ~((z <= 4.5e+55))) tmp = t_1; else tmp = -2.0 + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[z, -6.5e-121], t$95$1, If[LessEqual[z, 2.7e-119], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 29.0], N[Not[LessEqual[z, 4.5e+55]], $MachinePrecision]], t$95$1, N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{-121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-119}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{elif}\;z \leq 29 \lor \neg \left(z \leq 4.5 \cdot 10^{+55}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if z < -6.5000000000000003e-121 or 2.70000000000000027e-119 < z < 29 or 4.49999999999999998e55 < z Initial program 78.7%
Taylor expanded in t around inf 70.9%
if -6.5000000000000003e-121 < z < 2.70000000000000027e-119Initial program 97.4%
+-commutative97.4%
remove-double-neg97.4%
distribute-frac-neg97.4%
unsub-neg97.4%
*-commutative97.4%
associate-*r*97.4%
distribute-rgt1-in97.4%
associate-/l*97.4%
fma-neg97.4%
*-commutative97.4%
fma-define97.4%
*-commutative97.4%
distribute-frac-neg97.4%
remove-double-neg97.4%
Simplified97.4%
Taylor expanded in t around inf 97.4%
associate--l+97.4%
+-commutative97.4%
sub-neg97.4%
metadata-eval97.4%
+-commutative97.4%
associate-*r/97.4%
distribute-lft-in97.4%
metadata-eval97.4%
associate-*r/97.4%
metadata-eval97.4%
Simplified97.4%
Taylor expanded in z around 0 79.4%
if 29 < z < 4.49999999999999998e55Initial program 99.8%
+-commutative99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*r*99.8%
distribute-rgt1-in99.8%
associate-/l*99.5%
fma-neg99.5%
*-commutative99.5%
fma-define99.5%
*-commutative99.5%
distribute-frac-neg99.5%
remove-double-neg99.5%
Simplified99.5%
Taylor expanded in t around inf 99.8%
associate--l+99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
associate-*r/99.8%
distribute-lft-in99.8%
metadata-eval99.8%
associate-*r/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-out100.0%
associate-/l/100.0%
*-lft-identity100.0%
associate-*l/100.0%
distribute-lft-out100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*r/100.0%
metadata-eval100.0%
distribute-rgt-in100.0%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in z around inf 91.6%
Final simplification74.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -800000000.0) (not (<= (/ x y) 3.5e+68))) (+ (/ x y) (+ -2.0 (/ 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) <= -800000000.0) || !((x / y) <= 3.5e+68)) {
tmp = (x / y) + (-2.0 + (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) <= (-800000000.0d0)) .or. (.not. ((x / y) <= 3.5d+68))) then
tmp = (x / y) + ((-2.0d0) + (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) <= -800000000.0) || !((x / y) <= 3.5e+68)) {
tmp = (x / y) + (-2.0 + (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) <= -800000000.0) or not ((x / y) <= 3.5e+68): tmp = (x / y) + (-2.0 + (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) <= -800000000.0) || !(Float64(x / y) <= 3.5e+68)) tmp = Float64(Float64(x / y) + Float64(-2.0 + 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) <= -800000000.0) || ~(((x / y) <= 3.5e+68))) tmp = (x / y) + (-2.0 + (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], -800000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 3.5e+68]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -800000000 \lor \neg \left(\frac{x}{y} \leq 3.5 \cdot 10^{+68}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -8e8 or 3.49999999999999977e68 < (/.f64 x y) Initial program 84.5%
Taylor expanded in z around inf 82.8%
div-sub82.8%
sub-neg82.8%
*-inverses82.8%
metadata-eval82.8%
distribute-lft-in82.8%
metadata-eval82.8%
associate-*r/82.8%
metadata-eval82.8%
Simplified82.8%
if -8e8 < (/.f64 x y) < 3.49999999999999977e68Initial program 86.1%
+-commutative86.1%
remove-double-neg86.1%
distribute-frac-neg86.1%
unsub-neg86.1%
*-commutative86.1%
associate-*r*86.1%
distribute-rgt1-in86.1%
associate-/l*86.0%
fma-neg86.0%
*-commutative86.0%
fma-define86.0%
*-commutative86.0%
distribute-frac-neg86.0%
remove-double-neg86.0%
Simplified86.0%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 96.0%
sub-neg96.0%
metadata-eval96.0%
+-commutative96.0%
distribute-lft-out96.0%
associate-/l/95.9%
*-lft-identity95.9%
associate-*l/95.9%
distribute-lft-out95.9%
*-commutative95.9%
associate-*r*95.9%
associate-*r/95.9%
metadata-eval95.9%
distribute-rgt-in95.9%
associate-*l/95.9%
*-lft-identity95.9%
Simplified95.9%
Final simplification90.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -4.5e+38) (not (<= (/ x y) 3.4e+21))) (+ (/ x y) (/ 2.0 (* z t))) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4.5e+38) || !((x / y) <= 3.4e+21)) {
tmp = (x / y) + (2.0 / (z * 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) <= (-4.5d+38)) .or. (.not. ((x / y) <= 3.4d+21))) then
tmp = (x / y) + (2.0d0 / (z * 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) <= -4.5e+38) || !((x / y) <= 3.4e+21)) {
tmp = (x / y) + (2.0 / (z * t));
} else {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -4.5e+38) or not ((x / y) <= 3.4e+21): tmp = (x / y) + (2.0 / (z * 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) <= -4.5e+38) || !(Float64(x / y) <= 3.4e+21)) tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * 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) <= -4.5e+38) || ~(((x / y) <= 3.4e+21))) tmp = (x / y) + (2.0 / (z * 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], -4.5e+38], N[Not[LessEqual[N[(x / y), $MachinePrecision], 3.4e+21]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4.5 \cdot 10^{+38} \lor \neg \left(\frac{x}{y} \leq 3.4 \cdot 10^{+21}\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.4999999999999998e38 or 3.4e21 < (/.f64 x y) Initial program 84.7%
Taylor expanded in z around 0 93.5%
if -4.4999999999999998e38 < (/.f64 x y) < 3.4e21Initial program 86.0%
+-commutative86.0%
remove-double-neg86.0%
distribute-frac-neg86.0%
unsub-neg86.0%
*-commutative86.0%
associate-*r*86.0%
distribute-rgt1-in86.0%
associate-/l*85.9%
fma-neg86.0%
*-commutative86.0%
fma-define86.0%
*-commutative86.0%
distribute-frac-neg86.0%
remove-double-neg86.0%
Simplified86.0%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 97.9%
sub-neg97.9%
metadata-eval97.9%
+-commutative97.9%
distribute-lft-out97.9%
associate-/l/97.9%
*-lft-identity97.9%
associate-*l/97.8%
distribute-lft-out97.8%
*-commutative97.8%
associate-*r*97.8%
associate-*r/97.8%
metadata-eval97.8%
distribute-rgt-in97.8%
associate-*l/97.9%
*-lft-identity97.9%
Simplified97.9%
Final simplification95.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -1.22e+104) (/ x y) (if (<= (/ x y) 6.1e+56) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t)) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.22e+104) {
tmp = x / y;
} else if ((x / y) <= 6.1e+56) {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= (-1.22d+104)) then
tmp = x / y
else if ((x / y) <= 6.1d+56) then
tmp = (-2.0d0) + ((2.0d0 + (2.0d0 / z)) / t)
else
tmp = (x / y) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.22e+104) {
tmp = x / y;
} else if ((x / y) <= 6.1e+56) {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1.22e+104: tmp = x / y elif (x / y) <= 6.1e+56: tmp = -2.0 + ((2.0 + (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) <= -1.22e+104) tmp = Float64(x / y); elseif (Float64(x / y) <= 6.1e+56) tmp = Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t)); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -1.22e+104) tmp = x / y; elseif ((x / y) <= 6.1e+56) tmp = -2.0 + ((2.0 + (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], -1.22e+104], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 6.1e+56], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.22 \cdot 10^{+104}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 6.1 \cdot 10^{+56}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -1.22e104Initial program 88.6%
Taylor expanded in x around inf 86.8%
if -1.22e104 < (/.f64 x y) < 6.1000000000000001e56Initial program 86.7%
+-commutative86.7%
remove-double-neg86.7%
distribute-frac-neg86.7%
unsub-neg86.7%
*-commutative86.7%
associate-*r*86.7%
distribute-rgt1-in86.7%
associate-/l*86.6%
fma-neg86.6%
*-commutative86.6%
fma-define86.6%
*-commutative86.6%
distribute-frac-neg86.6%
remove-double-neg86.6%
Simplified86.6%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 92.2%
sub-neg92.2%
metadata-eval92.2%
+-commutative92.2%
distribute-lft-out92.2%
associate-/l/92.2%
*-lft-identity92.2%
associate-*l/92.1%
distribute-lft-out92.1%
*-commutative92.1%
associate-*r*92.1%
associate-*r/92.1%
metadata-eval92.1%
distribute-rgt-in92.1%
associate-*l/92.2%
*-lft-identity92.2%
Simplified92.2%
if 6.1000000000000001e56 < (/.f64 x y) Initial program 78.8%
Taylor expanded in t around inf 75.5%
Final simplification87.9%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2e+42)
(/ (+ x (* 2.0 (/ (/ y t) z))) y)
(if (<= (/ x y) 1e+17)
(+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))
(+ (/ x y) (/ 2.0 (* z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+42) {
tmp = (x + (2.0 * ((y / t) / z))) / y;
} else if ((x / y) <= 1e+17) {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
} 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 ((x / y) <= (-2d+42)) then
tmp = (x + (2.0d0 * ((y / t) / z))) / y
else if ((x / y) <= 1d+17) then
tmp = (-2.0d0) + ((2.0d0 + (2.0d0 / z)) / t)
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 ((x / y) <= -2e+42) {
tmp = (x + (2.0 * ((y / t) / z))) / y;
} else if ((x / y) <= 1e+17) {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
} else {
tmp = (x / y) + (2.0 / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2e+42: tmp = (x + (2.0 * ((y / t) / z))) / y elif (x / y) <= 1e+17: tmp = -2.0 + ((2.0 + (2.0 / z)) / t) else: tmp = (x / y) + (2.0 / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2e+42) tmp = Float64(Float64(x + Float64(2.0 * Float64(Float64(y / t) / z))) / y); elseif (Float64(x / y) <= 1e+17) tmp = Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t)); else tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2e+42) tmp = (x + (2.0 * ((y / t) / z))) / y; elseif ((x / y) <= 1e+17) tmp = -2.0 + ((2.0 + (2.0 / z)) / t); else tmp = (x / y) + (2.0 / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2e+42], N[(N[(x + N[(2.0 * N[(N[(y / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e+17], 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[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+42}:\\
\;\;\;\;\frac{x + 2 \cdot \frac{\frac{y}{t}}{z}}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{+17}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if (/.f64 x y) < -2.00000000000000009e42Initial program 89.6%
Taylor expanded in z around 0 93.5%
associate-/r*93.5%
Simplified93.5%
Taylor expanded in y around 0 95.2%
associate-/r*95.2%
Simplified95.2%
if -2.00000000000000009e42 < (/.f64 x y) < 1e17Initial program 86.0%
+-commutative86.0%
remove-double-neg86.0%
distribute-frac-neg86.0%
unsub-neg86.0%
*-commutative86.0%
associate-*r*86.0%
distribute-rgt1-in86.0%
associate-/l*85.9%
fma-neg86.0%
*-commutative86.0%
fma-define86.0%
*-commutative86.0%
distribute-frac-neg86.0%
remove-double-neg86.0%
Simplified86.0%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 97.9%
sub-neg97.9%
metadata-eval97.9%
+-commutative97.9%
distribute-lft-out97.9%
associate-/l/97.9%
*-lft-identity97.9%
associate-*l/97.8%
distribute-lft-out97.8%
*-commutative97.8%
associate-*r*97.8%
associate-*r/97.8%
metadata-eval97.8%
distribute-rgt-in97.8%
associate-*l/97.9%
*-lft-identity97.9%
Simplified97.9%
if 1e17 < (/.f64 x y) Initial program 80.0%
Taylor expanded in z around 0 93.4%
Final simplification96.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5.8e+38) (not (<= (/ x y) 6.8e+16))) (/ x y) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5.8e+38) || !((x / y) <= 6.8e+16)) {
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) <= (-5.8d+38)) .or. (.not. ((x / y) <= 6.8d+16))) 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) <= -5.8e+38) || !((x / y) <= 6.8e+16)) {
tmp = x / y;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5.8e+38) or not ((x / y) <= 6.8e+16): 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) <= -5.8e+38) || !(Float64(x / y) <= 6.8e+16)) 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) <= -5.8e+38) || ~(((x / y) <= 6.8e+16))) 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], -5.8e+38], N[Not[LessEqual[N[(x / y), $MachinePrecision], 6.8e+16]], $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.8 \cdot 10^{+38} \lor \neg \left(\frac{x}{y} \leq 6.8 \cdot 10^{+16}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.80000000000000013e38 or 6.8e16 < (/.f64 x y) Initial program 84.7%
Taylor expanded in x around inf 73.8%
if -5.80000000000000013e38 < (/.f64 x y) < 6.8e16Initial program 86.0%
+-commutative86.0%
remove-double-neg86.0%
distribute-frac-neg86.0%
unsub-neg86.0%
*-commutative86.0%
associate-*r*86.0%
distribute-rgt1-in86.0%
associate-/l*85.9%
fma-neg86.0%
*-commutative86.0%
fma-define86.0%
*-commutative86.0%
distribute-frac-neg86.0%
remove-double-neg86.0%
Simplified86.0%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 97.9%
sub-neg97.9%
metadata-eval97.9%
+-commutative97.9%
distribute-lft-out97.9%
associate-/l/97.9%
*-lft-identity97.9%
associate-*l/97.8%
distribute-lft-out97.8%
*-commutative97.8%
associate-*r*97.8%
associate-*r/97.8%
metadata-eval97.8%
distribute-rgt-in97.8%
associate-*l/97.9%
*-lft-identity97.9%
Simplified97.9%
Taylor expanded in z around inf 59.8%
Final simplification66.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2.8e-24) (not (<= (/ x y) 1.7e+19))) (- (/ x y) 2.0) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2.8e-24) || !((x / y) <= 1.7e+19)) {
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) <= (-2.8d-24)) .or. (.not. ((x / y) <= 1.7d+19))) 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) <= -2.8e-24) || !((x / y) <= 1.7e+19)) {
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) <= -2.8e-24) or not ((x / y) <= 1.7e+19): 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) <= -2.8e-24) || !(Float64(x / y) <= 1.7e+19)) 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) <= -2.8e-24) || ~(((x / y) <= 1.7e+19))) 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], -2.8e-24], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1.7e+19]], $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 -2.8 \cdot 10^{-24} \lor \neg \left(\frac{x}{y} \leq 1.7 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -2.8000000000000002e-24 or 1.7e19 < (/.f64 x y) Initial program 84.2%
Taylor expanded in t around inf 71.1%
if -2.8000000000000002e-24 < (/.f64 x y) < 1.7e19Initial program 86.6%
+-commutative86.6%
remove-double-neg86.6%
distribute-frac-neg86.6%
unsub-neg86.6%
*-commutative86.6%
associate-*r*86.6%
distribute-rgt1-in86.6%
associate-/l*86.5%
fma-neg86.5%
*-commutative86.5%
fma-define86.5%
*-commutative86.5%
distribute-frac-neg86.5%
remove-double-neg86.5%
Simplified86.5%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
distribute-lft-out99.2%
associate-/l/99.1%
*-lft-identity99.1%
associate-*l/99.1%
distribute-lft-out99.1%
*-commutative99.1%
associate-*r*99.1%
associate-*r/99.1%
metadata-eval99.1%
distribute-rgt-in99.1%
associate-*l/99.1%
*-lft-identity99.1%
Simplified99.1%
Taylor expanded in z around inf 62.1%
Final simplification66.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2.0) (not (<= (/ x y) 320000000000.0))) (/ x y) -2.0))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2.0) || !((x / y) <= 320000000000.0)) {
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) <= (-2.0d0)) .or. (.not. ((x / y) <= 320000000000.0d0))) 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) <= -2.0) || !((x / y) <= 320000000000.0)) {
tmp = x / y;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2.0) or not ((x / y) <= 320000000000.0): tmp = x / y else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2.0) || !(Float64(x / y) <= 320000000000.0)) 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) <= -2.0) || ~(((x / y) <= 320000000000.0))) tmp = x / y; else tmp = -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], 320000000000.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], -2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \lor \neg \left(\frac{x}{y} \leq 320000000000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if (/.f64 x y) < -2 or 3.2e11 < (/.f64 x y) Initial program 84.8%
Taylor expanded in x around inf 71.3%
if -2 < (/.f64 x y) < 3.2e11Initial program 86.1%
+-commutative86.1%
remove-double-neg86.1%
distribute-frac-neg86.1%
unsub-neg86.1%
*-commutative86.1%
associate-*r*86.1%
distribute-rgt1-in86.1%
associate-/l*86.0%
fma-neg86.0%
*-commutative86.0%
fma-define86.0%
*-commutative86.0%
distribute-frac-neg86.0%
remove-double-neg86.0%
Simplified86.0%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
distribute-lft-out99.3%
associate-/l/99.2%
*-lft-identity99.2%
associate-*l/99.2%
distribute-lft-out99.2%
*-commutative99.2%
associate-*r*99.2%
associate-*r/99.2%
metadata-eval99.2%
distribute-rgt-in99.2%
associate-*l/99.2%
*-lft-identity99.2%
Simplified99.2%
Taylor expanded in z around inf 61.3%
Taylor expanded in t around inf 37.0%
Final simplification53.7%
(FPCore (x y z t) :precision binary64 (if (<= t -1.0) -2.0 (if (<= t 1.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 <= 1.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 <= 1.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 <= 1.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 <= 1.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 <= 1.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 <= 1.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, 1.0], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 1:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1 or 1 < t Initial program 73.8%
+-commutative73.8%
remove-double-neg73.8%
distribute-frac-neg73.8%
unsub-neg73.8%
*-commutative73.8%
associate-*r*73.8%
distribute-rgt1-in73.8%
associate-/l*73.7%
fma-neg73.8%
*-commutative73.8%
fma-define73.8%
*-commutative73.8%
distribute-frac-neg73.8%
remove-double-neg73.8%
Simplified73.8%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 54.7%
sub-neg54.7%
metadata-eval54.7%
+-commutative54.7%
distribute-lft-out54.7%
associate-/l/54.7%
*-lft-identity54.7%
associate-*l/54.6%
distribute-lft-out54.6%
*-commutative54.6%
associate-*r*54.6%
associate-*r/54.6%
metadata-eval54.6%
distribute-rgt-in54.6%
associate-*l/54.7%
*-lft-identity54.7%
Simplified54.7%
Taylor expanded in z around inf 36.8%
Taylor expanded in t around inf 36.2%
if -1 < t < 1Initial program 98.2%
Taylor expanded in t around 0 78.0%
associate-*r/78.0%
metadata-eval78.0%
Simplified78.0%
Taylor expanded in z around inf 32.8%
Final simplification34.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 85.4%
+-commutative85.4%
remove-double-neg85.4%
distribute-frac-neg85.4%
unsub-neg85.4%
*-commutative85.4%
associate-*r*85.4%
distribute-rgt1-in85.4%
associate-/l*85.4%
fma-neg85.4%
*-commutative85.4%
fma-define85.4%
*-commutative85.4%
distribute-frac-neg85.4%
remove-double-neg85.4%
Simplified85.4%
Taylor expanded in t around inf 99.1%
associate--l+99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
associate-*r/99.1%
distribute-lft-in99.1%
metadata-eval99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in x around 0 66.5%
sub-neg66.5%
metadata-eval66.5%
+-commutative66.5%
distribute-lft-out66.5%
associate-/l/66.4%
*-lft-identity66.4%
associate-*l/66.4%
distribute-lft-out66.4%
*-commutative66.4%
associate-*r*66.4%
associate-*r/66.4%
metadata-eval66.4%
distribute-rgt-in66.4%
associate-*l/66.4%
*-lft-identity66.4%
Simplified66.4%
Taylor expanded in z around inf 35.5%
Taylor expanded in t around inf 20.2%
Final simplification20.2%
(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 2024059
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:alt
(- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))