
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / y) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / y) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
(FPCore (x y z t) :precision binary64 (+ (+ (* 2.0 (/ (+ 1.0 z) (* z t))) (/ x y)) -2.0))
double code(double x, double y, double z, double t) {
return ((2.0 * ((1.0 + z) / (z * t))) + (x / y)) + -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 * ((1.0d0 + z) / (z * t))) + (x / y)) + (-2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((2.0 * ((1.0 + z) / (z * t))) + (x / y)) + -2.0;
}
def code(x, y, z, t): return ((2.0 * ((1.0 + z) / (z * t))) + (x / y)) + -2.0
function code(x, y, z, t) return Float64(Float64(Float64(2.0 * Float64(Float64(1.0 + z) / Float64(z * t))) + Float64(x / y)) + -2.0) end
function tmp = code(x, y, z, t) tmp = ((2.0 * ((1.0 + z) / (z * t))) + (x / y)) + -2.0; end
code[x_, y_, z_, t_] := N[(N[(N[(2.0 * N[(N[(1.0 + z), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]
\begin{array}{l}
\\
\left(2 \cdot \frac{1 + z}{z \cdot t} + \frac{x}{y}\right) + -2
\end{array}
Initial program 82.3%
+-commutative82.3%
remove-double-neg82.3%
distribute-frac-neg82.3%
unsub-neg82.3%
*-commutative82.3%
associate-*r*82.3%
distribute-rgt1-in82.3%
associate-*r/82.3%
/-rgt-identity82.3%
fma-neg82.3%
/-rgt-identity82.3%
*-commutative82.3%
fma-def82.3%
*-commutative82.3%
distribute-frac-neg82.3%
remove-double-neg82.3%
Simplified82.3%
Taylor expanded in t around 0 98.7%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ x y) -2.0)))
(if (<= z -4e+246)
t_1
(if (<= z -5.5e+104)
(+ (/ 2.0 t) -2.0)
(if (or (<= z -5.5e-48) (not (<= z 3.8e-13)))
t_1
(+ (/ 2.0 (* z t)) -2.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + -2.0;
double tmp;
if (z <= -4e+246) {
tmp = t_1;
} else if (z <= -5.5e+104) {
tmp = (2.0 / t) + -2.0;
} else if ((z <= -5.5e-48) || !(z <= 3.8e-13)) {
tmp = t_1;
} else {
tmp = (2.0 / (z * t)) + -2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x / y) + (-2.0d0)
if (z <= (-4d+246)) then
tmp = t_1
else if (z <= (-5.5d+104)) then
tmp = (2.0d0 / t) + (-2.0d0)
else if ((z <= (-5.5d-48)) .or. (.not. (z <= 3.8d-13))) then
tmp = t_1
else
tmp = (2.0d0 / (z * t)) + (-2.0d0)
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 <= -4e+246) {
tmp = t_1;
} else if (z <= -5.5e+104) {
tmp = (2.0 / t) + -2.0;
} else if ((z <= -5.5e-48) || !(z <= 3.8e-13)) {
tmp = t_1;
} else {
tmp = (2.0 / (z * t)) + -2.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + -2.0 tmp = 0 if z <= -4e+246: tmp = t_1 elif z <= -5.5e+104: tmp = (2.0 / t) + -2.0 elif (z <= -5.5e-48) or not (z <= 3.8e-13): tmp = t_1 else: tmp = (2.0 / (z * t)) + -2.0 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + -2.0) tmp = 0.0 if (z <= -4e+246) tmp = t_1; elseif (z <= -5.5e+104) tmp = Float64(Float64(2.0 / t) + -2.0); elseif ((z <= -5.5e-48) || !(z <= 3.8e-13)) tmp = t_1; else tmp = Float64(Float64(2.0 / Float64(z * t)) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + -2.0; tmp = 0.0; if (z <= -4e+246) tmp = t_1; elseif (z <= -5.5e+104) tmp = (2.0 / t) + -2.0; elseif ((z <= -5.5e-48) || ~((z <= 3.8e-13))) tmp = t_1; else tmp = (2.0 / (z * t)) + -2.0; 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, -4e+246], t$95$1, If[LessEqual[z, -5.5e+104], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[Or[LessEqual[z, -5.5e-48], N[Not[LessEqual[z, 3.8e-13]], $MachinePrecision]], t$95$1, N[(N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + -2\\
\mathbf{if}\;z \leq -4 \cdot 10^{+246}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{+104}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-48} \lor \neg \left(z \leq 3.8 \cdot 10^{-13}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z \cdot t} + -2\\
\end{array}
\end{array}
if z < -4.00000000000000027e246 or -5.50000000000000017e104 < z < -5.50000000000000047e-48 or 3.8e-13 < z Initial program 68.1%
Taylor expanded in t around inf 81.8%
if -4.00000000000000027e246 < z < -5.50000000000000017e104Initial program 71.3%
+-commutative71.3%
remove-double-neg71.3%
distribute-frac-neg71.3%
unsub-neg71.3%
*-commutative71.3%
associate-*r*71.3%
distribute-rgt1-in71.3%
associate-*r/71.3%
/-rgt-identity71.3%
fma-neg71.3%
/-rgt-identity71.3%
*-commutative71.3%
fma-def71.3%
*-commutative71.3%
distribute-frac-neg71.3%
remove-double-neg71.3%
Simplified71.3%
Taylor expanded in t around 0 99.8%
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 84.6%
if -5.50000000000000047e-48 < z < 3.8e-13Initial program 98.2%
+-commutative98.2%
remove-double-neg98.2%
distribute-frac-neg98.2%
unsub-neg98.2%
*-commutative98.2%
associate-*r*98.2%
distribute-rgt1-in98.2%
associate-*r/98.2%
/-rgt-identity98.2%
fma-neg98.2%
/-rgt-identity98.2%
*-commutative98.2%
fma-def98.2%
*-commutative98.2%
distribute-frac-neg98.2%
remove-double-neg98.2%
Simplified98.2%
Taylor expanded in t around 0 98.2%
Taylor expanded in z around 0 79.7%
Final simplification81.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ x y) -2.0)))
(if (<= z -1.15e+246)
t_1
(if (<= z -2.1e+105)
(+ (/ 2.0 t) -2.0)
(if (or (<= z -1.5e-92) (not (<= z 6.4e-21))) t_1 (/ 2.0 (* z t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + -2.0;
double tmp;
if (z <= -1.15e+246) {
tmp = t_1;
} else if (z <= -2.1e+105) {
tmp = (2.0 / t) + -2.0;
} else if ((z <= -1.5e-92) || !(z <= 6.4e-21)) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = (x / y) + (-2.0d0)
if (z <= (-1.15d+246)) then
tmp = t_1
else if (z <= (-2.1d+105)) then
tmp = (2.0d0 / t) + (-2.0d0)
else if ((z <= (-1.5d-92)) .or. (.not. (z <= 6.4d-21))) then
tmp = t_1
else
tmp = 2.0d0 / (z * 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 <= -1.15e+246) {
tmp = t_1;
} else if (z <= -2.1e+105) {
tmp = (2.0 / t) + -2.0;
} else if ((z <= -1.5e-92) || !(z <= 6.4e-21)) {
tmp = t_1;
} else {
tmp = 2.0 / (z * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + -2.0 tmp = 0 if z <= -1.15e+246: tmp = t_1 elif z <= -2.1e+105: tmp = (2.0 / t) + -2.0 elif (z <= -1.5e-92) or not (z <= 6.4e-21): tmp = t_1 else: tmp = 2.0 / (z * t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + -2.0) tmp = 0.0 if (z <= -1.15e+246) tmp = t_1; elseif (z <= -2.1e+105) tmp = Float64(Float64(2.0 / t) + -2.0); elseif ((z <= -1.5e-92) || !(z <= 6.4e-21)) tmp = t_1; else tmp = Float64(2.0 / Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + -2.0; tmp = 0.0; if (z <= -1.15e+246) tmp = t_1; elseif (z <= -2.1e+105) tmp = (2.0 / t) + -2.0; elseif ((z <= -1.5e-92) || ~((z <= 6.4e-21))) tmp = t_1; else tmp = 2.0 / (z * 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, -1.15e+246], t$95$1, If[LessEqual[z, -2.1e+105], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[Or[LessEqual[z, -1.5e-92], N[Not[LessEqual[z, 6.4e-21]], $MachinePrecision]], t$95$1, N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + -2\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+246}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{+105}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-92} \lor \neg \left(z \leq 6.4 \cdot 10^{-21}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -1.15000000000000007e246 or -2.1000000000000001e105 < z < -1.50000000000000007e-92 or 6.4000000000000003e-21 < z Initial program 71.2%
Taylor expanded in t around inf 80.5%
if -1.15000000000000007e246 < z < -2.1000000000000001e105Initial program 71.3%
+-commutative71.3%
remove-double-neg71.3%
distribute-frac-neg71.3%
unsub-neg71.3%
*-commutative71.3%
associate-*r*71.3%
distribute-rgt1-in71.3%
associate-*r/71.3%
/-rgt-identity71.3%
fma-neg71.3%
/-rgt-identity71.3%
*-commutative71.3%
fma-def71.3%
*-commutative71.3%
distribute-frac-neg71.3%
remove-double-neg71.3%
Simplified71.3%
Taylor expanded in t around 0 99.8%
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 84.6%
if -1.50000000000000007e-92 < z < 6.4000000000000003e-21Initial program 98.0%
Taylor expanded in z around 0 88.7%
associate-/r*88.6%
Simplified88.6%
clear-num88.5%
frac-add70.9%
*-un-lft-identity70.9%
Applied egg-rr70.9%
Taylor expanded in z around 0 70.6%
Final simplification76.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ 2.0 (* z t))))
(if (or (<= (/ x y) -2.0) (not (<= (/ x y) 0.00012)))
(+ (/ x y) t_1)
(+ t_1 -2.0))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 / (z * t);
double tmp;
if (((x / y) <= -2.0) || !((x / y) <= 0.00012)) {
tmp = (x / y) + t_1;
} else {
tmp = t_1 + -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) :: t_1
real(8) :: tmp
t_1 = 2.0d0 / (z * t)
if (((x / y) <= (-2.0d0)) .or. (.not. ((x / y) <= 0.00012d0))) then
tmp = (x / y) + t_1
else
tmp = t_1 + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 / (z * t);
double tmp;
if (((x / y) <= -2.0) || !((x / y) <= 0.00012)) {
tmp = (x / y) + t_1;
} else {
tmp = t_1 + -2.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 / (z * t) tmp = 0 if ((x / y) <= -2.0) or not ((x / y) <= 0.00012): tmp = (x / y) + t_1 else: tmp = t_1 + -2.0 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 / Float64(z * t)) tmp = 0.0 if ((Float64(x / y) <= -2.0) || !(Float64(x / y) <= 0.00012)) tmp = Float64(Float64(x / y) + t_1); else tmp = Float64(t_1 + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 / (z * t); tmp = 0.0; if (((x / y) <= -2.0) || ~(((x / y) <= 0.00012))) tmp = (x / y) + t_1; else tmp = t_1 + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(x / y), $MachinePrecision], -2.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.00012]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$1 + -2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2}{z \cdot t}\\
\mathbf{if}\;\frac{x}{y} \leq -2 \lor \neg \left(\frac{x}{y} \leq 0.00012\right):\\
\;\;\;\;\frac{x}{y} + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -2 or 1.20000000000000003e-4 < (/.f64 x y) Initial program 83.2%
Taylor expanded in z around 0 85.8%
if -2 < (/.f64 x y) < 1.20000000000000003e-4Initial program 81.5%
+-commutative81.5%
remove-double-neg81.5%
distribute-frac-neg81.5%
unsub-neg81.5%
*-commutative81.5%
associate-*r*81.5%
distribute-rgt1-in81.5%
associate-*r/81.4%
/-rgt-identity81.4%
fma-neg81.4%
/-rgt-identity81.4%
*-commutative81.4%
fma-def81.4%
*-commutative81.4%
distribute-frac-neg81.4%
remove-double-neg81.4%
Simplified81.4%
Taylor expanded in t around 0 99.9%
Taylor expanded in z around 0 83.5%
Final simplification84.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1.22e+35) (not (<= (/ x y) 215000.0))) (/ x y) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1.22e+35) || !((x / y) <= 215000.0)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-1.22d+35)) .or. (.not. ((x / y) <= 215000.0d0))) then
tmp = x / y
else
tmp = (2.0d0 / t) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1.22e+35) || !((x / y) <= 215000.0)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1.22e+35) or not ((x / y) <= 215000.0): tmp = x / y else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1.22e+35) || !(Float64(x / y) <= 215000.0)) tmp = Float64(x / y); else tmp = Float64(Float64(2.0 / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1.22e+35) || ~(((x / y) <= 215000.0))) tmp = x / y; else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1.22e+35], N[Not[LessEqual[N[(x / y), $MachinePrecision], 215000.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.22 \cdot 10^{+35} \lor \neg \left(\frac{x}{y} \leq 215000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -1.21999999999999999e35 or 215000 < (/.f64 x y) Initial program 83.7%
Taylor expanded in x around inf 69.0%
if -1.21999999999999999e35 < (/.f64 x y) < 215000Initial program 81.1%
+-commutative81.1%
remove-double-neg81.1%
distribute-frac-neg81.1%
unsub-neg81.1%
*-commutative81.1%
associate-*r*81.1%
distribute-rgt1-in81.1%
associate-*r/81.1%
/-rgt-identity81.1%
fma-neg81.1%
/-rgt-identity81.1%
*-commutative81.1%
fma-def81.1%
*-commutative81.1%
distribute-frac-neg81.1%
remove-double-neg81.1%
Simplified81.1%
Taylor expanded in t around 0 99.9%
Taylor expanded in z around inf 62.9%
associate-*r/62.9%
metadata-eval62.9%
+-commutative62.9%
Simplified62.9%
Taylor expanded in x around 0 59.8%
Final simplification64.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -4.2e-14) (not (<= (/ x y) 3.7e-17))) (+ (/ x y) -2.0) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4.2e-14) || !((x / y) <= 3.7e-17)) {
tmp = (x / y) + -2.0;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-4.2d-14)) .or. (.not. ((x / y) <= 3.7d-17))) then
tmp = (x / y) + (-2.0d0)
else
tmp = (2.0d0 / t) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4.2e-14) || !((x / y) <= 3.7e-17)) {
tmp = (x / y) + -2.0;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -4.2e-14) or not ((x / y) <= 3.7e-17): tmp = (x / y) + -2.0 else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -4.2e-14) || !(Float64(x / y) <= 3.7e-17)) tmp = Float64(Float64(x / y) + -2.0); else tmp = Float64(Float64(2.0 / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -4.2e-14) || ~(((x / y) <= 3.7e-17))) tmp = (x / y) + -2.0; else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -4.2e-14], N[Not[LessEqual[N[(x / y), $MachinePrecision], 3.7e-17]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4.2 \cdot 10^{-14} \lor \neg \left(\frac{x}{y} \leq 3.7 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{x}{y} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -4.1999999999999998e-14 or 3.6999999999999997e-17 < (/.f64 x y) Initial program 82.5%
Taylor expanded in t around inf 66.9%
if -4.1999999999999998e-14 < (/.f64 x y) < 3.6999999999999997e-17Initial program 82.1%
+-commutative82.1%
remove-double-neg82.1%
distribute-frac-neg82.1%
unsub-neg82.1%
*-commutative82.1%
associate-*r*82.1%
distribute-rgt1-in82.1%
associate-*r/82.0%
/-rgt-identity82.0%
fma-neg82.0%
/-rgt-identity82.0%
*-commutative82.0%
fma-def82.0%
*-commutative82.0%
distribute-frac-neg82.0%
remove-double-neg82.0%
Simplified82.0%
Taylor expanded in t around 0 99.8%
Taylor expanded in z around inf 63.1%
associate-*r/63.1%
metadata-eval63.1%
+-commutative63.1%
Simplified63.1%
Taylor expanded in x around 0 63.1%
Final simplification65.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e-55) (not (<= z 9.5e-21))) (+ (+ (/ x y) (/ 2.0 t)) -2.0) (+ (/ x y) (/ 2.0 (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-55) || !(z <= 9.5e-21)) {
tmp = ((x / y) + (2.0 / t)) + -2.0;
} else {
tmp = (x / y) + (2.0 / (z * t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5d-55)) .or. (.not. (z <= 9.5d-21))) then
tmp = ((x / y) + (2.0d0 / t)) + (-2.0d0)
else
tmp = (x / y) + (2.0d0 / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-55) || !(z <= 9.5e-21)) {
tmp = ((x / y) + (2.0 / t)) + -2.0;
} else {
tmp = (x / y) + (2.0 / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5e-55) or not (z <= 9.5e-21): tmp = ((x / y) + (2.0 / t)) + -2.0 else: tmp = (x / y) + (2.0 / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5e-55) || !(z <= 9.5e-21)) tmp = Float64(Float64(Float64(x / y) + Float64(2.0 / t)) + -2.0); 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 ((z <= -5e-55) || ~((z <= 9.5e-21))) tmp = ((x / y) + (2.0 / t)) + -2.0; else tmp = (x / y) + (2.0 / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5e-55], N[Not[LessEqual[z, 9.5e-21]], $MachinePrecision]], N[(N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-55} \lor \neg \left(z \leq 9.5 \cdot 10^{-21}\right):\\
\;\;\;\;\left(\frac{x}{y} + \frac{2}{t}\right) + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -5.0000000000000002e-55 or 9.4999999999999994e-21 < z Initial program 70.0%
+-commutative70.0%
remove-double-neg70.0%
distribute-frac-neg70.0%
unsub-neg70.0%
*-commutative70.0%
associate-*r*70.0%
distribute-rgt1-in70.0%
associate-*r/69.9%
/-rgt-identity69.9%
fma-neg69.9%
/-rgt-identity69.9%
*-commutative69.9%
fma-def69.9%
*-commutative69.9%
distribute-frac-neg69.9%
remove-double-neg69.9%
Simplified69.9%
Taylor expanded in t around 0 99.2%
Taylor expanded in z around inf 98.3%
associate-*r/98.3%
metadata-eval98.3%
+-commutative98.3%
Simplified98.3%
if -5.0000000000000002e-55 < z < 9.4999999999999994e-21Initial program 98.1%
Taylor expanded in z around 0 88.4%
Final simplification94.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2.0) (not (<= (/ x y) 0.00012))) (/ x y) -2.0))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2.0) || !((x / y) <= 0.00012)) {
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) <= 0.00012d0))) 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) <= 0.00012)) {
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) <= 0.00012): 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) <= 0.00012)) 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) <= 0.00012))) 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], 0.00012]], $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 0.00012\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if (/.f64 x y) < -2 or 1.20000000000000003e-4 < (/.f64 x y) Initial program 83.2%
Taylor expanded in x around inf 65.7%
if -2 < (/.f64 x y) < 1.20000000000000003e-4Initial program 81.5%
+-commutative81.5%
remove-double-neg81.5%
distribute-frac-neg81.5%
unsub-neg81.5%
*-commutative81.5%
associate-*r*81.5%
distribute-rgt1-in81.5%
associate-*r/81.4%
/-rgt-identity81.4%
fma-neg81.4%
/-rgt-identity81.4%
*-commutative81.4%
fma-def81.4%
*-commutative81.4%
distribute-frac-neg81.4%
remove-double-neg81.4%
Simplified81.4%
Taylor expanded in x around 0 80.4%
Taylor expanded in t around inf 46.8%
Final simplification56.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.6e-97) (not (<= t 4.4))) (+ (/ x y) -2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.6e-97) || !(t <= 4.4)) {
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 <= (-6.6d-97)) .or. (.not. (t <= 4.4d0))) 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 <= -6.6e-97) || !(t <= 4.4)) {
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 <= -6.6e-97) or not (t <= 4.4): 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 <= -6.6e-97) || !(t <= 4.4)) 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 <= -6.6e-97) || ~((t <= 4.4))) 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, -6.6e-97], N[Not[LessEqual[t, 4.4]], $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 -6.6 \cdot 10^{-97} \lor \neg \left(t \leq 4.4\right):\\
\;\;\;\;\frac{x}{y} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -6.6000000000000002e-97 or 4.4000000000000004 < t Initial program 72.0%
Taylor expanded in t around inf 84.5%
if -6.6000000000000002e-97 < t < 4.4000000000000004Initial program 97.0%
Taylor expanded in t around 0 83.9%
associate-*r/83.9%
metadata-eval83.9%
Simplified83.9%
Final simplification84.3%
(FPCore (x y z t) :precision binary64 (if (<= t -1.4e-62) -2.0 (if (<= t 88000.0) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.4e-62) {
tmp = -2.0;
} else if (t <= 88000.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.4d-62)) then
tmp = -2.0d0
else if (t <= 88000.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.4e-62) {
tmp = -2.0;
} else if (t <= 88000.0) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.4e-62: tmp = -2.0 elif t <= 88000.0: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.4e-62) tmp = -2.0; elseif (t <= 88000.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.4e-62) tmp = -2.0; elseif (t <= 88000.0) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.4e-62], -2.0, If[LessEqual[t, 88000.0], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-62}:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 88000:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1.40000000000000001e-62 or 88000 < t Initial program 70.4%
+-commutative70.4%
remove-double-neg70.4%
distribute-frac-neg70.4%
unsub-neg70.4%
*-commutative70.4%
associate-*r*70.4%
distribute-rgt1-in70.4%
associate-*r/70.3%
/-rgt-identity70.3%
fma-neg70.3%
/-rgt-identity70.3%
*-commutative70.3%
fma-def70.3%
*-commutative70.3%
distribute-frac-neg70.3%
remove-double-neg70.3%
Simplified70.3%
Taylor expanded in x around 0 42.2%
Taylor expanded in t around inf 43.5%
if -1.40000000000000001e-62 < t < 88000Initial program 97.2%
Taylor expanded in t around 0 79.2%
associate-*r/79.2%
metadata-eval79.2%
Simplified79.2%
Taylor expanded in z around inf 29.9%
Final simplification37.4%
(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 82.3%
+-commutative82.3%
remove-double-neg82.3%
distribute-frac-neg82.3%
unsub-neg82.3%
*-commutative82.3%
associate-*r*82.3%
distribute-rgt1-in82.3%
associate-*r/82.3%
/-rgt-identity82.3%
fma-neg82.3%
/-rgt-identity82.3%
*-commutative82.3%
fma-def82.3%
*-commutative82.3%
distribute-frac-neg82.3%
remove-double-neg82.3%
Simplified82.3%
Taylor expanded in x around 0 58.9%
Taylor expanded in t around inf 25.1%
Final simplification25.1%
(FPCore (x y z t) :precision binary64 (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y))))
double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((2.0d0 / z) + 2.0d0) / t) - (2.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
def code(x, y, z, t): return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(2.0 / z) + 2.0) / t) - Float64(2.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = (((2.0 / z) + 2.0) / t) - (2.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(2.0 / z), $MachinePrecision] + 2.0), $MachinePrecision] / t), $MachinePrecision] - N[(2.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{z} + 2}{t} - \left(2 - \frac{x}{y}\right)
\end{array}
herbie shell --seed 2024036
(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))))