
(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(-2.0 + Float64(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[(-2.0 + N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-2 + \left(\frac{x}{y} + \frac{2 + \frac{2}{z}}{t}\right)
\end{array}
Initial program 90.5%
+-commutative90.5%
*-commutative90.5%
associate-*r*90.5%
distribute-rgt1-in90.5%
*-commutative90.5%
times-frac90.7%
fma-def90.7%
*-commutative90.7%
fma-def90.7%
Simplified90.7%
Taylor expanded in t around inf 99.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%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ -2.0 (/ 2.0 (* z t)))))
(if (<= (/ x y) -2e+81)
(/ x y)
(if (<= (/ x y) -4e-69)
t_1
(if (<= (/ x y) -5e-241)
(+ -2.0 (/ 2.0 t))
(if (<= (/ x y) 2e+35) t_1 (- (/ x y) 2.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = -2.0 + (2.0 / (z * t));
double tmp;
if ((x / y) <= -2e+81) {
tmp = x / y;
} else if ((x / y) <= -4e-69) {
tmp = t_1;
} else if ((x / y) <= -5e-241) {
tmp = -2.0 + (2.0 / t);
} else if ((x / y) <= 2e+35) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (-2.0d0) + (2.0d0 / (z * t))
if ((x / y) <= (-2d+81)) then
tmp = x / y
else if ((x / y) <= (-4d-69)) then
tmp = t_1
else if ((x / y) <= (-5d-241)) then
tmp = (-2.0d0) + (2.0d0 / t)
else if ((x / y) <= 2d+35) then
tmp = t_1
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 t_1 = -2.0 + (2.0 / (z * t));
double tmp;
if ((x / y) <= -2e+81) {
tmp = x / y;
} else if ((x / y) <= -4e-69) {
tmp = t_1;
} else if ((x / y) <= -5e-241) {
tmp = -2.0 + (2.0 / t);
} else if ((x / y) <= 2e+35) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = -2.0 + (2.0 / (z * t)) tmp = 0 if (x / y) <= -2e+81: tmp = x / y elif (x / y) <= -4e-69: tmp = t_1 elif (x / y) <= -5e-241: tmp = -2.0 + (2.0 / t) elif (x / y) <= 2e+35: tmp = t_1 else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) t_1 = Float64(-2.0 + Float64(2.0 / Float64(z * t))) tmp = 0.0 if (Float64(x / y) <= -2e+81) tmp = Float64(x / y); elseif (Float64(x / y) <= -4e-69) tmp = t_1; elseif (Float64(x / y) <= -5e-241) tmp = Float64(-2.0 + Float64(2.0 / t)); elseif (Float64(x / y) <= 2e+35) tmp = t_1; else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -2.0 + (2.0 / (z * t)); tmp = 0.0; if ((x / y) <= -2e+81) tmp = x / y; elseif ((x / y) <= -4e-69) tmp = t_1; elseif ((x / y) <= -5e-241) tmp = -2.0 + (2.0 / t); elseif ((x / y) <= 2e+35) tmp = t_1; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -2e+81], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -4e-69], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -5e-241], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e+35], t$95$1, N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -2 + \frac{2}{z \cdot t}\\
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+81}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -4 \cdot 10^{-69}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-241}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+35}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -1.99999999999999984e81Initial program 96.1%
sub-neg96.1%
distribute-rgt-in96.1%
*-lft-identity96.1%
associate-+r+96.1%
cancel-sign-sub-inv96.1%
div-sub82.9%
associate-*r*82.9%
associate-*l/82.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 x around inf 74.0%
if -1.99999999999999984e81 < (/.f64 x y) < -3.9999999999999999e-69 or -4.9999999999999998e-241 < (/.f64 x y) < 1.9999999999999999e35Initial program 86.7%
+-commutative86.7%
*-commutative86.7%
associate-*r*86.7%
distribute-rgt1-in86.7%
*-commutative86.7%
times-frac87.0%
fma-def87.0%
*-commutative87.0%
fma-def87.0%
Simplified87.0%
Taylor expanded in t around inf 99.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 z around 0 81.3%
if -3.9999999999999999e-69 < (/.f64 x y) < -4.9999999999999998e-241Initial program 91.9%
sub-neg91.9%
distribute-rgt-in91.9%
*-lft-identity91.9%
associate-+r+91.9%
cancel-sign-sub-inv91.9%
div-sub87.9%
associate-*r*87.9%
associate-*l/87.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 z around inf 76.6%
associate--l+76.6%
associate-*r/76.6%
metadata-eval76.6%
Simplified76.6%
Taylor expanded in x around 0 76.6%
sub-neg76.6%
associate-*r/76.6%
metadata-eval76.6%
metadata-eval76.6%
Simplified76.6%
if 1.9999999999999999e35 < (/.f64 x y) Initial program 92.1%
sub-neg92.1%
distribute-rgt-in92.1%
*-lft-identity92.1%
associate-+r+92.1%
cancel-sign-sub-inv92.1%
div-sub84.3%
associate-*r*84.3%
associate-*l/84.3%
*-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 73.4%
Final simplification77.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (/ 1.0 (* z t)))) (t_2 (- (/ x y) 2.0)))
(if (<= t -1.32e-115)
t_2
(if (<= t 1.62e-205)
t_1
(if (<= t 1.7e-198) (/ 2.0 t) (if (<= t 2.45e+26) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (1.0 / (z * t));
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -1.32e-115) {
tmp = t_2;
} else if (t <= 1.62e-205) {
tmp = t_1;
} else if (t <= 1.7e-198) {
tmp = 2.0 / t;
} else if (t <= 2.45e+26) {
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 * (1.0d0 / (z * t))
t_2 = (x / y) - 2.0d0
if (t <= (-1.32d-115)) then
tmp = t_2
else if (t <= 1.62d-205) then
tmp = t_1
else if (t <= 1.7d-198) then
tmp = 2.0d0 / t
else if (t <= 2.45d+26) 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 * (1.0 / (z * t));
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -1.32e-115) {
tmp = t_2;
} else if (t <= 1.62e-205) {
tmp = t_1;
} else if (t <= 1.7e-198) {
tmp = 2.0 / t;
} else if (t <= 2.45e+26) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (1.0 / (z * t)) t_2 = (x / y) - 2.0 tmp = 0 if t <= -1.32e-115: tmp = t_2 elif t <= 1.62e-205: tmp = t_1 elif t <= 1.7e-198: tmp = 2.0 / t elif t <= 2.45e+26: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(1.0 / Float64(z * t))) t_2 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -1.32e-115) tmp = t_2; elseif (t <= 1.62e-205) tmp = t_1; elseif (t <= 1.7e-198) tmp = Float64(2.0 / t); elseif (t <= 2.45e+26) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (1.0 / (z * t)); t_2 = (x / y) - 2.0; tmp = 0.0; if (t <= -1.32e-115) tmp = t_2; elseif (t <= 1.62e-205) tmp = t_1; elseif (t <= 1.7e-198) tmp = 2.0 / t; elseif (t <= 2.45e+26) 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[(1.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -1.32e-115], t$95$2, If[LessEqual[t, 1.62e-205], t$95$1, If[LessEqual[t, 1.7e-198], N[(2.0 / t), $MachinePrecision], If[LessEqual[t, 2.45e+26], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \frac{1}{z \cdot t}\\
t_2 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -1.32 \cdot 10^{-115}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 1.62 \cdot 10^{-205}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-198}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;t \leq 2.45 \cdot 10^{+26}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.32e-115 or 2.44999999999999987e26 < t Initial program 84.9%
sub-neg84.9%
distribute-rgt-in84.9%
*-lft-identity84.9%
associate-+r+84.9%
cancel-sign-sub-inv84.9%
div-sub84.9%
associate-*r*84.9%
associate-*l/84.9%
*-inverses100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
metadata-eval100.0%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in t around inf 80.6%
if -1.32e-115 < t < 1.6200000000000001e-205 or 1.6999999999999999e-198 < t < 2.44999999999999987e26Initial program 99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
distribute-rgt1-in99.7%
*-commutative99.7%
times-frac99.8%
fma-def99.8%
*-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in t around 0 82.8%
Taylor expanded in z around 0 60.2%
if 1.6200000000000001e-205 < t < 1.6999999999999999e-198Initial program 100.0%
sub-neg100.0%
distribute-rgt-in100.0%
*-lft-identity100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
div-sub100.0%
associate-*r*100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
metadata-eval100.0%
associate-/l/99.7%
Simplified99.7%
Taylor expanded in z around inf 99.4%
associate--l+99.4%
associate-*r/99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in t around 0 99.4%
Final simplification73.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1000000000000.0) (not (<= z 0.0085))) (+ (/ x y) (- (/ 2.0 t) 2.0)) (+ -2.0 (+ (/ x y) (/ 2.0 (* z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1000000000000.0) || !(z <= 0.0085)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} else {
tmp = -2.0 + ((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 <= (-1000000000000.0d0)) .or. (.not. (z <= 0.0085d0))) then
tmp = (x / y) + ((2.0d0 / t) - 2.0d0)
else
tmp = (-2.0d0) + ((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 <= -1000000000000.0) || !(z <= 0.0085)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} else {
tmp = -2.0 + ((x / y) + (2.0 / (z * t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1000000000000.0) or not (z <= 0.0085): tmp = (x / y) + ((2.0 / t) - 2.0) else: tmp = -2.0 + ((x / y) + (2.0 / (z * t))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1000000000000.0) || !(z <= 0.0085)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) - 2.0)); else tmp = Float64(-2.0 + 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 <= -1000000000000.0) || ~((z <= 0.0085))) tmp = (x / y) + ((2.0 / t) - 2.0); else tmp = -2.0 + ((x / y) + (2.0 / (z * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1000000000000.0], N[Not[LessEqual[z, 0.0085]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1000000000000 \lor \neg \left(z \leq 0.0085\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} - 2\right)\\
\mathbf{else}:\\
\;\;\;\;-2 + \left(\frac{x}{y} + \frac{2}{z \cdot t}\right)\\
\end{array}
\end{array}
if z < -1e12 or 0.0085000000000000006 < z Initial program 78.1%
sub-neg78.1%
distribute-rgt-in78.1%
*-lft-identity78.1%
associate-+r+78.1%
cancel-sign-sub-inv78.1%
div-sub78.0%
associate-*r*78.0%
associate-*l/78.0%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
associate--l+100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -1e12 < z < 0.0085000000000000006Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt1-in99.9%
*-commutative99.9%
times-frac99.8%
fma-def99.8%
*-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in t around inf 99.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 z around 0 99.4%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -60000000.0) (not (<= (/ x y) 2.9e+38))) (- (/ x y) 2.0) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -60000000.0) || !((x / y) <= 2.9e+38)) {
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) <= (-60000000.0d0)) .or. (.not. ((x / y) <= 2.9d+38))) 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) <= -60000000.0) || !((x / y) <= 2.9e+38)) {
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) <= -60000000.0) or not ((x / y) <= 2.9e+38): 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) <= -60000000.0) || !(Float64(x / y) <= 2.9e+38)) 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) <= -60000000.0) || ~(((x / y) <= 2.9e+38))) 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], -60000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2.9e+38]], $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 -60000000 \lor \neg \left(\frac{x}{y} \leq 2.9 \cdot 10^{+38}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -6e7 or 2.90000000000000007e38 < (/.f64 x y) Initial program 94.6%
sub-neg94.6%
distribute-rgt-in94.6%
*-lft-identity94.6%
associate-+r+94.6%
cancel-sign-sub-inv94.6%
div-sub83.4%
associate-*r*83.4%
associate-*l/83.4%
*-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.8%
if -6e7 < (/.f64 x y) < 2.90000000000000007e38Initial program 86.1%
sub-neg86.1%
distribute-rgt-in86.1%
*-lft-identity86.1%
associate-+r+86.1%
cancel-sign-sub-inv86.1%
div-sub73.0%
associate-*r*73.0%
associate-*l/73.0%
*-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 z around inf 62.6%
associate--l+62.6%
associate-*r/62.6%
metadata-eval62.6%
Simplified62.6%
Taylor expanded in x around 0 61.9%
sub-neg61.9%
associate-*r/61.9%
metadata-eval61.9%
metadata-eval61.9%
Simplified61.9%
Final simplification66.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.5e+27) (not (<= t 2.45e+26))) (- (/ x y) 2.0) (* 2.0 (/ (+ z 1.0) (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.5e+27) || !(t <= 2.45e+26)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 * ((z + 1.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 <= (-7.5d+27)) .or. (.not. (t <= 2.45d+26))) then
tmp = (x / y) - 2.0d0
else
tmp = 2.0d0 * ((z + 1.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 <= -7.5e+27) || !(t <= 2.45e+26)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 * ((z + 1.0) / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.5e+27) or not (t <= 2.45e+26): tmp = (x / y) - 2.0 else: tmp = 2.0 * ((z + 1.0) / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.5e+27) || !(t <= 2.45e+26)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 * Float64(Float64(z + 1.0) / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7.5e+27) || ~((t <= 2.45e+26))) tmp = (x / y) - 2.0; else tmp = 2.0 * ((z + 1.0) / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.5e+27], N[Not[LessEqual[t, 2.45e+26]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 * N[(N[(z + 1.0), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+27} \lor \neg \left(t \leq 2.45 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{z + 1}{z \cdot t}\\
\end{array}
\end{array}
if t < -7.5000000000000002e27 or 2.44999999999999987e26 < t Initial program 81.6%
sub-neg81.6%
distribute-rgt-in81.6%
*-lft-identity81.6%
associate-+r+81.6%
cancel-sign-sub-inv81.6%
div-sub81.6%
associate-*r*81.6%
associate-*l/81.6%
*-inverses100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
metadata-eval100.0%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in t around inf 88.3%
if -7.5000000000000002e27 < t < 2.44999999999999987e26Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
distribute-rgt1-in99.8%
*-commutative99.8%
times-frac99.8%
fma-def99.8%
*-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in t around 0 77.8%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.2e+27) (not (<= t 2.45e+26))) (- (/ x y) 2.0) (* 2.0 (/ (/ (+ z 1.0) z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.2e+27) || !(t <= 2.45e+26)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 * (((z + 1.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 <= (-7.2d+27)) .or. (.not. (t <= 2.45d+26))) then
tmp = (x / y) - 2.0d0
else
tmp = 2.0d0 * (((z + 1.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 <= -7.2e+27) || !(t <= 2.45e+26)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 * (((z + 1.0) / z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.2e+27) or not (t <= 2.45e+26): tmp = (x / y) - 2.0 else: tmp = 2.0 * (((z + 1.0) / z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.2e+27) || !(t <= 2.45e+26)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 * Float64(Float64(Float64(z + 1.0) / z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7.2e+27) || ~((t <= 2.45e+26))) tmp = (x / y) - 2.0; else tmp = 2.0 * (((z + 1.0) / z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.2e+27], N[Not[LessEqual[t, 2.45e+26]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 * N[(N[(N[(z + 1.0), $MachinePrecision] / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{+27} \lor \neg \left(t \leq 2.45 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{z + 1}{z}}{t}\\
\end{array}
\end{array}
if t < -7.19999999999999966e27 or 2.44999999999999987e26 < t Initial program 81.6%
sub-neg81.6%
distribute-rgt-in81.6%
*-lft-identity81.6%
associate-+r+81.6%
cancel-sign-sub-inv81.6%
div-sub81.6%
associate-*r*81.6%
associate-*l/81.6%
*-inverses100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
metadata-eval100.0%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in t around inf 88.3%
if -7.19999999999999966e27 < t < 2.44999999999999987e26Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
distribute-rgt1-in99.8%
*-commutative99.8%
times-frac99.8%
fma-def99.8%
*-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in t around 0 77.8%
associate-/r*66.8%
div-inv66.7%
+-commutative66.7%
Applied egg-rr66.7%
associate-*l/77.7%
un-div-inv77.8%
Applied egg-rr77.8%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.4e-231) (not (<= z 3.4e-92))) (+ (/ 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 <= -4.4e-231) || !(z <= 3.4e-92)) {
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 <= (-4.4d-231)) .or. (.not. (z <= 3.4d-92))) 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 <= -4.4e-231) || !(z <= 3.4e-92)) {
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 <= -4.4e-231) or not (z <= 3.4e-92): 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 <= -4.4e-231) || !(z <= 3.4e-92)) 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 <= -4.4e-231) || ~((z <= 3.4e-92))) 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, -4.4e-231], N[Not[LessEqual[z, 3.4e-92]], $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 -4.4 \cdot 10^{-231} \lor \neg \left(z \leq 3.4 \cdot 10^{-92}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} - 2\right)\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -4.40000000000000018e-231 or 3.4000000000000003e-92 < z Initial program 86.7%
sub-neg86.7%
distribute-rgt-in86.7%
*-lft-identity86.7%
associate-+r+86.7%
cancel-sign-sub-inv86.7%
div-sub85.1%
associate-*r*85.1%
associate-*l/85.1%
*-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 z around inf 86.4%
associate--l+86.4%
associate-*r/86.4%
metadata-eval86.4%
Simplified86.4%
if -4.40000000000000018e-231 < z < 3.4000000000000003e-92Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt1-in99.9%
*-commutative99.9%
times-frac99.7%
fma-def99.7%
*-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in t around inf 99.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 z around 0 81.4%
Final simplification85.0%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -340000000.0) (/ x y) (if (<= (/ x y) 1.55e+35) (+ -2.0 (/ 2.0 t)) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -340000000.0) {
tmp = x / y;
} else if ((x / y) <= 1.55e+35) {
tmp = -2.0 + (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) <= (-340000000.0d0)) then
tmp = x / y
else if ((x / y) <= 1.55d+35) then
tmp = (-2.0d0) + (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) <= -340000000.0) {
tmp = x / y;
} else if ((x / y) <= 1.55e+35) {
tmp = -2.0 + (2.0 / t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -340000000.0: tmp = x / y elif (x / y) <= 1.55e+35: tmp = -2.0 + (2.0 / t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -340000000.0) tmp = Float64(x / y); elseif (Float64(x / y) <= 1.55e+35) tmp = Float64(-2.0 + 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) <= -340000000.0) tmp = x / y; elseif ((x / y) <= 1.55e+35) tmp = -2.0 + (2.0 / t); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -340000000.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.55e+35], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -340000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 1.55 \cdot 10^{+35}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -3.4e8 or 1.54999999999999993e35 < (/.f64 x y) Initial program 94.6%
sub-neg94.6%
distribute-rgt-in94.6%
*-lft-identity94.6%
associate-+r+94.6%
cancel-sign-sub-inv94.6%
div-sub83.4%
associate-*r*83.4%
associate-*l/83.4%
*-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 x around inf 69.3%
if -3.4e8 < (/.f64 x y) < 1.54999999999999993e35Initial program 86.1%
sub-neg86.1%
distribute-rgt-in86.1%
*-lft-identity86.1%
associate-+r+86.1%
cancel-sign-sub-inv86.1%
div-sub73.0%
associate-*r*73.0%
associate-*l/73.0%
*-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 z around inf 62.6%
associate--l+62.6%
associate-*r/62.6%
metadata-eval62.6%
Simplified62.6%
Taylor expanded in x around 0 61.9%
sub-neg61.9%
associate-*r/61.9%
metadata-eval61.9%
metadata-eval61.9%
Simplified61.9%
Final simplification65.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -60000000.0) (/ x y) (if (<= (/ x y) 1250000000000.0) -2.0 (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -60000000.0) {
tmp = x / y;
} else if ((x / y) <= 1250000000000.0) {
tmp = -2.0;
} 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) <= (-60000000.0d0)) then
tmp = x / y
else if ((x / y) <= 1250000000000.0d0) then
tmp = -2.0d0
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) <= -60000000.0) {
tmp = x / y;
} else if ((x / y) <= 1250000000000.0) {
tmp = -2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -60000000.0: tmp = x / y elif (x / y) <= 1250000000000.0: tmp = -2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -60000000.0) tmp = Float64(x / y); elseif (Float64(x / y) <= 1250000000000.0) tmp = -2.0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -60000000.0) tmp = x / y; elseif ((x / y) <= 1250000000000.0) tmp = -2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -60000000.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1250000000000.0], -2.0, N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -60000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 1250000000000:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -6e7 or 1.25e12 < (/.f64 x y) Initial program 94.9%
sub-neg94.9%
distribute-rgt-in94.9%
*-lft-identity94.9%
associate-+r+94.9%
cancel-sign-sub-inv94.9%
div-sub83.6%
associate-*r*83.6%
associate-*l/83.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 x around inf 66.3%
if -6e7 < (/.f64 x y) < 1.25e12Initial program 85.1%
sub-neg85.1%
distribute-rgt-in85.1%
*-lft-identity85.1%
associate-+r+85.1%
cancel-sign-sub-inv85.1%
div-sub72.0%
associate-*r*72.0%
associate-*l/72.0%
*-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 47.0%
Taylor expanded in x around 0 47.1%
Final simplification57.7%
(FPCore (x y z t) :precision binary64 (if (<= t -350000000000.0) -2.0 (if (<= t 0.052) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -350000000000.0) {
tmp = -2.0;
} else if (t <= 0.052) {
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 <= (-350000000000.0d0)) then
tmp = -2.0d0
else if (t <= 0.052d0) 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 <= -350000000000.0) {
tmp = -2.0;
} else if (t <= 0.052) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -350000000000.0: tmp = -2.0 elif t <= 0.052: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -350000000000.0) tmp = -2.0; elseif (t <= 0.052) 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 <= -350000000000.0) tmp = -2.0; elseif (t <= 0.052) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -350000000000.0], -2.0, If[LessEqual[t, 0.052], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -350000000000:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 0.052:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -3.5e11 or 0.0519999999999999976 < t Initial program 83.0%
sub-neg83.0%
distribute-rgt-in83.0%
*-lft-identity83.0%
associate-+r+83.0%
cancel-sign-sub-inv83.0%
div-sub83.0%
associate-*r*83.0%
associate-*l/83.0%
*-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 84.1%
Taylor expanded in x around 0 38.9%
if -3.5e11 < t < 0.0519999999999999976Initial program 99.8%
sub-neg99.8%
distribute-rgt-in99.8%
*-lft-identity99.8%
associate-+r+99.8%
cancel-sign-sub-inv99.8%
div-sub72.6%
associate-*r*72.6%
associate-*l/72.6%
*-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 z around inf 54.3%
associate--l+54.3%
associate-*r/54.3%
metadata-eval54.3%
Simplified54.3%
Taylor expanded in t around 0 30.2%
Final simplification35.0%
(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 90.5%
sub-neg90.5%
distribute-rgt-in90.5%
*-lft-identity90.5%
associate-+r+90.5%
cancel-sign-sub-inv90.5%
div-sub78.4%
associate-*r*78.4%
associate-*l/78.4%
*-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 57.9%
Taylor expanded in x around 0 22.6%
Final simplification22.6%
(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 2023195
(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))))