
(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 14 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 (/ (+ 1.0 z) (* z t)))) -2.0))
double code(double x, double y, double z, double t) {
return fma(x, (1.0 / y), (2.0 * ((1.0 + z) / (z * t)))) + -2.0;
}
function code(x, y, z, t) return Float64(fma(x, Float64(1.0 / y), Float64(2.0 * Float64(Float64(1.0 + z) / Float64(z * t)))) + -2.0) end
code[x_, y_, z_, t_] := N[(N[(x * N[(1.0 / y), $MachinePrecision] + N[(2.0 * N[(N[(1.0 + z), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \frac{1}{y}, 2 \cdot \frac{1 + z}{z \cdot t}\right) + -2
\end{array}
Initial program 87.4%
+-commutative87.4%
remove-double-neg87.4%
distribute-frac-neg87.4%
unsub-neg87.4%
*-commutative87.4%
associate-*r*87.4%
distribute-rgt1-in87.4%
associate-*r/87.4%
/-rgt-identity87.4%
fma-neg87.4%
/-rgt-identity87.4%
*-commutative87.4%
fma-def87.4%
*-commutative87.4%
distribute-frac-neg87.4%
remove-double-neg87.4%
Simplified87.4%
Taylor expanded in t around 0 98.7%
+-commutative98.7%
div-inv98.6%
fma-def99.4%
*-commutative99.4%
*-commutative99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ 2.0 (* z t)) -2.0)))
(if (<= (/ x y) -6.1e+81)
(/ x y)
(if (<= (/ x y) -6.2e-121)
t_1
(if (<= (/ x y) -1.72e-184)
(+ (/ 2.0 t) -2.0)
(if (<= (/ x y) 86000000.0) t_1 (+ (/ x y) -2.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (2.0 / (z * t)) + -2.0;
double tmp;
if ((x / y) <= -6.1e+81) {
tmp = x / y;
} else if ((x / y) <= -6.2e-121) {
tmp = t_1;
} else if ((x / y) <= -1.72e-184) {
tmp = (2.0 / t) + -2.0;
} else if ((x / y) <= 86000000.0) {
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 / (z * t)) + (-2.0d0)
if ((x / y) <= (-6.1d+81)) then
tmp = x / y
else if ((x / y) <= (-6.2d-121)) then
tmp = t_1
else if ((x / y) <= (-1.72d-184)) then
tmp = (2.0d0 / t) + (-2.0d0)
else if ((x / y) <= 86000000.0d0) 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 / (z * t)) + -2.0;
double tmp;
if ((x / y) <= -6.1e+81) {
tmp = x / y;
} else if ((x / y) <= -6.2e-121) {
tmp = t_1;
} else if ((x / y) <= -1.72e-184) {
tmp = (2.0 / t) + -2.0;
} else if ((x / y) <= 86000000.0) {
tmp = t_1;
} else {
tmp = (x / y) + -2.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 / (z * t)) + -2.0 tmp = 0 if (x / y) <= -6.1e+81: tmp = x / y elif (x / y) <= -6.2e-121: tmp = t_1 elif (x / y) <= -1.72e-184: tmp = (2.0 / t) + -2.0 elif (x / y) <= 86000000.0: tmp = t_1 else: tmp = (x / y) + -2.0 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(2.0 / Float64(z * t)) + -2.0) tmp = 0.0 if (Float64(x / y) <= -6.1e+81) tmp = Float64(x / y); elseif (Float64(x / y) <= -6.2e-121) tmp = t_1; elseif (Float64(x / y) <= -1.72e-184) tmp = Float64(Float64(2.0 / t) + -2.0); elseif (Float64(x / y) <= 86000000.0) 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 / (z * t)) + -2.0; tmp = 0.0; if ((x / y) <= -6.1e+81) tmp = x / y; elseif ((x / y) <= -6.2e-121) tmp = t_1; elseif ((x / y) <= -1.72e-184) tmp = (2.0 / t) + -2.0; elseif ((x / y) <= 86000000.0) tmp = t_1; else tmp = (x / y) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -6.1e+81], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -6.2e-121], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -1.72e-184], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 86000000.0], t$95$1, N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2}{z \cdot t} + -2\\
\mathbf{if}\;\frac{x}{y} \leq -6.1 \cdot 10^{+81}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -6.2 \cdot 10^{-121}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq -1.72 \cdot 10^{-184}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{elif}\;\frac{x}{y} \leq 86000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -6.10000000000000038e81Initial program 69.8%
Taylor expanded in x around inf 76.4%
if -6.10000000000000038e81 < (/.f64 x y) < -6.1999999999999997e-121 or -1.72e-184 < (/.f64 x y) < 8.6e7Initial program 93.3%
+-commutative93.3%
remove-double-neg93.3%
distribute-frac-neg93.3%
unsub-neg93.3%
*-commutative93.3%
associate-*r*93.3%
distribute-rgt1-in93.3%
associate-*r/93.3%
/-rgt-identity93.3%
fma-neg93.3%
/-rgt-identity93.3%
*-commutative93.3%
fma-def93.3%
*-commutative93.3%
distribute-frac-neg93.3%
remove-double-neg93.3%
Simplified93.3%
Taylor expanded in t around 0 99.8%
Taylor expanded in z around 0 71.1%
if -6.1999999999999997e-121 < (/.f64 x y) < -1.72e-184Initial program 81.2%
+-commutative81.2%
remove-double-neg81.2%
distribute-frac-neg81.2%
unsub-neg81.2%
*-commutative81.2%
associate-*r*81.2%
distribute-rgt1-in81.2%
associate-*r/81.1%
/-rgt-identity81.1%
fma-neg81.1%
/-rgt-identity81.1%
*-commutative81.1%
fma-def81.1%
*-commutative81.1%
distribute-frac-neg81.1%
remove-double-neg81.1%
Simplified81.1%
Taylor expanded in t around 0 99.9%
Taylor expanded in z around inf 85.2%
associate-*r/85.2%
metadata-eval85.2%
+-commutative85.2%
Simplified85.2%
Taylor expanded in x around 0 85.2%
sub-neg85.2%
associate-*r/85.2%
metadata-eval85.2%
metadata-eval85.2%
Simplified85.2%
if 8.6e7 < (/.f64 x y) Initial program 92.0%
Taylor expanded in t around inf 70.8%
Final simplification73.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (/ 2.0 t) z)) (t_2 (+ (/ x y) t_1)) (t_3 (+ (/ x y) -2.0)))
(if (<= t -2.5e+111)
t_3
(if (<= t -4.5e-35)
t_2
(if (<= t 1.25e-80) (+ (/ 2.0 t) t_1) (if (<= t 3e+158) t_2 t_3))))))
double code(double x, double y, double z, double t) {
double t_1 = (2.0 / t) / z;
double t_2 = (x / y) + t_1;
double t_3 = (x / y) + -2.0;
double tmp;
if (t <= -2.5e+111) {
tmp = t_3;
} else if (t <= -4.5e-35) {
tmp = t_2;
} else if (t <= 1.25e-80) {
tmp = (2.0 / t) + t_1;
} else if (t <= 3e+158) {
tmp = t_2;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = (2.0d0 / t) / z
t_2 = (x / y) + t_1
t_3 = (x / y) + (-2.0d0)
if (t <= (-2.5d+111)) then
tmp = t_3
else if (t <= (-4.5d-35)) then
tmp = t_2
else if (t <= 1.25d-80) then
tmp = (2.0d0 / t) + t_1
else if (t <= 3d+158) then
tmp = t_2
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (2.0 / t) / z;
double t_2 = (x / y) + t_1;
double t_3 = (x / y) + -2.0;
double tmp;
if (t <= -2.5e+111) {
tmp = t_3;
} else if (t <= -4.5e-35) {
tmp = t_2;
} else if (t <= 1.25e-80) {
tmp = (2.0 / t) + t_1;
} else if (t <= 3e+158) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 / t) / z t_2 = (x / y) + t_1 t_3 = (x / y) + -2.0 tmp = 0 if t <= -2.5e+111: tmp = t_3 elif t <= -4.5e-35: tmp = t_2 elif t <= 1.25e-80: tmp = (2.0 / t) + t_1 elif t <= 3e+158: tmp = t_2 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(2.0 / t) / z) t_2 = Float64(Float64(x / y) + t_1) t_3 = Float64(Float64(x / y) + -2.0) tmp = 0.0 if (t <= -2.5e+111) tmp = t_3; elseif (t <= -4.5e-35) tmp = t_2; elseif (t <= 1.25e-80) tmp = Float64(Float64(2.0 / t) + t_1); elseif (t <= 3e+158) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (2.0 / t) / z; t_2 = (x / y) + t_1; t_3 = (x / y) + -2.0; tmp = 0.0; if (t <= -2.5e+111) tmp = t_3; elseif (t <= -4.5e-35) tmp = t_2; elseif (t <= 1.25e-80) tmp = (2.0 / t) + t_1; elseif (t <= 3e+158) tmp = t_2; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision]}, If[LessEqual[t, -2.5e+111], t$95$3, If[LessEqual[t, -4.5e-35], t$95$2, If[LessEqual[t, 1.25e-80], N[(N[(2.0 / t), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[t, 3e+158], t$95$2, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{2}{t}}{z}\\
t_2 := \frac{x}{y} + t_1\\
t_3 := \frac{x}{y} + -2\\
\mathbf{if}\;t \leq -2.5 \cdot 10^{+111}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq -4.5 \cdot 10^{-35}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{-80}:\\
\;\;\;\;\frac{2}{t} + t_1\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+158}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if t < -2.4999999999999998e111 or 3e158 < t Initial program 70.2%
Taylor expanded in t around inf 89.4%
if -2.4999999999999998e111 < t < -4.5000000000000001e-35 or 1.25e-80 < t < 3e158Initial program 90.8%
Taylor expanded in z around 0 84.0%
associate-/r*84.1%
Simplified84.1%
if -4.5000000000000001e-35 < t < 1.25e-80Initial program 96.9%
Taylor expanded in t around 0 87.0%
associate-*r/87.0%
metadata-eval87.0%
Simplified87.0%
Taylor expanded in z around 0 87.0%
associate-*r/87.0%
metadata-eval87.0%
associate-*r/87.0%
metadata-eval87.0%
associate-/r*87.0%
Simplified87.0%
Final simplification86.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+25) (not (<= (/ x y) 500000000000.0))) (+ (/ x y) (/ (/ 2.0 t) z)) (+ (/ (+ 2.0 (/ 2.0 z)) t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+25) || !((x / y) <= 500000000000.0)) {
tmp = (x / y) + ((2.0 / t) / z);
} else {
tmp = ((2.0 + (2.0 / z)) / t) + -2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-5d+25)) .or. (.not. ((x / y) <= 500000000000.0d0))) then
tmp = (x / y) + ((2.0d0 / t) / z)
else
tmp = ((2.0d0 + (2.0d0 / z)) / t) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+25) || !((x / y) <= 500000000000.0)) {
tmp = (x / y) + ((2.0 / t) / z);
} else {
tmp = ((2.0 + (2.0 / z)) / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+25) or not ((x / y) <= 500000000000.0): tmp = (x / y) + ((2.0 / t) / z) else: tmp = ((2.0 + (2.0 / z)) / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+25) || !(Float64(x / y) <= 500000000000.0)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z)); else tmp = Float64(Float64(Float64(2.0 + Float64(2.0 / z)) / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e+25) || ~(((x / y) <= 500000000000.0))) tmp = (x / y) + ((2.0 / t) / z); else tmp = ((2.0 + (2.0 / z)) / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+25], N[Not[LessEqual[N[(x / y), $MachinePrecision], 500000000000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+25} \lor \neg \left(\frac{x}{y} \leq 500000000000\right):\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000024e25 or 5e11 < (/.f64 x y) Initial program 82.8%
Taylor expanded in z around 0 88.8%
associate-/r*88.7%
Simplified88.7%
if -5.00000000000000024e25 < (/.f64 x y) < 5e11Initial program 91.9%
+-commutative91.9%
remove-double-neg91.9%
distribute-frac-neg91.9%
unsub-neg91.9%
*-commutative91.9%
associate-*r*91.9%
distribute-rgt1-in91.9%
associate-*r/91.9%
/-rgt-identity91.9%
fma-neg91.9%
/-rgt-identity91.9%
*-commutative91.9%
fma-def91.9%
*-commutative91.9%
distribute-frac-neg91.9%
remove-double-neg91.9%
Simplified91.9%
Taylor expanded in t around 0 99.8%
+-commutative99.8%
div-inv99.8%
fma-def99.8%
*-commutative99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 97.9%
*-commutative97.9%
associate-/l/97.9%
associate-*l/97.9%
*-lft-identity97.9%
associate-*l/97.8%
distribute-rgt-in97.8%
*-lft-identity97.8%
rgt-mult-inverse97.9%
distribute-rgt1-in97.9%
*-commutative97.9%
associate-*r/97.9%
metadata-eval97.9%
Simplified97.9%
Final simplification93.3%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -5.7e+23)
(/ x y)
(if (<= (/ x y) 1.42e-295)
(/ 2.0 t)
(if (<= (/ x y) 3400000.0) -2.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5.7e+23) {
tmp = x / y;
} else if ((x / y) <= 1.42e-295) {
tmp = 2.0 / t;
} else if ((x / y) <= 3400000.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) <= (-5.7d+23)) then
tmp = x / y
else if ((x / y) <= 1.42d-295) then
tmp = 2.0d0 / t
else if ((x / y) <= 3400000.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) <= -5.7e+23) {
tmp = x / y;
} else if ((x / y) <= 1.42e-295) {
tmp = 2.0 / t;
} else if ((x / y) <= 3400000.0) {
tmp = -2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5.7e+23: tmp = x / y elif (x / y) <= 1.42e-295: tmp = 2.0 / t elif (x / y) <= 3400000.0: tmp = -2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5.7e+23) tmp = Float64(x / y); elseif (Float64(x / y) <= 1.42e-295) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= 3400000.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) <= -5.7e+23) tmp = x / y; elseif ((x / y) <= 1.42e-295) tmp = 2.0 / t; elseif ((x / y) <= 3400000.0) tmp = -2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5.7e+23], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.42e-295], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 3400000.0], -2.0, N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5.7 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 1.42 \cdot 10^{-295}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 3400000:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.7e23 or 3.4e6 < (/.f64 x y) Initial program 83.2%
Taylor expanded in x around inf 68.7%
if -5.7e23 < (/.f64 x y) < 1.42000000000000005e-295Initial program 92.3%
Taylor expanded in t around 0 72.5%
associate-*r/72.5%
metadata-eval72.5%
Simplified72.5%
Taylor expanded in z around inf 31.5%
if 1.42000000000000005e-295 < (/.f64 x y) < 3.4e6Initial program 90.2%
+-commutative90.2%
remove-double-neg90.2%
distribute-frac-neg90.2%
unsub-neg90.2%
*-commutative90.2%
associate-*r*90.2%
distribute-rgt1-in90.2%
associate-*r/90.1%
/-rgt-identity90.1%
fma-neg90.1%
/-rgt-identity90.1%
*-commutative90.1%
fma-def90.1%
*-commutative90.1%
distribute-frac-neg90.1%
remove-double-neg90.1%
Simplified90.1%
Taylor expanded in x around 0 88.3%
Taylor expanded in t around inf 33.2%
Final simplification50.7%
(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 87.4%
+-commutative87.4%
remove-double-neg87.4%
distribute-frac-neg87.4%
unsub-neg87.4%
*-commutative87.4%
associate-*r*87.4%
distribute-rgt1-in87.4%
associate-*r/87.4%
/-rgt-identity87.4%
fma-neg87.4%
/-rgt-identity87.4%
*-commutative87.4%
fma-def87.4%
*-commutative87.4%
distribute-frac-neg87.4%
remove-double-neg87.4%
Simplified87.4%
Taylor expanded in t around 0 98.7%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5.7e+23) (not (<= (/ x y) 126000000000.0))) (/ x y) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5.7e+23) || !((x / y) <= 126000000000.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) <= (-5.7d+23)) .or. (.not. ((x / y) <= 126000000000.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) <= -5.7e+23) || !((x / y) <= 126000000000.0)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5.7e+23) or not ((x / y) <= 126000000000.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) <= -5.7e+23) || !(Float64(x / y) <= 126000000000.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) <= -5.7e+23) || ~(((x / y) <= 126000000000.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], -5.7e+23], N[Not[LessEqual[N[(x / y), $MachinePrecision], 126000000000.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 -5.7 \cdot 10^{+23} \lor \neg \left(\frac{x}{y} \leq 126000000000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -5.7e23 or 1.26e11 < (/.f64 x y) Initial program 83.2%
Taylor expanded in x around inf 68.7%
if -5.7e23 < (/.f64 x y) < 1.26e11Initial program 91.8%
+-commutative91.8%
remove-double-neg91.8%
distribute-frac-neg91.8%
unsub-neg91.8%
*-commutative91.8%
associate-*r*91.8%
distribute-rgt1-in91.8%
associate-*r/91.8%
/-rgt-identity91.8%
fma-neg91.8%
/-rgt-identity91.8%
*-commutative91.8%
fma-def91.8%
*-commutative91.8%
distribute-frac-neg91.8%
remove-double-neg91.8%
Simplified91.8%
Taylor expanded in t around 0 99.8%
Taylor expanded in z around inf 56.4%
associate-*r/56.4%
metadata-eval56.4%
+-commutative56.4%
Simplified56.4%
Taylor expanded in x around 0 55.2%
sub-neg55.2%
associate-*r/55.2%
metadata-eval55.2%
metadata-eval55.2%
Simplified55.2%
Final simplification62.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9.5e-33) (not (<= t 1.8e+43))) (+ (/ x y) -2.0) (+ (/ 2.0 t) (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.5e-33) || !(t <= 1.8e+43)) {
tmp = (x / y) + -2.0;
} else {
tmp = (2.0 / t) + ((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 ((t <= (-9.5d-33)) .or. (.not. (t <= 1.8d+43))) then
tmp = (x / y) + (-2.0d0)
else
tmp = (2.0d0 / t) + ((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 ((t <= -9.5e-33) || !(t <= 1.8e+43)) {
tmp = (x / y) + -2.0;
} else {
tmp = (2.0 / t) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9.5e-33) or not (t <= 1.8e+43): tmp = (x / y) + -2.0 else: tmp = (2.0 / t) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9.5e-33) || !(t <= 1.8e+43)) tmp = Float64(Float64(x / y) + -2.0); else tmp = Float64(Float64(2.0 / t) + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9.5e-33) || ~((t <= 1.8e+43))) tmp = (x / y) + -2.0; else tmp = (2.0 / t) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9.5e-33], N[Not[LessEqual[t, 1.8e+43]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{-33} \lor \neg \left(t \leq 1.8 \cdot 10^{+43}\right):\\
\;\;\;\;\frac{x}{y} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if t < -9.50000000000000019e-33 or 1.80000000000000005e43 < t Initial program 76.5%
Taylor expanded in t around inf 81.3%
if -9.50000000000000019e-33 < t < 1.80000000000000005e43Initial program 97.5%
Taylor expanded in t around 0 82.0%
associate-*r/82.0%
metadata-eval82.0%
Simplified82.0%
Taylor expanded in z around 0 82.1%
associate-*r/82.1%
metadata-eval82.1%
associate-*r/82.1%
metadata-eval82.1%
associate-/r*82.0%
Simplified82.0%
Final simplification81.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.12e-48) (not (<= z 4.2e-21))) (+ (+ (/ 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 <= -1.12e-48) || !(z <= 4.2e-21)) {
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 <= (-1.12d-48)) .or. (.not. (z <= 4.2d-21))) 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 <= -1.12e-48) || !(z <= 4.2e-21)) {
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 <= -1.12e-48) or not (z <= 4.2e-21): 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 <= -1.12e-48) || !(z <= 4.2e-21)) 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 <= -1.12e-48) || ~((z <= 4.2e-21))) 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, -1.12e-48], N[Not[LessEqual[z, 4.2e-21]], $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 -1.12 \cdot 10^{-48} \lor \neg \left(z \leq 4.2 \cdot 10^{-21}\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 < -1.11999999999999999e-48 or 4.20000000000000025e-21 < z Initial program 77.6%
+-commutative77.6%
remove-double-neg77.6%
distribute-frac-neg77.6%
unsub-neg77.6%
*-commutative77.6%
associate-*r*77.6%
distribute-rgt1-in77.6%
associate-*r/77.5%
/-rgt-identity77.5%
fma-neg77.5%
/-rgt-identity77.5%
*-commutative77.5%
fma-def77.5%
*-commutative77.5%
distribute-frac-neg77.5%
remove-double-neg77.5%
Simplified77.5%
Taylor expanded in t around 0 99.9%
Taylor expanded in z around inf 95.6%
associate-*r/95.6%
metadata-eval95.6%
+-commutative95.6%
Simplified95.6%
if -1.11999999999999999e-48 < z < 4.20000000000000025e-21Initial program 97.5%
Taylor expanded in z around 0 88.8%
associate-/r*88.7%
Simplified88.7%
Final simplification92.2%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -7.8e+23) (/ x y) (if (<= (/ x y) 2.1e-5) (+ (/ 2.0 t) -2.0) (+ (/ x y) -2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -7.8e+23) {
tmp = x / y;
} else if ((x / y) <= 2.1e-5) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = (x / y) + -2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= (-7.8d+23)) then
tmp = x / y
else if ((x / y) <= 2.1d-5) then
tmp = (2.0d0 / t) + (-2.0d0)
else
tmp = (x / y) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -7.8e+23) {
tmp = x / y;
} else if ((x / y) <= 2.1e-5) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = (x / y) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -7.8e+23: tmp = x / y elif (x / y) <= 2.1e-5: tmp = (2.0 / t) + -2.0 else: tmp = (x / y) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -7.8e+23) tmp = Float64(x / y); elseif (Float64(x / y) <= 2.1e-5) tmp = Float64(Float64(2.0 / t) + -2.0); else tmp = Float64(Float64(x / y) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -7.8e+23) tmp = x / y; elseif ((x / y) <= 2.1e-5) tmp = (2.0 / t) + -2.0; else tmp = (x / y) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -7.8e+23], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.1e-5], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -7.8 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2.1 \cdot 10^{-5}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -7.8000000000000001e23Initial program 75.0%
Taylor expanded in x around inf 67.2%
if -7.8000000000000001e23 < (/.f64 x y) < 2.09999999999999988e-5Initial program 91.6%
+-commutative91.6%
remove-double-neg91.6%
distribute-frac-neg91.6%
unsub-neg91.6%
*-commutative91.6%
associate-*r*91.6%
distribute-rgt1-in91.6%
associate-*r/91.6%
/-rgt-identity91.6%
fma-neg91.6%
/-rgt-identity91.6%
*-commutative91.6%
fma-def91.6%
*-commutative91.6%
distribute-frac-neg91.6%
remove-double-neg91.6%
Simplified91.6%
Taylor expanded in t around 0 99.8%
Taylor expanded in z around inf 56.4%
associate-*r/56.4%
metadata-eval56.4%
+-commutative56.4%
Simplified56.4%
Taylor expanded in x around 0 55.7%
sub-neg55.7%
associate-*r/55.7%
metadata-eval55.7%
metadata-eval55.7%
Simplified55.7%
if 2.09999999999999988e-5 < (/.f64 x y) Initial program 92.2%
Taylor expanded in t around inf 70.2%
Final simplification62.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ x y) -2.0)))
(if (<= z -4.2e+84)
t_1
(if (<= z -0.185)
(+ (/ 2.0 t) -2.0)
(if (<= z 4.2e-111) (/ 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 (z <= -4.2e+84) {
tmp = t_1;
} else if (z <= -0.185) {
tmp = (2.0 / t) + -2.0;
} else if (z <= 4.2e-111) {
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 (z <= (-4.2d+84)) then
tmp = t_1
else if (z <= (-0.185d0)) then
tmp = (2.0d0 / t) + (-2.0d0)
else if (z <= 4.2d-111) 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 (z <= -4.2e+84) {
tmp = t_1;
} else if (z <= -0.185) {
tmp = (2.0 / t) + -2.0;
} else if (z <= 4.2e-111) {
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 z <= -4.2e+84: tmp = t_1 elif z <= -0.185: tmp = (2.0 / t) + -2.0 elif z <= 4.2e-111: 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 (z <= -4.2e+84) tmp = t_1; elseif (z <= -0.185) tmp = Float64(Float64(2.0 / t) + -2.0); elseif (z <= 4.2e-111) 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 (z <= -4.2e+84) tmp = t_1; elseif (z <= -0.185) tmp = (2.0 / t) + -2.0; elseif (z <= 4.2e-111) 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[z, -4.2e+84], t$95$1, If[LessEqual[z, -0.185], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[LessEqual[z, 4.2e-111], 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}\;z \leq -4.2 \cdot 10^{+84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -0.185:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-111}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -4.20000000000000037e84 or 4.1999999999999997e-111 < z Initial program 77.2%
Taylor expanded in t around inf 66.4%
if -4.20000000000000037e84 < z < -0.185Initial program 91.6%
+-commutative91.6%
remove-double-neg91.6%
distribute-frac-neg91.6%
unsub-neg91.6%
*-commutative91.6%
associate-*r*91.6%
distribute-rgt1-in91.6%
associate-*r/91.5%
/-rgt-identity91.5%
fma-neg91.5%
/-rgt-identity91.5%
*-commutative91.5%
fma-def91.5%
*-commutative91.5%
distribute-frac-neg91.5%
remove-double-neg91.5%
Simplified91.5%
Taylor expanded in t around 0 99.9%
Taylor expanded in z around inf 94.6%
associate-*r/94.6%
metadata-eval94.6%
+-commutative94.6%
Simplified94.6%
Taylor expanded in x around 0 70.3%
sub-neg70.3%
associate-*r/70.3%
metadata-eval70.3%
metadata-eval70.3%
Simplified70.3%
if -0.185 < z < 4.1999999999999997e-111Initial program 97.2%
Taylor expanded in z around 0 88.4%
associate-/r*88.3%
Simplified88.3%
+-commutative88.3%
frac-add79.9%
Applied egg-rr79.9%
Taylor expanded in t around 0 66.8%
Final simplification67.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.25e-33) (not (<= t 1.4e+41))) (+ (/ x y) -2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.25e-33) || !(t <= 1.4e+41)) {
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 <= (-2.25d-33)) .or. (.not. (t <= 1.4d+41))) 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 <= -2.25e-33) || !(t <= 1.4e+41)) {
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 <= -2.25e-33) or not (t <= 1.4e+41): 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 <= -2.25e-33) || !(t <= 1.4e+41)) 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 <= -2.25e-33) || ~((t <= 1.4e+41))) 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, -2.25e-33], N[Not[LessEqual[t, 1.4e+41]], $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 -2.25 \cdot 10^{-33} \lor \neg \left(t \leq 1.4 \cdot 10^{+41}\right):\\
\;\;\;\;\frac{x}{y} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -2.24999999999999995e-33 or 1.4e41 < t Initial program 76.5%
Taylor expanded in t around inf 81.3%
if -2.24999999999999995e-33 < t < 1.4e41Initial program 97.5%
Taylor expanded in t around 0 82.0%
associate-*r/82.0%
metadata-eval82.0%
Simplified82.0%
Final simplification81.7%
(FPCore (x y z t) :precision binary64 (if (<= t -1.12e-32) -2.0 (if (<= t 0.245) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.12e-32) {
tmp = -2.0;
} else if (t <= 0.245) {
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.12d-32)) then
tmp = -2.0d0
else if (t <= 0.245d0) 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.12e-32) {
tmp = -2.0;
} else if (t <= 0.245) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.12e-32: tmp = -2.0 elif t <= 0.245: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.12e-32) tmp = -2.0; elseif (t <= 0.245) 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.12e-32) tmp = -2.0; elseif (t <= 0.245) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.12e-32], -2.0, If[LessEqual[t, 0.245], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.12 \cdot 10^{-32}:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 0.245:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1.12e-32 or 0.245 < t Initial program 78.7%
+-commutative78.7%
remove-double-neg78.7%
distribute-frac-neg78.7%
unsub-neg78.7%
*-commutative78.7%
associate-*r*78.7%
distribute-rgt1-in78.7%
associate-*r/78.7%
/-rgt-identity78.7%
fma-neg78.7%
/-rgt-identity78.7%
*-commutative78.7%
fma-def78.7%
*-commutative78.7%
distribute-frac-neg78.7%
remove-double-neg78.7%
Simplified78.7%
Taylor expanded in x around 0 41.6%
Taylor expanded in t around inf 26.1%
if -1.12e-32 < t < 0.245Initial program 97.3%
Taylor expanded in t around 0 84.3%
associate-*r/84.3%
metadata-eval84.3%
Simplified84.3%
Taylor expanded in z around inf 38.2%
Final simplification31.7%
(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 87.4%
+-commutative87.4%
remove-double-neg87.4%
distribute-frac-neg87.4%
unsub-neg87.4%
*-commutative87.4%
associate-*r*87.4%
distribute-rgt1-in87.4%
associate-*r/87.4%
/-rgt-identity87.4%
fma-neg87.4%
/-rgt-identity87.4%
*-commutative87.4%
fma-def87.4%
*-commutative87.4%
distribute-frac-neg87.4%
remove-double-neg87.4%
Simplified87.4%
Taylor expanded in x around 0 61.4%
Taylor expanded in t around inf 15.0%
Final simplification15.0%
(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 2024010
(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))))