
(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 (fma x (/ 1.0 y) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
return fma(x, (1.0 / y), (-2.0 + ((2.0 + (2.0 / z)) / t)));
}
function code(x, y, z, t) return fma(x, Float64(1.0 / y), Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t))) end
code[x_, y_, z_, t_] := N[(x * N[(1.0 / y), $MachinePrecision] + N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \frac{1}{y}, -2 + \frac{2 + \frac{2}{z}}{t}\right)
\end{array}
Initial program 88.1%
sub-neg88.1%
distribute-rgt-in88.1%
*-lft-identity88.1%
associate-+r+88.1%
cancel-sign-sub-inv88.1%
div-sub79.1%
associate-*r*79.1%
associate-*l/79.1%
*-inverses99.1%
metadata-eval99.1%
sub-neg99.1%
metadata-eval99.1%
metadata-eval99.1%
+-commutative99.1%
metadata-eval99.1%
associate-/l/99.1%
Simplified99.1%
div-inv99.0%
fma-def99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2.0)
(/ x y)
(if (<= (/ x y) -4.2e-177)
-2.0
(if (<= (/ x y) 3.6e-289)
(/ 2.0 t)
(if (<= (/ x y) 2.5e-170)
-2.0
(if (<= (/ x y) 6.5e-94)
(/ 2.0 t)
(if (<= (/ x y) 2.1e-26)
-2.0
(if (<= (/ x y) 4.5e+36) (/ 2.0 t) (/ x y)))))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2.0) {
tmp = x / y;
} else if ((x / y) <= -4.2e-177) {
tmp = -2.0;
} else if ((x / y) <= 3.6e-289) {
tmp = 2.0 / t;
} else if ((x / y) <= 2.5e-170) {
tmp = -2.0;
} else if ((x / y) <= 6.5e-94) {
tmp = 2.0 / t;
} else if ((x / y) <= 2.1e-26) {
tmp = -2.0;
} else if ((x / y) <= 4.5e+36) {
tmp = 2.0 / t;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= (-2.0d0)) then
tmp = x / y
else if ((x / y) <= (-4.2d-177)) then
tmp = -2.0d0
else if ((x / y) <= 3.6d-289) then
tmp = 2.0d0 / t
else if ((x / y) <= 2.5d-170) then
tmp = -2.0d0
else if ((x / y) <= 6.5d-94) then
tmp = 2.0d0 / t
else if ((x / y) <= 2.1d-26) then
tmp = -2.0d0
else if ((x / y) <= 4.5d+36) then
tmp = 2.0d0 / t
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2.0) {
tmp = x / y;
} else if ((x / y) <= -4.2e-177) {
tmp = -2.0;
} else if ((x / y) <= 3.6e-289) {
tmp = 2.0 / t;
} else if ((x / y) <= 2.5e-170) {
tmp = -2.0;
} else if ((x / y) <= 6.5e-94) {
tmp = 2.0 / t;
} else if ((x / y) <= 2.1e-26) {
tmp = -2.0;
} else if ((x / y) <= 4.5e+36) {
tmp = 2.0 / t;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2.0: tmp = x / y elif (x / y) <= -4.2e-177: tmp = -2.0 elif (x / y) <= 3.6e-289: tmp = 2.0 / t elif (x / y) <= 2.5e-170: tmp = -2.0 elif (x / y) <= 6.5e-94: tmp = 2.0 / t elif (x / y) <= 2.1e-26: tmp = -2.0 elif (x / y) <= 4.5e+36: tmp = 2.0 / t else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2.0) tmp = Float64(x / y); elseif (Float64(x / y) <= -4.2e-177) tmp = -2.0; elseif (Float64(x / y) <= 3.6e-289) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= 2.5e-170) tmp = -2.0; elseif (Float64(x / y) <= 6.5e-94) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= 2.1e-26) tmp = -2.0; elseif (Float64(x / y) <= 4.5e+36) tmp = Float64(2.0 / t); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2.0) tmp = x / y; elseif ((x / y) <= -4.2e-177) tmp = -2.0; elseif ((x / y) <= 3.6e-289) tmp = 2.0 / t; elseif ((x / y) <= 2.5e-170) tmp = -2.0; elseif ((x / y) <= 6.5e-94) tmp = 2.0 / t; elseif ((x / y) <= 2.1e-26) tmp = -2.0; elseif ((x / y) <= 4.5e+36) tmp = 2.0 / t; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -4.2e-177], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 3.6e-289], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.5e-170], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 6.5e-94], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.1e-26], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 4.5e+36], N[(2.0 / t), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -4.2 \cdot 10^{-177}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 3.6 \cdot 10^{-289}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 2.5 \cdot 10^{-170}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 6.5 \cdot 10^{-94}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 2.1 \cdot 10^{-26}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 4.5 \cdot 10^{+36}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2 or 4.49999999999999997e36 < (/.f64 x y) Initial program 88.0%
sub-neg88.0%
distribute-rgt-in88.0%
*-lft-identity88.0%
associate-+r+88.0%
cancel-sign-sub-inv88.0%
div-sub77.8%
associate-*r*77.8%
associate-*l/77.8%
*-inverses98.2%
metadata-eval98.2%
sub-neg98.2%
metadata-eval98.2%
metadata-eval98.2%
+-commutative98.2%
metadata-eval98.2%
associate-/l/98.2%
Simplified98.2%
Taylor expanded in x around inf 69.6%
if -2 < (/.f64 x y) < -4.20000000000000002e-177 or 3.6e-289 < (/.f64 x y) < 2.50000000000000005e-170 or 6.4999999999999996e-94 < (/.f64 x y) < 2.10000000000000008e-26Initial program 82.6%
clear-num82.6%
frac-add58.5%
*-un-lft-identity58.5%
*-commutative58.5%
+-commutative58.5%
associate-*l*58.5%
fma-def58.5%
*-commutative58.5%
Applied egg-rr58.5%
Taylor expanded in y around inf 67.5%
*-commutative67.5%
associate-/l*65.4%
fma-def65.4%
associate-/l*64.1%
associate-*r/64.1%
metadata-eval64.1%
Simplified64.1%
Taylor expanded in t around inf 52.7%
if -4.20000000000000002e-177 < (/.f64 x y) < 3.6e-289 or 2.50000000000000005e-170 < (/.f64 x y) < 6.4999999999999996e-94 or 2.10000000000000008e-26 < (/.f64 x y) < 4.49999999999999997e36Initial program 92.3%
sub-neg92.3%
distribute-rgt-in92.3%
*-lft-identity92.3%
associate-+r+92.3%
cancel-sign-sub-inv92.3%
div-sub82.3%
associate-*r*82.3%
associate-*l/82.3%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/99.8%
Simplified99.8%
Taylor expanded in t around 0 81.3%
associate-*r/81.3%
metadata-eval81.3%
Simplified81.3%
Taylor expanded in z around inf 42.7%
Final simplification57.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ 2.0 (* z t))) (t_2 (- (/ x y) 2.0)))
(if (<= (/ x y) -3.3e-9)
t_2
(if (<= (/ x y) 6.2e-234)
(+ -2.0 t_1)
(if (<= (/ x y) 0.0155)
(* 2.0 (/ (- 1.0 t) t))
(if (<= (/ x y) 2.4e+66) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 / (z * t);
double t_2 = (x / y) - 2.0;
double tmp;
if ((x / y) <= -3.3e-9) {
tmp = t_2;
} else if ((x / y) <= 6.2e-234) {
tmp = -2.0 + t_1;
} else if ((x / y) <= 0.0155) {
tmp = 2.0 * ((1.0 - t) / t);
} else if ((x / y) <= 2.4e+66) {
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 / (z * t)
t_2 = (x / y) - 2.0d0
if ((x / y) <= (-3.3d-9)) then
tmp = t_2
else if ((x / y) <= 6.2d-234) then
tmp = (-2.0d0) + t_1
else if ((x / y) <= 0.0155d0) then
tmp = 2.0d0 * ((1.0d0 - t) / t)
else if ((x / y) <= 2.4d+66) 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 / (z * t);
double t_2 = (x / y) - 2.0;
double tmp;
if ((x / y) <= -3.3e-9) {
tmp = t_2;
} else if ((x / y) <= 6.2e-234) {
tmp = -2.0 + t_1;
} else if ((x / y) <= 0.0155) {
tmp = 2.0 * ((1.0 - t) / t);
} else if ((x / y) <= 2.4e+66) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 / (z * t) t_2 = (x / y) - 2.0 tmp = 0 if (x / y) <= -3.3e-9: tmp = t_2 elif (x / y) <= 6.2e-234: tmp = -2.0 + t_1 elif (x / y) <= 0.0155: tmp = 2.0 * ((1.0 - t) / t) elif (x / y) <= 2.4e+66: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 / Float64(z * t)) t_2 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (Float64(x / y) <= -3.3e-9) tmp = t_2; elseif (Float64(x / y) <= 6.2e-234) tmp = Float64(-2.0 + t_1); elseif (Float64(x / y) <= 0.0155) tmp = Float64(2.0 * Float64(Float64(1.0 - t) / t)); elseif (Float64(x / y) <= 2.4e+66) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 / (z * t); t_2 = (x / y) - 2.0; tmp = 0.0; if ((x / y) <= -3.3e-9) tmp = t_2; elseif ((x / y) <= 6.2e-234) tmp = -2.0 + t_1; elseif ((x / y) <= 0.0155) tmp = 2.0 * ((1.0 - t) / t); elseif ((x / y) <= 2.4e+66) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -3.3e-9], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 6.2e-234], N[(-2.0 + t$95$1), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 0.0155], N[(2.0 * N[(N[(1.0 - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.4e+66], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2}{z \cdot t}\\
t_2 := \frac{x}{y} - 2\\
\mathbf{if}\;\frac{x}{y} \leq -3.3 \cdot 10^{-9}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{x}{y} \leq 6.2 \cdot 10^{-234}:\\
\;\;\;\;-2 + t_1\\
\mathbf{elif}\;\frac{x}{y} \leq 0.0155:\\
\;\;\;\;2 \cdot \frac{1 - t}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 2.4 \cdot 10^{+66}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 x y) < -3.30000000000000018e-9 or 2.4000000000000002e66 < (/.f64 x y) Initial program 87.3%
sub-neg87.3%
distribute-rgt-in87.3%
*-lft-identity87.3%
associate-+r+87.3%
cancel-sign-sub-inv87.3%
div-sub78.3%
associate-*r*78.3%
associate-*l/78.3%
*-inverses98.1%
metadata-eval98.1%
sub-neg98.1%
metadata-eval98.1%
metadata-eval98.1%
+-commutative98.1%
metadata-eval98.1%
associate-/l/98.1%
Simplified98.1%
Taylor expanded in t around inf 72.7%
if -3.30000000000000018e-9 < (/.f64 x y) < 6.2000000000000003e-234Initial program 88.7%
sub-neg88.7%
distribute-rgt-in88.7%
*-lft-identity88.7%
associate-+r+88.7%
cancel-sign-sub-inv88.7%
div-sub76.5%
associate-*r*76.5%
associate-*l/76.5%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in z around 0 72.0%
Taylor expanded in x around 0 72.0%
sub-neg72.0%
associate-*r/72.0%
metadata-eval72.0%
metadata-eval72.0%
Simplified72.0%
if 6.2000000000000003e-234 < (/.f64 x y) < 0.0155Initial program 84.0%
clear-num84.0%
frac-add53.0%
*-un-lft-identity53.0%
*-commutative53.0%
+-commutative53.0%
associate-*l*53.0%
fma-def53.0%
*-commutative53.0%
Applied egg-rr53.0%
Taylor expanded in y around inf 61.2%
*-commutative61.2%
associate-/l*58.3%
fma-def58.3%
associate-/l*58.1%
associate-*r/58.1%
metadata-eval58.1%
Simplified58.1%
Taylor expanded in z around inf 86.1%
if 0.0155 < (/.f64 x y) < 2.4000000000000002e66Initial program 99.8%
sub-neg99.8%
distribute-rgt-in99.8%
*-lft-identity99.8%
associate-+r+99.8%
cancel-sign-sub-inv99.8%
div-sub88.1%
associate-*r*88.1%
associate-*l/88.1%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/99.6%
Simplified99.6%
Taylor expanded in z around 0 60.3%
Final simplification73.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= z -2.5e+60)
t_1
(if (<= z -1.6e+43)
(/ 2.0 t)
(if (<= z -5.2e-104)
t_1
(if (<= z 2.9e-96)
(/ 2.0 (* z t))
(if (or (<= z 4.1e+15) (not (<= z 1.4e+57))) t_1 (/ 2.0 t))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -2.5e+60) {
tmp = t_1;
} else if (z <= -1.6e+43) {
tmp = 2.0 / t;
} else if (z <= -5.2e-104) {
tmp = t_1;
} else if (z <= 2.9e-96) {
tmp = 2.0 / (z * t);
} else if ((z <= 4.1e+15) || !(z <= 1.4e+57)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x / y) - 2.0d0
if (z <= (-2.5d+60)) then
tmp = t_1
else if (z <= (-1.6d+43)) then
tmp = 2.0d0 / t
else if (z <= (-5.2d-104)) then
tmp = t_1
else if (z <= 2.9d-96) then
tmp = 2.0d0 / (z * t)
else if ((z <= 4.1d+15) .or. (.not. (z <= 1.4d+57))) then
tmp = t_1
else
tmp = 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 <= -2.5e+60) {
tmp = t_1;
} else if (z <= -1.6e+43) {
tmp = 2.0 / t;
} else if (z <= -5.2e-104) {
tmp = t_1;
} else if (z <= 2.9e-96) {
tmp = 2.0 / (z * t);
} else if ((z <= 4.1e+15) || !(z <= 1.4e+57)) {
tmp = t_1;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if z <= -2.5e+60: tmp = t_1 elif z <= -1.6e+43: tmp = 2.0 / t elif z <= -5.2e-104: tmp = t_1 elif z <= 2.9e-96: tmp = 2.0 / (z * t) elif (z <= 4.1e+15) or not (z <= 1.4e+57): tmp = t_1 else: tmp = 2.0 / t return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (z <= -2.5e+60) tmp = t_1; elseif (z <= -1.6e+43) tmp = Float64(2.0 / t); elseif (z <= -5.2e-104) tmp = t_1; elseif (z <= 2.9e-96) tmp = Float64(2.0 / Float64(z * t)); elseif ((z <= 4.1e+15) || !(z <= 1.4e+57)) tmp = t_1; else tmp = 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 <= -2.5e+60) tmp = t_1; elseif (z <= -1.6e+43) tmp = 2.0 / t; elseif (z <= -5.2e-104) tmp = t_1; elseif (z <= 2.9e-96) tmp = 2.0 / (z * t); elseif ((z <= 4.1e+15) || ~((z <= 1.4e+57))) tmp = t_1; else tmp = 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, -2.5e+60], t$95$1, If[LessEqual[z, -1.6e+43], N[(2.0 / t), $MachinePrecision], If[LessEqual[z, -5.2e-104], t$95$1, If[LessEqual[z, 2.9e-96], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.1e+15], N[Not[LessEqual[z, 1.4e+57]], $MachinePrecision]], t$95$1, N[(2.0 / t), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+60}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+43}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-104}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-96}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+15} \lor \neg \left(z \leq 1.4 \cdot 10^{+57}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if z < -2.49999999999999987e60 or -1.60000000000000007e43 < z < -5.20000000000000005e-104 or 2.89999999999999994e-96 < z < 4.1e15 or 1.4e57 < z Initial program 81.6%
sub-neg81.6%
distribute-rgt-in81.6%
*-lft-identity81.6%
associate-+r+81.6%
cancel-sign-sub-inv81.6%
div-sub80.9%
associate-*r*80.9%
associate-*l/80.9%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in t around inf 65.3%
if -2.49999999999999987e60 < z < -1.60000000000000007e43 or 4.1e15 < z < 1.4e57Initial program 99.5%
sub-neg99.5%
distribute-rgt-in99.5%
*-lft-identity99.5%
associate-+r+99.5%
cancel-sign-sub-inv99.5%
div-sub99.5%
associate-*r*99.5%
associate-*l/99.5%
*-inverses99.5%
metadata-eval99.5%
sub-neg99.5%
metadata-eval99.5%
metadata-eval99.5%
+-commutative99.5%
metadata-eval99.5%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in t around 0 94.9%
associate-*r/94.9%
metadata-eval94.9%
Simplified94.9%
Taylor expanded in z around inf 94.8%
if -5.20000000000000005e-104 < z < 2.89999999999999994e-96Initial program 97.5%
sub-neg97.5%
distribute-rgt-in97.5%
*-lft-identity97.5%
associate-+r+97.5%
cancel-sign-sub-inv97.5%
div-sub71.3%
associate-*r*71.3%
associate-*l/71.3%
*-inverses97.5%
metadata-eval97.5%
sub-neg97.5%
metadata-eval97.5%
metadata-eval97.5%
+-commutative97.5%
metadata-eval97.5%
associate-/l/97.5%
Simplified97.5%
Taylor expanded in z around 0 69.1%
Final simplification68.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= (/ x y) -0.21)
t_1
(if (<= (/ x y) 7e-6)
(* 2.0 (/ (- 1.0 t) t))
(if (<= (/ x y) 7.2e+67) (/ 2.0 (* z 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) <= -0.21) {
tmp = t_1;
} else if ((x / y) <= 7e-6) {
tmp = 2.0 * ((1.0 - t) / t);
} else if ((x / y) <= 7.2e+67) {
tmp = 2.0 / (z * 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) <= (-0.21d0)) then
tmp = t_1
else if ((x / y) <= 7d-6) then
tmp = 2.0d0 * ((1.0d0 - t) / t)
else if ((x / y) <= 7.2d+67) then
tmp = 2.0d0 / (z * 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) <= -0.21) {
tmp = t_1;
} else if ((x / y) <= 7e-6) {
tmp = 2.0 * ((1.0 - t) / t);
} else if ((x / y) <= 7.2e+67) {
tmp = 2.0 / (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if (x / y) <= -0.21: tmp = t_1 elif (x / y) <= 7e-6: tmp = 2.0 * ((1.0 - t) / t) elif (x / y) <= 7.2e+67: tmp = 2.0 / (z * 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) <= -0.21) tmp = t_1; elseif (Float64(x / y) <= 7e-6) tmp = Float64(2.0 * Float64(Float64(1.0 - t) / t)); elseif (Float64(x / y) <= 7.2e+67) tmp = Float64(2.0 / Float64(z * 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) <= -0.21) tmp = t_1; elseif ((x / y) <= 7e-6) tmp = 2.0 * ((1.0 - t) / t); elseif ((x / y) <= 7.2e+67) tmp = 2.0 / (z * 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], -0.21], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 7e-6], N[(2.0 * N[(N[(1.0 - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 7.2e+67], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;\frac{x}{y} \leq -0.21:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq 7 \cdot 10^{-6}:\\
\;\;\;\;2 \cdot \frac{1 - t}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 7.2 \cdot 10^{+67}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 x y) < -0.209999999999999992 or 7.1999999999999998e67 < (/.f64 x y) Initial program 87.2%
sub-neg87.2%
distribute-rgt-in87.2%
*-lft-identity87.2%
associate-+r+87.2%
cancel-sign-sub-inv87.2%
div-sub78.1%
associate-*r*78.1%
associate-*l/78.1%
*-inverses98.1%
metadata-eval98.1%
sub-neg98.1%
metadata-eval98.1%
metadata-eval98.1%
+-commutative98.1%
metadata-eval98.1%
associate-/l/98.1%
Simplified98.1%
Taylor expanded in t around inf 73.3%
if -0.209999999999999992 < (/.f64 x y) < 6.99999999999999989e-6Initial program 87.4%
clear-num87.4%
frac-add41.3%
*-un-lft-identity41.3%
*-commutative41.3%
+-commutative41.3%
associate-*l*41.3%
fma-def41.3%
*-commutative41.3%
Applied egg-rr41.3%
Taylor expanded in y around inf 66.5%
*-commutative66.5%
associate-/l*63.9%
fma-def63.9%
associate-/l*63.2%
associate-*r/63.2%
metadata-eval63.2%
Simplified63.2%
Taylor expanded in z around inf 65.3%
if 6.99999999999999989e-6 < (/.f64 x y) < 7.1999999999999998e67Initial program 99.8%
sub-neg99.8%
distribute-rgt-in99.8%
*-lft-identity99.8%
associate-+r+99.8%
cancel-sign-sub-inv99.8%
div-sub88.1%
associate-*r*88.1%
associate-*l/88.1%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/99.6%
Simplified99.6%
Taylor expanded in z around 0 60.3%
Final simplification68.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t)) (t_2 (- (/ x y) 2.0)))
(if (<= t -1.5e-20)
t_2
(if (<= t -1.9e-127)
t_1
(if (<= t -9e-148) (/ x y) (if (<= t 4.2e+37) 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 <= -1.5e-20) {
tmp = t_2;
} else if (t <= -1.9e-127) {
tmp = t_1;
} else if (t <= -9e-148) {
tmp = x / y;
} else if (t <= 4.2e+37) {
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 <= (-1.5d-20)) then
tmp = t_2
else if (t <= (-1.9d-127)) then
tmp = t_1
else if (t <= (-9d-148)) then
tmp = x / y
else if (t <= 4.2d+37) 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 <= -1.5e-20) {
tmp = t_2;
} else if (t <= -1.9e-127) {
tmp = t_1;
} else if (t <= -9e-148) {
tmp = x / y;
} else if (t <= 4.2e+37) {
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 <= -1.5e-20: tmp = t_2 elif t <= -1.9e-127: tmp = t_1 elif t <= -9e-148: tmp = x / y elif t <= 4.2e+37: 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 <= -1.5e-20) tmp = t_2; elseif (t <= -1.9e-127) tmp = t_1; elseif (t <= -9e-148) tmp = Float64(x / y); elseif (t <= 4.2e+37) 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 <= -1.5e-20) tmp = t_2; elseif (t <= -1.9e-127) tmp = t_1; elseif (t <= -9e-148) tmp = x / y; elseif (t <= 4.2e+37) 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, -1.5e-20], t$95$2, If[LessEqual[t, -1.9e-127], t$95$1, If[LessEqual[t, -9e-148], N[(x / y), $MachinePrecision], If[LessEqual[t, 4.2e+37], 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 -1.5 \cdot 10^{-20}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -1.9 \cdot 10^{-127}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -9 \cdot 10^{-148}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.50000000000000014e-20 or 4.2000000000000002e37 < t Initial program 75.5%
sub-neg75.5%
distribute-rgt-in75.6%
*-lft-identity75.6%
associate-+r+75.6%
cancel-sign-sub-inv75.6%
div-sub75.6%
associate-*r*75.6%
associate-*l/75.6%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in t around inf 82.3%
if -1.50000000000000014e-20 < t < -1.90000000000000001e-127 or -9.00000000000000029e-148 < t < 4.2000000000000002e37Initial program 98.3%
sub-neg98.3%
distribute-rgt-in98.3%
*-lft-identity98.3%
associate-+r+98.3%
cancel-sign-sub-inv98.3%
div-sub81.1%
associate-*r*81.1%
associate-*l/81.1%
*-inverses98.3%
metadata-eval98.3%
sub-neg98.3%
metadata-eval98.3%
metadata-eval98.3%
+-commutative98.3%
metadata-eval98.3%
associate-/l/98.4%
Simplified98.4%
Taylor expanded in t around 0 80.0%
associate-*r/80.0%
metadata-eval80.0%
Simplified80.0%
if -1.90000000000000001e-127 < t < -9.00000000000000029e-148Initial program 99.8%
sub-neg99.8%
distribute-rgt-in99.8%
*-lft-identity99.8%
associate-+r+99.8%
cancel-sign-sub-inv99.8%
div-sub99.8%
associate-*r*99.8%
associate-*l/99.8%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/99.8%
Simplified99.8%
Taylor expanded in x around inf 85.9%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (+ (/ x y) (- (/ 2.0 t) 2.0)) (+ (/ x y) (+ -2.0 (/ (/ 2.0 z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} else {
tmp = (x / y) + (-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 ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = (x / y) + ((2.0d0 / t) - 2.0d0)
else
tmp = (x / y) + ((-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 ((z <= -1.0) || !(z <= 1.0)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} else {
tmp = (x / y) + (-2.0 + ((2.0 / z) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = (x / y) + ((2.0 / t) - 2.0) else: tmp = (x / y) + (-2.0 + ((2.0 / z) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) - 2.0)); else tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(Float64(2.0 / z) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = (x / y) + ((2.0 / t) - 2.0); else tmp = (x / y) + (-2.0 + ((2.0 / z) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} - 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{\frac{2}{z}}{t}\right)\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 78.3%
sub-neg78.3%
distribute-rgt-in78.3%
*-lft-identity78.3%
associate-+r+78.3%
cancel-sign-sub-inv78.3%
div-sub78.3%
associate-*r*78.3%
associate-*l/78.3%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in z around inf 99.7%
associate--l+99.7%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
if -1 < z < 1Initial program 98.3%
sub-neg98.3%
distribute-rgt-in98.3%
*-lft-identity98.3%
associate-+r+98.3%
cancel-sign-sub-inv98.3%
div-sub80.0%
associate-*r*80.0%
associate-*l/80.0%
*-inverses98.3%
metadata-eval98.3%
sub-neg98.3%
metadata-eval98.3%
metadata-eval98.3%
+-commutative98.3%
metadata-eval98.3%
associate-/l/98.2%
Simplified98.2%
Taylor expanded in z around 0 96.9%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(if (or (<= t -1.55e-46)
(and (not (<= t -8.2e-97))
(or (<= t -6.5e-168) (not (<= t 2.1e-87)))))
(- (/ x y) 2.0)
(/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.55e-46) || (!(t <= -8.2e-97) && ((t <= -6.5e-168) || !(t <= 2.1e-87)))) {
tmp = (x / y) - 2.0;
} 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 ((t <= (-1.55d-46)) .or. (.not. (t <= (-8.2d-97))) .and. (t <= (-6.5d-168)) .or. (.not. (t <= 2.1d-87))) then
tmp = (x / y) - 2.0d0
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 ((t <= -1.55e-46) || (!(t <= -8.2e-97) && ((t <= -6.5e-168) || !(t <= 2.1e-87)))) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.55e-46) or (not (t <= -8.2e-97) and ((t <= -6.5e-168) or not (t <= 2.1e-87))): tmp = (x / y) - 2.0 else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.55e-46) || (!(t <= -8.2e-97) && ((t <= -6.5e-168) || !(t <= 2.1e-87)))) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.55e-46) || (~((t <= -8.2e-97)) && ((t <= -6.5e-168) || ~((t <= 2.1e-87))))) tmp = (x / y) - 2.0; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.55e-46], And[N[Not[LessEqual[t, -8.2e-97]], $MachinePrecision], Or[LessEqual[t, -6.5e-168], N[Not[LessEqual[t, 2.1e-87]], $MachinePrecision]]]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.55 \cdot 10^{-46} \lor \neg \left(t \leq -8.2 \cdot 10^{-97}\right) \land \left(t \leq -6.5 \cdot 10^{-168} \lor \neg \left(t \leq 2.1 \cdot 10^{-87}\right)\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if t < -1.55e-46 or -8.19999999999999986e-97 < t < -6.4999999999999997e-168 or 2.10000000000000007e-87 < t Initial program 83.1%
sub-neg83.1%
distribute-rgt-in83.1%
*-lft-identity83.1%
associate-+r+83.1%
cancel-sign-sub-inv83.1%
div-sub80.7%
associate-*r*80.7%
associate-*l/80.7%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in t around inf 69.1%
if -1.55e-46 < t < -8.19999999999999986e-97 or -6.4999999999999997e-168 < t < 2.10000000000000007e-87Initial program 97.5%
sub-neg97.5%
distribute-rgt-in97.5%
*-lft-identity97.5%
associate-+r+97.5%
cancel-sign-sub-inv97.5%
div-sub76.2%
associate-*r*76.2%
associate-*l/76.2%
*-inverses97.5%
metadata-eval97.5%
sub-neg97.5%
metadata-eval97.5%
metadata-eval97.5%
+-commutative97.5%
metadata-eval97.5%
associate-/l/97.7%
Simplified97.6%
Taylor expanded in t around 0 89.1%
associate-*r/89.1%
metadata-eval89.1%
Simplified89.1%
Taylor expanded in z around inf 54.2%
Final simplification64.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.8e-16) (not (<= z 2.05e-96))) (+ (/ x y) (- (/ 2.0 t) 2.0)) (+ -2.0 (/ 2.0 (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e-16) || !(z <= 2.05e-96)) {
tmp = (x / y) + ((2.0 / t) - 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 ((z <= (-1.8d-16)) .or. (.not. (z <= 2.05d-96))) then
tmp = (x / y) + ((2.0d0 / t) - 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 ((z <= -1.8e-16) || !(z <= 2.05e-96)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} else {
tmp = -2.0 + (2.0 / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.8e-16) or not (z <= 2.05e-96): tmp = (x / y) + ((2.0 / t) - 2.0) else: tmp = -2.0 + (2.0 / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.8e-16) || !(z <= 2.05e-96)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) - 2.0)); else tmp = Float64(-2.0 + Float64(2.0 / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.8e-16) || ~((z <= 2.05e-96))) tmp = (x / y) + ((2.0 / t) - 2.0); else tmp = -2.0 + (2.0 / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.8e-16], N[Not[LessEqual[z, 2.05e-96]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-16} \lor \neg \left(z \leq 2.05 \cdot 10^{-96}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} - 2\right)\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -1.79999999999999991e-16 or 2.05000000000000012e-96 < z Initial program 81.5%
sub-neg81.5%
distribute-rgt-in81.5%
*-lft-identity81.5%
associate-+r+81.5%
cancel-sign-sub-inv81.5%
div-sub81.5%
associate-*r*81.5%
associate-*l/81.5%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/100.0%
Simplified99.9%
Taylor expanded in z around inf 94.6%
associate--l+94.6%
associate-*r/94.6%
metadata-eval94.6%
Simplified94.6%
if -1.79999999999999991e-16 < z < 2.05000000000000012e-96Initial program 97.9%
sub-neg97.9%
distribute-rgt-in97.9%
*-lft-identity97.9%
associate-+r+97.9%
cancel-sign-sub-inv97.9%
div-sub75.6%
associate-*r*75.6%
associate-*l/75.6%
*-inverses97.9%
metadata-eval97.9%
sub-neg97.9%
metadata-eval97.9%
metadata-eval97.9%
+-commutative97.9%
metadata-eval97.9%
associate-/l/97.9%
Simplified97.9%
Taylor expanded in z around 0 97.9%
Taylor expanded in x around 0 75.5%
sub-neg75.5%
associate-*r/75.5%
metadata-eval75.5%
metadata-eval75.5%
Simplified75.5%
Final simplification86.9%
(FPCore (x y z t) :precision binary64 (+ (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t)) (/ x y)))
double code(double x, double y, double z, double t) {
return (-2.0 + ((2.0 + (2.0 / z)) / t)) + (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 + (2.0d0 / z)) / t)) + (x / y)
end function
public static double code(double x, double y, double z, double t) {
return (-2.0 + ((2.0 + (2.0 / z)) / t)) + (x / y);
}
def code(x, y, z, t): return (-2.0 + ((2.0 + (2.0 / z)) / t)) + (x / y)
function code(x, y, z, t) return Float64(Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t)) + Float64(x / y)) end
function tmp = code(x, y, z, t) tmp = (-2.0 + ((2.0 + (2.0 / z)) / t)) + (x / y); end
code[x_, y_, z_, t_] := N[(N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-2 + \frac{2 + \frac{2}{z}}{t}\right) + \frac{x}{y}
\end{array}
Initial program 88.1%
sub-neg88.1%
distribute-rgt-in88.1%
*-lft-identity88.1%
associate-+r+88.1%
cancel-sign-sub-inv88.1%
div-sub79.1%
associate-*r*79.1%
associate-*l/79.1%
*-inverses99.1%
metadata-eval99.1%
sub-neg99.1%
metadata-eval99.1%
metadata-eval99.1%
+-commutative99.1%
metadata-eval99.1%
associate-/l/99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (<= t -1.0) -2.0 (if (<= t 750.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 <= 750.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 <= 750.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 <= 750.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 <= 750.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 <= 750.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 <= 750.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, 750.0], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 750:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1 or 750 < t Initial program 76.2%
clear-num76.1%
frac-add51.8%
*-un-lft-identity51.8%
*-commutative51.8%
+-commutative51.8%
associate-*l*51.8%
fma-def51.8%
*-commutative51.8%
Applied egg-rr51.8%
Taylor expanded in y around inf 34.3%
*-commutative34.3%
associate-/l*34.8%
fma-def34.8%
associate-/l*34.3%
associate-*r/34.3%
metadata-eval34.3%
Simplified34.3%
Taylor expanded in t around inf 38.6%
if -1 < t < 750Initial program 98.3%
sub-neg98.3%
distribute-rgt-in98.3%
*-lft-identity98.3%
associate-+r+98.3%
cancel-sign-sub-inv98.3%
div-sub81.7%
associate-*r*81.7%
associate-*l/81.7%
*-inverses98.3%
metadata-eval98.3%
sub-neg98.3%
metadata-eval98.3%
metadata-eval98.3%
+-commutative98.3%
metadata-eval98.3%
associate-/l/98.4%
Simplified98.4%
Taylor expanded in t around 0 77.1%
associate-*r/77.1%
metadata-eval77.1%
Simplified77.1%
Taylor expanded in z around inf 40.5%
Final simplification39.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 88.1%
clear-num88.0%
frac-add59.4%
*-un-lft-identity59.4%
*-commutative59.4%
+-commutative59.4%
associate-*l*59.4%
fma-def59.4%
*-commutative59.4%
Applied egg-rr59.4%
Taylor expanded in y around inf 50.4%
*-commutative50.4%
associate-/l*49.4%
fma-def49.4%
associate-/l*49.2%
associate-*r/49.2%
metadata-eval49.2%
Simplified49.2%
Taylor expanded in t around inf 19.1%
Final simplification19.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 2023240
(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))))