
(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 (/ (+ 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 83.5%
+-commutative83.5%
remove-double-neg83.5%
distribute-frac-neg83.5%
unsub-neg83.5%
*-commutative83.5%
associate-*r*83.5%
distribute-rgt1-in83.5%
associate-*r/83.5%
/-rgt-identity83.5%
fma-neg83.5%
/-rgt-identity83.5%
*-commutative83.5%
fma-def83.5%
*-commutative83.5%
distribute-frac-neg83.5%
remove-double-neg83.5%
Simplified83.5%
Taylor expanded in t around 0 99.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -1.7e-19)
(/ x y)
(if (<= (/ x y) -2.5e-112)
-2.0
(if (<= (/ x y) -2.2e-208)
(/ 2.0 t)
(if (<= (/ x y) 2.3e-141)
-2.0
(if (<= (/ x y) 1e-49)
(/ 2.0 t)
(if (<= (/ x y) 2.0) -2.0 (/ x y))))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.7e-19) {
tmp = x / y;
} else if ((x / y) <= -2.5e-112) {
tmp = -2.0;
} else if ((x / y) <= -2.2e-208) {
tmp = 2.0 / t;
} else if ((x / y) <= 2.3e-141) {
tmp = -2.0;
} else if ((x / y) <= 1e-49) {
tmp = 2.0 / t;
} else if ((x / y) <= 2.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) <= (-1.7d-19)) then
tmp = x / y
else if ((x / y) <= (-2.5d-112)) then
tmp = -2.0d0
else if ((x / y) <= (-2.2d-208)) then
tmp = 2.0d0 / t
else if ((x / y) <= 2.3d-141) then
tmp = -2.0d0
else if ((x / y) <= 1d-49) then
tmp = 2.0d0 / t
else if ((x / y) <= 2.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) <= -1.7e-19) {
tmp = x / y;
} else if ((x / y) <= -2.5e-112) {
tmp = -2.0;
} else if ((x / y) <= -2.2e-208) {
tmp = 2.0 / t;
} else if ((x / y) <= 2.3e-141) {
tmp = -2.0;
} else if ((x / y) <= 1e-49) {
tmp = 2.0 / t;
} else if ((x / y) <= 2.0) {
tmp = -2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1.7e-19: tmp = x / y elif (x / y) <= -2.5e-112: tmp = -2.0 elif (x / y) <= -2.2e-208: tmp = 2.0 / t elif (x / y) <= 2.3e-141: tmp = -2.0 elif (x / y) <= 1e-49: tmp = 2.0 / t elif (x / y) <= 2.0: tmp = -2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1.7e-19) tmp = Float64(x / y); elseif (Float64(x / y) <= -2.5e-112) tmp = -2.0; elseif (Float64(x / y) <= -2.2e-208) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= 2.3e-141) tmp = -2.0; elseif (Float64(x / y) <= 1e-49) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= 2.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) <= -1.7e-19) tmp = x / y; elseif ((x / y) <= -2.5e-112) tmp = -2.0; elseif ((x / y) <= -2.2e-208) tmp = 2.0 / t; elseif ((x / y) <= 2.3e-141) tmp = -2.0; elseif ((x / y) <= 1e-49) tmp = 2.0 / t; elseif ((x / y) <= 2.0) tmp = -2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1.7e-19], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -2.5e-112], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], -2.2e-208], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.3e-141], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 1e-49], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.0], -2.0, N[(x / y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.7 \cdot 10^{-19}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -2.5 \cdot 10^{-112}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq -2.2 \cdot 10^{-208}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 2.3 \cdot 10^{-141}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-49}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 2:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.7000000000000001e-19 or 2 < (/.f64 x y) Initial program 85.6%
Taylor expanded in x around inf 73.0%
if -1.7000000000000001e-19 < (/.f64 x y) < -2.50000000000000022e-112 or -2.2e-208 < (/.f64 x y) < 2.29999999999999995e-141 or 9.99999999999999936e-50 < (/.f64 x y) < 2Initial program 76.0%
Taylor expanded in t around inf 47.6%
Taylor expanded in x around 0 45.2%
if -2.50000000000000022e-112 < (/.f64 x y) < -2.2e-208 or 2.29999999999999995e-141 < (/.f64 x y) < 9.99999999999999936e-50Initial program 95.7%
Taylor expanded in t around 0 87.5%
associate-*r/87.5%
metadata-eval87.5%
Simplified87.5%
Taylor expanded in z around inf 60.6%
Final simplification62.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)) (t_2 (- (/ 2.0 (* z t)) 2.0)))
(if (<= (/ x y) -2e+14)
t_1
(if (<= (/ x y) -4e-73)
t_2
(if (<= (/ x y) -5e-202)
(+ (/ 2.0 t) -2.0)
(if (<= (/ x y) 5e-49) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double t_2 = (2.0 / (z * t)) - 2.0;
double tmp;
if ((x / y) <= -2e+14) {
tmp = t_1;
} else if ((x / y) <= -4e-73) {
tmp = t_2;
} else if ((x / y) <= -5e-202) {
tmp = (2.0 / t) + -2.0;
} else if ((x / y) <= 5e-49) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = (x / y) - 2.0d0
t_2 = (2.0d0 / (z * t)) - 2.0d0
if ((x / y) <= (-2d+14)) then
tmp = t_1
else if ((x / y) <= (-4d-73)) then
tmp = t_2
else if ((x / y) <= (-5d-202)) then
tmp = (2.0d0 / t) + (-2.0d0)
else if ((x / y) <= 5d-49) then
tmp = t_2
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 t_2 = (2.0 / (z * t)) - 2.0;
double tmp;
if ((x / y) <= -2e+14) {
tmp = t_1;
} else if ((x / y) <= -4e-73) {
tmp = t_2;
} else if ((x / y) <= -5e-202) {
tmp = (2.0 / t) + -2.0;
} else if ((x / y) <= 5e-49) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 t_2 = (2.0 / (z * t)) - 2.0 tmp = 0 if (x / y) <= -2e+14: tmp = t_1 elif (x / y) <= -4e-73: tmp = t_2 elif (x / y) <= -5e-202: tmp = (2.0 / t) + -2.0 elif (x / y) <= 5e-49: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) t_2 = Float64(Float64(2.0 / Float64(z * t)) - 2.0) tmp = 0.0 if (Float64(x / y) <= -2e+14) tmp = t_1; elseif (Float64(x / y) <= -4e-73) tmp = t_2; elseif (Float64(x / y) <= -5e-202) tmp = Float64(Float64(2.0 / t) + -2.0); elseif (Float64(x / y) <= 5e-49) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; t_2 = (2.0 / (z * t)) - 2.0; tmp = 0.0; if ((x / y) <= -2e+14) tmp = t_1; elseif ((x / y) <= -4e-73) tmp = t_2; elseif ((x / y) <= -5e-202) tmp = (2.0 / t) + -2.0; elseif ((x / y) <= 5e-49) tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -2e+14], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -4e-73], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -5e-202], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e-49], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
t_2 := \frac{2}{z \cdot t} - 2\\
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+14}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq -4 \cdot 10^{-73}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-202}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-49}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 x y) < -2e14 or 4.9999999999999999e-49 < (/.f64 x y) Initial program 84.9%
Taylor expanded in t around inf 76.6%
if -2e14 < (/.f64 x y) < -3.99999999999999999e-73 or -4.99999999999999973e-202 < (/.f64 x y) < 4.9999999999999999e-49Initial program 81.7%
+-commutative81.7%
remove-double-neg81.7%
distribute-frac-neg81.7%
unsub-neg81.7%
*-commutative81.7%
associate-*r*81.7%
distribute-rgt1-in81.7%
associate-*r/81.6%
/-rgt-identity81.6%
fma-neg81.6%
/-rgt-identity81.6%
*-commutative81.6%
fma-def81.6%
*-commutative81.6%
distribute-frac-neg81.6%
remove-double-neg81.6%
Simplified81.6%
Taylor expanded in t around 0 99.8%
Taylor expanded in z around 0 81.6%
if -3.99999999999999999e-73 < (/.f64 x y) < -4.99999999999999973e-202Initial program 80.7%
Taylor expanded in z around inf 89.4%
Taylor expanded in x around 0 89.4%
div-sub89.4%
sub-neg89.4%
*-inverses89.4%
metadata-eval89.4%
distribute-lft-in89.4%
associate-*r/89.4%
metadata-eval89.4%
metadata-eval89.4%
Simplified89.4%
Final simplification79.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ x y) (/ (/ 2.0 t) z))))
(if (<= (/ x y) -1e-24)
t_1
(if (<= (/ x y) -5e-202)
(+ (/ 2.0 t) -2.0)
(if (<= (/ x y) 1.0) (- (/ 2.0 (* z t)) 2.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + ((2.0 / t) / z);
double tmp;
if ((x / y) <= -1e-24) {
tmp = t_1;
} else if ((x / y) <= -5e-202) {
tmp = (2.0 / t) + -2.0;
} else if ((x / y) <= 1.0) {
tmp = (2.0 / (z * t)) - 2.0;
} 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 / t) / z)
if ((x / y) <= (-1d-24)) then
tmp = t_1
else if ((x / y) <= (-5d-202)) then
tmp = (2.0d0 / t) + (-2.0d0)
else if ((x / y) <= 1.0d0) then
tmp = (2.0d0 / (z * t)) - 2.0d0
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 / t) / z);
double tmp;
if ((x / y) <= -1e-24) {
tmp = t_1;
} else if ((x / y) <= -5e-202) {
tmp = (2.0 / t) + -2.0;
} else if ((x / y) <= 1.0) {
tmp = (2.0 / (z * t)) - 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + ((2.0 / t) / z) tmp = 0 if (x / y) <= -1e-24: tmp = t_1 elif (x / y) <= -5e-202: tmp = (2.0 / t) + -2.0 elif (x / y) <= 1.0: tmp = (2.0 / (z * t)) - 2.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z)) tmp = 0.0 if (Float64(x / y) <= -1e-24) tmp = t_1; elseif (Float64(x / y) <= -5e-202) tmp = Float64(Float64(2.0 / t) + -2.0); elseif (Float64(x / y) <= 1.0) tmp = Float64(Float64(2.0 / Float64(z * t)) - 2.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + ((2.0 / t) / z); tmp = 0.0; if ((x / y) <= -1e-24) tmp = t_1; elseif ((x / y) <= -5e-202) tmp = (2.0 / t) + -2.0; elseif ((x / y) <= 1.0) tmp = (2.0 / (z * t)) - 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -1e-24], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -5e-202], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.0], N[(N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-24}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-202}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{elif}\;\frac{x}{y} \leq 1:\\
\;\;\;\;\frac{2}{z \cdot t} - 2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 x y) < -9.99999999999999924e-25 or 1 < (/.f64 x y) Initial program 86.0%
Taylor expanded in z around 0 91.1%
associate-/r*91.1%
Simplified91.1%
if -9.99999999999999924e-25 < (/.f64 x y) < -4.99999999999999973e-202Initial program 79.1%
Taylor expanded in z around inf 79.1%
Taylor expanded in x around 0 79.1%
div-sub79.1%
sub-neg79.1%
*-inverses79.1%
metadata-eval79.1%
distribute-lft-in79.1%
associate-*r/79.1%
metadata-eval79.1%
metadata-eval79.1%
Simplified79.1%
if -4.99999999999999973e-202 < (/.f64 x y) < 1Initial program 80.1%
+-commutative80.1%
remove-double-neg80.1%
distribute-frac-neg80.1%
unsub-neg80.1%
*-commutative80.1%
associate-*r*80.1%
distribute-rgt1-in80.1%
associate-*r/80.1%
/-rgt-identity80.1%
fma-neg80.1%
/-rgt-identity80.1%
*-commutative80.1%
fma-def80.1%
*-commutative80.1%
distribute-frac-neg80.1%
remove-double-neg80.1%
Simplified80.1%
Taylor expanded in t around 0 99.8%
Taylor expanded in z around 0 78.5%
Final simplification86.0%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -1e-24)
(+ (/ x y) (/ (/ 2.0 z) t))
(if (<= (/ x y) -5e-202)
(+ (/ 2.0 t) -2.0)
(if (<= (/ x y) 1.0)
(- (/ 2.0 (* z t)) 2.0)
(+ (/ x y) (/ (/ 2.0 t) z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1e-24) {
tmp = (x / y) + ((2.0 / z) / t);
} else if ((x / y) <= -5e-202) {
tmp = (2.0 / t) + -2.0;
} else if ((x / y) <= 1.0) {
tmp = (2.0 / (z * t)) - 2.0;
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= (-1d-24)) then
tmp = (x / y) + ((2.0d0 / z) / t)
else if ((x / y) <= (-5d-202)) then
tmp = (2.0d0 / t) + (-2.0d0)
else if ((x / y) <= 1.0d0) then
tmp = (2.0d0 / (z * t)) - 2.0d0
else
tmp = (x / y) + ((2.0d0 / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1e-24) {
tmp = (x / y) + ((2.0 / z) / t);
} else if ((x / y) <= -5e-202) {
tmp = (2.0 / t) + -2.0;
} else if ((x / y) <= 1.0) {
tmp = (2.0 / (z * t)) - 2.0;
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1e-24: tmp = (x / y) + ((2.0 / z) / t) elif (x / y) <= -5e-202: tmp = (2.0 / t) + -2.0 elif (x / y) <= 1.0: tmp = (2.0 / (z * t)) - 2.0 else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1e-24) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / z) / t)); elseif (Float64(x / y) <= -5e-202) tmp = Float64(Float64(2.0 / t) + -2.0); elseif (Float64(x / y) <= 1.0) tmp = Float64(Float64(2.0 / Float64(z * t)) - 2.0); else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -1e-24) tmp = (x / y) + ((2.0 / z) / t); elseif ((x / y) <= -5e-202) tmp = (2.0 / t) + -2.0; elseif ((x / y) <= 1.0) tmp = (2.0 / (z * t)) - 2.0; else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1e-24], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -5e-202], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.0], N[(N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-24}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{z}}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-202}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{elif}\;\frac{x}{y} \leq 1:\\
\;\;\;\;\frac{2}{z \cdot t} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if (/.f64 x y) < -9.99999999999999924e-25Initial program 89.0%
Taylor expanded in z around 0 92.4%
associate-/l/92.4%
Simplified92.4%
if -9.99999999999999924e-25 < (/.f64 x y) < -4.99999999999999973e-202Initial program 79.1%
Taylor expanded in z around inf 79.1%
Taylor expanded in x around 0 79.1%
div-sub79.1%
sub-neg79.1%
*-inverses79.1%
metadata-eval79.1%
distribute-lft-in79.1%
associate-*r/79.1%
metadata-eval79.1%
metadata-eval79.1%
Simplified79.1%
if -4.99999999999999973e-202 < (/.f64 x y) < 1Initial program 80.1%
+-commutative80.1%
remove-double-neg80.1%
distribute-frac-neg80.1%
unsub-neg80.1%
*-commutative80.1%
associate-*r*80.1%
distribute-rgt1-in80.1%
associate-*r/80.1%
/-rgt-identity80.1%
fma-neg80.1%
/-rgt-identity80.1%
*-commutative80.1%
fma-def80.1%
*-commutative80.1%
distribute-frac-neg80.1%
remove-double-neg80.1%
Simplified80.1%
Taylor expanded in t around 0 99.8%
Taylor expanded in z around 0 78.5%
if 1 < (/.f64 x y) Initial program 82.3%
Taylor expanded in z around 0 89.5%
associate-/r*89.5%
Simplified89.5%
Final simplification86.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= (/ x y) -0.0035)
t_1
(if (<= (/ x y) 4.8e-88)
(+ (/ 2.0 t) -2.0)
(if (<= (/ x y) 4.5e-47) (/ 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.0035) {
tmp = t_1;
} else if ((x / y) <= 4.8e-88) {
tmp = (2.0 / t) + -2.0;
} else if ((x / y) <= 4.5e-47) {
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.0035d0)) then
tmp = t_1
else if ((x / y) <= 4.8d-88) then
tmp = (2.0d0 / t) + (-2.0d0)
else if ((x / y) <= 4.5d-47) 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.0035) {
tmp = t_1;
} else if ((x / y) <= 4.8e-88) {
tmp = (2.0 / t) + -2.0;
} else if ((x / y) <= 4.5e-47) {
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.0035: tmp = t_1 elif (x / y) <= 4.8e-88: tmp = (2.0 / t) + -2.0 elif (x / y) <= 4.5e-47: 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.0035) tmp = t_1; elseif (Float64(x / y) <= 4.8e-88) tmp = Float64(Float64(2.0 / t) + -2.0); elseif (Float64(x / y) <= 4.5e-47) 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.0035) tmp = t_1; elseif ((x / y) <= 4.8e-88) tmp = (2.0 / t) + -2.0; elseif ((x / y) <= 4.5e-47) 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.0035], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 4.8e-88], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 4.5e-47], 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.0035:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq 4.8 \cdot 10^{-88}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{elif}\;\frac{x}{y} \leq 4.5 \cdot 10^{-47}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 x y) < -0.00350000000000000007 or 4.5e-47 < (/.f64 x y) Initial program 84.6%
Taylor expanded in t around inf 75.8%
if -0.00350000000000000007 < (/.f64 x y) < 4.7999999999999999e-88Initial program 80.8%
Taylor expanded in z around inf 63.7%
Taylor expanded in x around 0 63.7%
div-sub63.7%
sub-neg63.7%
*-inverses63.7%
metadata-eval63.7%
distribute-lft-in63.7%
associate-*r/63.7%
metadata-eval63.7%
metadata-eval63.7%
Simplified63.7%
if 4.7999999999999999e-88 < (/.f64 x y) < 4.5e-47Initial program 99.7%
Taylor expanded in t around 0 99.5%
associate-*r/99.5%
metadata-eval99.5%
Simplified99.5%
div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in z around 0 99.7%
Final simplification71.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -0.44) (not (<= (/ x y) 180000000.0))) (/ x y) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -0.44) || !((x / y) <= 180000000.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) <= (-0.44d0)) .or. (.not. ((x / y) <= 180000000.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) <= -0.44) || !((x / y) <= 180000000.0)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -0.44) or not ((x / y) <= 180000000.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) <= -0.44) || !(Float64(x / y) <= 180000000.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) <= -0.44) || ~(((x / y) <= 180000000.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], -0.44], N[Not[LessEqual[N[(x / y), $MachinePrecision], 180000000.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 -0.44 \lor \neg \left(\frac{x}{y} \leq 180000000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -0.440000000000000002 or 1.8e8 < (/.f64 x y) Initial program 85.0%
Taylor expanded in x around inf 75.6%
if -0.440000000000000002 < (/.f64 x y) < 1.8e8Initial program 81.5%
Taylor expanded in z around inf 63.5%
Taylor expanded in x around 0 60.0%
div-sub60.0%
sub-neg60.0%
*-inverses60.0%
metadata-eval60.0%
distribute-lft-in60.0%
associate-*r/60.0%
metadata-eval60.0%
metadata-eval60.0%
Simplified60.0%
Final simplification68.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -3.7e-5) (not (<= (/ x y) 7e-26))) (- (/ x y) 2.0) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -3.7e-5) || !((x / y) <= 7e-26)) {
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) <= (-3.7d-5)) .or. (.not. ((x / y) <= 7d-26))) 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) <= -3.7e-5) || !((x / y) <= 7e-26)) {
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) <= -3.7e-5) or not ((x / y) <= 7e-26): 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) <= -3.7e-5) || !(Float64(x / y) <= 7e-26)) 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) <= -3.7e-5) || ~(((x / y) <= 7e-26))) 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], -3.7e-5], N[Not[LessEqual[N[(x / y), $MachinePrecision], 7e-26]], $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 -3.7 \cdot 10^{-5} \lor \neg \left(\frac{x}{y} \leq 7 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -3.69999999999999981e-5 or 6.9999999999999997e-26 < (/.f64 x y) Initial program 84.4%
Taylor expanded in t around inf 76.1%
if -3.69999999999999981e-5 < (/.f64 x y) < 6.9999999999999997e-26Initial program 82.2%
Taylor expanded in z around inf 61.1%
Taylor expanded in x around 0 61.1%
div-sub61.1%
sub-neg61.1%
*-inverses61.1%
metadata-eval61.1%
distribute-lft-in61.1%
associate-*r/61.1%
metadata-eval61.1%
metadata-eval61.1%
Simplified61.1%
Final simplification69.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.6e-44) (not (<= z 2.7e-19))) (- (+ (/ x y) (/ 2.0 t)) 2.0) (+ (/ x y) (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.6e-44) || !(z <= 2.7e-19)) {
tmp = ((x / y) + (2.0 / t)) - 2.0;
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2.6d-44)) .or. (.not. (z <= 2.7d-19))) then
tmp = ((x / y) + (2.0d0 / t)) - 2.0d0
else
tmp = (x / y) + ((2.0d0 / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.6e-44) || !(z <= 2.7e-19)) {
tmp = ((x / y) + (2.0 / t)) - 2.0;
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.6e-44) or not (z <= 2.7e-19): tmp = ((x / y) + (2.0 / t)) - 2.0 else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.6e-44) || !(z <= 2.7e-19)) tmp = Float64(Float64(Float64(x / y) + Float64(2.0 / t)) - 2.0); else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.6e-44) || ~((z <= 2.7e-19))) tmp = ((x / y) + (2.0 / t)) - 2.0; else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.6e-44], N[Not[LessEqual[z, 2.7e-19]], $MachinePrecision]], N[(N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-44} \lor \neg \left(z \leq 2.7 \cdot 10^{-19}\right):\\
\;\;\;\;\left(\frac{x}{y} + \frac{2}{t}\right) - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -2.5999999999999998e-44 or 2.7000000000000001e-19 < z Initial program 69.5%
+-commutative69.5%
remove-double-neg69.5%
distribute-frac-neg69.5%
unsub-neg69.5%
*-commutative69.5%
associate-*r*69.5%
distribute-rgt1-in69.5%
associate-*r/69.5%
/-rgt-identity69.5%
fma-neg69.6%
/-rgt-identity69.6%
*-commutative69.6%
fma-def69.6%
*-commutative69.6%
distribute-frac-neg69.6%
remove-double-neg69.6%
Simplified69.6%
Taylor expanded in t around 0 99.9%
Taylor expanded in z around inf 98.3%
associate-*r/98.3%
metadata-eval98.3%
+-commutative98.3%
Simplified98.3%
if -2.5999999999999998e-44 < z < 2.7000000000000001e-19Initial program 99.0%
Taylor expanded in z around 0 91.1%
associate-/r*91.1%
Simplified91.1%
Final simplification94.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.8e-23) (not (<= t 2.1e-12))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.8e-23) || !(t <= 2.1e-12)) {
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 <= (-5.8d-23)) .or. (.not. (t <= 2.1d-12))) 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 <= -5.8e-23) || !(t <= 2.1e-12)) {
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 <= -5.8e-23) or not (t <= 2.1e-12): 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 <= -5.8e-23) || !(t <= 2.1e-12)) 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 <= -5.8e-23) || ~((t <= 2.1e-12))) 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, -5.8e-23], N[Not[LessEqual[t, 2.1e-12]], $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 -5.8 \cdot 10^{-23} \lor \neg \left(t \leq 2.1 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -5.8000000000000003e-23 or 2.09999999999999994e-12 < t Initial program 71.5%
Taylor expanded in t around inf 84.9%
if -5.8000000000000003e-23 < t < 2.09999999999999994e-12Initial program 98.9%
Taylor expanded in t around 0 75.8%
associate-*r/75.8%
metadata-eval75.8%
Simplified75.8%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (if (<= t -3.6e+19) -2.0 (if (<= t 4.8) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.6e+19) {
tmp = -2.0;
} else if (t <= 4.8) {
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 <= (-3.6d+19)) then
tmp = -2.0d0
else if (t <= 4.8d0) 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 <= -3.6e+19) {
tmp = -2.0;
} else if (t <= 4.8) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.6e+19: tmp = -2.0 elif t <= 4.8: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.6e+19) tmp = -2.0; elseif (t <= 4.8) 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 <= -3.6e+19) tmp = -2.0; elseif (t <= 4.8) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.6e+19], -2.0, If[LessEqual[t, 4.8], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+19}:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 4.8:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -3.6e19 or 4.79999999999999982 < t Initial program 68.2%
Taylor expanded in t around inf 86.6%
Taylor expanded in x around 0 32.4%
if -3.6e19 < t < 4.79999999999999982Initial program 99.0%
Taylor expanded in t around 0 70.2%
associate-*r/70.2%
metadata-eval70.2%
Simplified70.2%
Taylor expanded in z around inf 29.8%
Final simplification31.1%
(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 83.5%
Taylor expanded in t around inf 59.2%
Taylor expanded in x around 0 17.5%
Final simplification17.5%
(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 2023322
(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))))