
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - ((z * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - ((z * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* a 2.0) -2e-20) (- (* 0.5 (* y (/ x a))) (* (/ z a) (/ (* 9.0 t) 2.0))) (/ (- (* y x) (* z (* 9.0 t))) (* a 2.0))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= -2e-20) {
tmp = (0.5 * (y * (x / a))) - ((z / a) * ((9.0 * t) / 2.0));
} else {
tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a * 2.0d0) <= (-2d-20)) then
tmp = (0.5d0 * (y * (x / a))) - ((z / a) * ((9.0d0 * t) / 2.0d0))
else
tmp = ((y * x) - (z * (9.0d0 * t))) / (a * 2.0d0)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= -2e-20) {
tmp = (0.5 * (y * (x / a))) - ((z / a) * ((9.0 * t) / 2.0));
} else {
tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (a * 2.0) <= -2e-20: tmp = (0.5 * (y * (x / a))) - ((z / a) * ((9.0 * t) / 2.0)) else: tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= -2e-20) tmp = Float64(Float64(0.5 * Float64(y * Float64(x / a))) - Float64(Float64(z / a) * Float64(Float64(9.0 * t) / 2.0))); else tmp = Float64(Float64(Float64(y * x) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((a * 2.0) <= -2e-20)
tmp = (0.5 * (y * (x / a))) - ((z / a) * ((9.0 * t) / 2.0));
else
tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -2e-20], N[(N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z / a), $MachinePrecision] * N[(N[(9.0 * t), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * x), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -2 \cdot 10^{-20}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right) - \frac{z}{a} \cdot \frac{9 \cdot t}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 a 2) < -1.99999999999999989e-20Initial program 82.6%
associate-*l*82.6%
Simplified82.6%
div-sub82.6%
div-inv82.4%
*-commutative82.4%
associate-/r*82.4%
metadata-eval82.4%
times-frac88.2%
Applied egg-rr88.2%
Taylor expanded in x around 0 88.3%
*-commutative88.3%
associate-*r/94.7%
Simplified94.7%
if -1.99999999999999989e-20 < (*.f64 a 2) Initial program 97.0%
associate-*l*97.0%
Simplified97.0%
Final simplification96.2%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* y x) -1e+47)
(* 0.5 (/ x (/ a y)))
(if (<= (* y x) 5e-34)
(* -4.5 (/ z (/ a t)))
(if (<= (* y x) 0.05)
(/ (* y x) (* a 2.0))
(if (<= (* y x) 1e+53) (* -4.5 (/ t (/ a z))) (/ y (* 2.0 (/ a x))))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= -1e+47) {
tmp = 0.5 * (x / (a / y));
} else if ((y * x) <= 5e-34) {
tmp = -4.5 * (z / (a / t));
} else if ((y * x) <= 0.05) {
tmp = (y * x) / (a * 2.0);
} else if ((y * x) <= 1e+53) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = y / (2.0 * (a / x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y * x) <= (-1d+47)) then
tmp = 0.5d0 * (x / (a / y))
else if ((y * x) <= 5d-34) then
tmp = (-4.5d0) * (z / (a / t))
else if ((y * x) <= 0.05d0) then
tmp = (y * x) / (a * 2.0d0)
else if ((y * x) <= 1d+53) then
tmp = (-4.5d0) * (t / (a / z))
else
tmp = y / (2.0d0 * (a / x))
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= -1e+47) {
tmp = 0.5 * (x / (a / y));
} else if ((y * x) <= 5e-34) {
tmp = -4.5 * (z / (a / t));
} else if ((y * x) <= 0.05) {
tmp = (y * x) / (a * 2.0);
} else if ((y * x) <= 1e+53) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = y / (2.0 * (a / x));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (y * x) <= -1e+47: tmp = 0.5 * (x / (a / y)) elif (y * x) <= 5e-34: tmp = -4.5 * (z / (a / t)) elif (y * x) <= 0.05: tmp = (y * x) / (a * 2.0) elif (y * x) <= 1e+53: tmp = -4.5 * (t / (a / z)) else: tmp = y / (2.0 * (a / x)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(y * x) <= -1e+47) tmp = Float64(0.5 * Float64(x / Float64(a / y))); elseif (Float64(y * x) <= 5e-34) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); elseif (Float64(y * x) <= 0.05) tmp = Float64(Float64(y * x) / Float64(a * 2.0)); elseif (Float64(y * x) <= 1e+53) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); else tmp = Float64(y / Float64(2.0 * Float64(a / x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((y * x) <= -1e+47)
tmp = 0.5 * (x / (a / y));
elseif ((y * x) <= 5e-34)
tmp = -4.5 * (z / (a / t));
elseif ((y * x) <= 0.05)
tmp = (y * x) / (a * 2.0);
elseif ((y * x) <= 1e+53)
tmp = -4.5 * (t / (a / z));
else
tmp = y / (2.0 * (a / x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(y * x), $MachinePrecision], -1e+47], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 5e-34], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 0.05], N[(N[(y * x), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 1e+53], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(2.0 * N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -1 \cdot 10^{+47}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;y \cdot x \leq 5 \cdot 10^{-34}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{elif}\;y \cdot x \leq 0.05:\\
\;\;\;\;\frac{y \cdot x}{a \cdot 2}\\
\mathbf{elif}\;y \cdot x \leq 10^{+53}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{2 \cdot \frac{a}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1e47Initial program 89.4%
associate-*l*89.3%
Simplified89.3%
Taylor expanded in x around inf 77.0%
associate-/l*80.6%
Simplified80.6%
if -1e47 < (*.f64 x y) < 5.0000000000000003e-34Initial program 94.5%
associate-*l*94.5%
Simplified94.5%
div-sub94.5%
div-inv94.4%
*-commutative94.4%
associate-/r*94.4%
metadata-eval94.4%
times-frac95.0%
Applied egg-rr95.0%
Taylor expanded in x around 0 75.0%
*-commutative75.0%
associate-/l*73.8%
Simplified73.8%
if 5.0000000000000003e-34 < (*.f64 x y) < 0.050000000000000003Initial program 99.4%
associate-*l*99.4%
Simplified99.4%
Taylor expanded in x around inf 76.6%
if 0.050000000000000003 < (*.f64 x y) < 9.9999999999999999e52Initial program 99.8%
associate-*l*99.5%
Simplified99.5%
Taylor expanded in x around 0 68.2%
associate-/l*68.2%
Simplified68.2%
if 9.9999999999999999e52 < (*.f64 x y) Initial program 88.1%
associate-*l*88.1%
Simplified88.1%
Taylor expanded in x around inf 79.2%
associate-/l*84.1%
associate-/r/84.5%
Simplified84.5%
metadata-eval84.5%
associate-*l/79.2%
times-frac79.2%
*-un-lft-identity79.2%
*-commutative79.2%
times-frac84.5%
clear-num84.0%
frac-times85.3%
*-un-lft-identity85.3%
Applied egg-rr85.3%
Final simplification77.6%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* t (* z 9.0)) 1e+281) (/ (- (* y x) (* z (* 9.0 t))) (* a 2.0)) (* -4.5 (/ t (/ a z)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * (z * 9.0)) <= 1e+281) {
tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = -4.5 * (t / (a / z));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t * (z * 9.0d0)) <= 1d+281) then
tmp = ((y * x) - (z * (9.0d0 * t))) / (a * 2.0d0)
else
tmp = (-4.5d0) * (t / (a / z))
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * (z * 9.0)) <= 1e+281) {
tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = -4.5 * (t / (a / z));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (t * (z * 9.0)) <= 1e+281: tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0) else: tmp = -4.5 * (t / (a / z)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(t * Float64(z * 9.0)) <= 1e+281) tmp = Float64(Float64(Float64(y * x) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); else tmp = Float64(-4.5 * Float64(t / Float64(a / z))); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((t * (z * 9.0)) <= 1e+281)
tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0);
else
tmp = -4.5 * (t / (a / z));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision], 1e+281], N[(N[(N[(y * x), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \cdot \left(z \cdot 9\right) \leq 10^{+281}:\\
\;\;\;\;\frac{y \cdot x - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < 1e281Initial program 94.9%
associate-*l*94.9%
Simplified94.9%
if 1e281 < (*.f64 (*.f64 z 9) t) Initial program 57.8%
associate-*l*57.8%
Simplified57.8%
Taylor expanded in x around 0 57.9%
associate-/l*94.4%
Simplified94.4%
Final simplification94.9%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* a 2.0) -5e+34) (- (* 0.5 (* y (/ x a))) (* (/ t a) (* z 4.5))) (/ (- (* y x) (* z (* 9.0 t))) (* a 2.0))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= -5e+34) {
tmp = (0.5 * (y * (x / a))) - ((t / a) * (z * 4.5));
} else {
tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a * 2.0d0) <= (-5d+34)) then
tmp = (0.5d0 * (y * (x / a))) - ((t / a) * (z * 4.5d0))
else
tmp = ((y * x) - (z * (9.0d0 * t))) / (a * 2.0d0)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= -5e+34) {
tmp = (0.5 * (y * (x / a))) - ((t / a) * (z * 4.5));
} else {
tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (a * 2.0) <= -5e+34: tmp = (0.5 * (y * (x / a))) - ((t / a) * (z * 4.5)) else: tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= -5e+34) tmp = Float64(Float64(0.5 * Float64(y * Float64(x / a))) - Float64(Float64(t / a) * Float64(z * 4.5))); else tmp = Float64(Float64(Float64(y * x) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((a * 2.0) <= -5e+34)
tmp = (0.5 * (y * (x / a))) - ((t / a) * (z * 4.5));
else
tmp = ((y * x) - (z * (9.0 * t))) / (a * 2.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -5e+34], N[(N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * x), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -5 \cdot 10^{+34}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 a 2) < -4.9999999999999998e34Initial program 80.2%
associate-*l*80.2%
Simplified80.2%
div-sub80.2%
div-inv80.1%
*-commutative80.1%
associate-/r*80.1%
metadata-eval80.1%
times-frac86.6%
Applied egg-rr86.6%
Taylor expanded in x around 0 86.8%
*-commutative86.8%
associate-*r/94.0%
Simplified94.0%
Taylor expanded in z around 0 84.9%
associate-*l/94.0%
*-commutative94.0%
associate-*l*93.9%
Simplified93.9%
if -4.9999999999999998e34 < (*.f64 a 2) Initial program 97.1%
associate-*l*97.1%
Simplified97.1%
Final simplification96.2%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* 0.5 (* y (/ x a)))))
(if (<= y -1.4e-149)
t_1
(if (<= y 3.3e-231)
(* -4.5 (/ (* z t) a))
(if (<= y 5.8e+14) (* -4.5 (/ z (/ a t))) t_1)))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * (y * (x / a));
double tmp;
if (y <= -1.4e-149) {
tmp = t_1;
} else if (y <= 3.3e-231) {
tmp = -4.5 * ((z * t) / a);
} else if (y <= 5.8e+14) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = 0.5d0 * (y * (x / a))
if (y <= (-1.4d-149)) then
tmp = t_1
else if (y <= 3.3d-231) then
tmp = (-4.5d0) * ((z * t) / a)
else if (y <= 5.8d+14) then
tmp = (-4.5d0) * (z / (a / t))
else
tmp = t_1
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * (y * (x / a));
double tmp;
if (y <= -1.4e-149) {
tmp = t_1;
} else if (y <= 3.3e-231) {
tmp = -4.5 * ((z * t) / a);
} else if (y <= 5.8e+14) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = t_1;
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = 0.5 * (y * (x / a)) tmp = 0 if y <= -1.4e-149: tmp = t_1 elif y <= 3.3e-231: tmp = -4.5 * ((z * t) / a) elif y <= 5.8e+14: tmp = -4.5 * (z / (a / t)) else: tmp = t_1 return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(0.5 * Float64(y * Float64(x / a))) tmp = 0.0 if (y <= -1.4e-149) tmp = t_1; elseif (y <= 3.3e-231) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (y <= 5.8e+14) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); else tmp = t_1; end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = 0.5 * (y * (x / a));
tmp = 0.0;
if (y <= -1.4e-149)
tmp = t_1;
elseif (y <= 3.3e-231)
tmp = -4.5 * ((z * t) / a);
elseif (y <= 5.8e+14)
tmp = -4.5 * (z / (a / t));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.4e-149], t$95$1, If[LessEqual[y, 3.3e-231], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+14], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := 0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{if}\;y \leq -1.4 \cdot 10^{-149}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-231}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+14}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.3999999999999999e-149 or 5.8e14 < y Initial program 90.5%
associate-*l*90.6%
Simplified90.6%
Taylor expanded in x around inf 65.9%
associate-/l*67.9%
associate-/r/66.9%
Simplified66.9%
if -1.3999999999999999e-149 < y < 3.30000000000000028e-231Initial program 96.2%
associate-*l*96.2%
Simplified96.2%
Taylor expanded in x around 0 79.9%
if 3.30000000000000028e-231 < y < 5.8e14Initial program 93.5%
associate-*l*93.5%
Simplified93.5%
div-sub93.5%
div-inv93.6%
*-commutative93.6%
associate-/r*93.6%
metadata-eval93.6%
times-frac99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 69.6%
*-commutative69.6%
associate-/l*70.8%
Simplified70.8%
Final simplification70.4%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.85e-149)
(* 0.5 (* y (/ x a)))
(if (<= y 2.9e-231)
(* -4.5 (/ (* z t) a))
(if (<= y 2800000000.0) (* -4.5 (/ z (/ a t))) (* 0.5 (/ x (/ a y)))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.85e-149) {
tmp = 0.5 * (y * (x / a));
} else if (y <= 2.9e-231) {
tmp = -4.5 * ((z * t) / a);
} else if (y <= 2800000000.0) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = 0.5 * (x / (a / y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-1.85d-149)) then
tmp = 0.5d0 * (y * (x / a))
else if (y <= 2.9d-231) then
tmp = (-4.5d0) * ((z * t) / a)
else if (y <= 2800000000.0d0) then
tmp = (-4.5d0) * (z / (a / t))
else
tmp = 0.5d0 * (x / (a / y))
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.85e-149) {
tmp = 0.5 * (y * (x / a));
} else if (y <= 2.9e-231) {
tmp = -4.5 * ((z * t) / a);
} else if (y <= 2800000000.0) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = 0.5 * (x / (a / y));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -1.85e-149: tmp = 0.5 * (y * (x / a)) elif y <= 2.9e-231: tmp = -4.5 * ((z * t) / a) elif y <= 2800000000.0: tmp = -4.5 * (z / (a / t)) else: tmp = 0.5 * (x / (a / y)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.85e-149) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (y <= 2.9e-231) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (y <= 2800000000.0) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); else tmp = Float64(0.5 * Float64(x / Float64(a / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -1.85e-149)
tmp = 0.5 * (y * (x / a));
elseif (y <= 2.9e-231)
tmp = -4.5 * ((z * t) / a);
elseif (y <= 2800000000.0)
tmp = -4.5 * (z / (a / t));
else
tmp = 0.5 * (x / (a / y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.85e-149], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e-231], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2800000000.0], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{-149}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-231}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;y \leq 2800000000:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -1.84999999999999995e-149Initial program 92.6%
associate-*l*92.7%
Simplified92.7%
Taylor expanded in x around inf 68.7%
associate-/l*68.0%
associate-/r/66.3%
Simplified66.3%
if -1.84999999999999995e-149 < y < 2.9000000000000001e-231Initial program 96.2%
associate-*l*96.2%
Simplified96.2%
Taylor expanded in x around 0 79.9%
if 2.9000000000000001e-231 < y < 2.8e9Initial program 93.4%
associate-*l*93.4%
Simplified93.4%
div-sub93.4%
div-inv93.4%
*-commutative93.4%
associate-/r*93.4%
metadata-eval93.4%
times-frac99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 71.0%
*-commutative71.0%
associate-/l*72.2%
Simplified72.2%
if 2.8e9 < y Initial program 87.6%
associate-*l*87.6%
Simplified87.6%
Taylor expanded in x around inf 62.3%
associate-/l*68.2%
Simplified68.2%
Final simplification70.7%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (/ x 2.0))))
(if (<= y -1.2e-150)
t_1
(if (<= y 3e-231)
(* -4.5 (/ (* z t) a))
(if (<= y 19000000000.0) (* -4.5 (/ z (/ a t))) t_1)))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (x / 2.0);
double tmp;
if (y <= -1.2e-150) {
tmp = t_1;
} else if (y <= 3e-231) {
tmp = -4.5 * ((z * t) / a);
} else if (y <= 19000000000.0) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y / a) * (x / 2.0d0)
if (y <= (-1.2d-150)) then
tmp = t_1
else if (y <= 3d-231) then
tmp = (-4.5d0) * ((z * t) / a)
else if (y <= 19000000000.0d0) then
tmp = (-4.5d0) * (z / (a / t))
else
tmp = t_1
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (x / 2.0);
double tmp;
if (y <= -1.2e-150) {
tmp = t_1;
} else if (y <= 3e-231) {
tmp = -4.5 * ((z * t) / a);
} else if (y <= 19000000000.0) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = t_1;
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (y / a) * (x / 2.0) tmp = 0 if y <= -1.2e-150: tmp = t_1 elif y <= 3e-231: tmp = -4.5 * ((z * t) / a) elif y <= 19000000000.0: tmp = -4.5 * (z / (a / t)) else: tmp = t_1 return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(x / 2.0)) tmp = 0.0 if (y <= -1.2e-150) tmp = t_1; elseif (y <= 3e-231) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (y <= 19000000000.0) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); else tmp = t_1; end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (y / a) * (x / 2.0);
tmp = 0.0;
if (y <= -1.2e-150)
tmp = t_1;
elseif (y <= 3e-231)
tmp = -4.5 * ((z * t) / a);
elseif (y <= 19000000000.0)
tmp = -4.5 * (z / (a / t));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.2e-150], t$95$1, If[LessEqual[y, 3e-231], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 19000000000.0], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \frac{x}{2}\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{-150}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-231}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;y \leq 19000000000:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.2e-150 or 1.9e10 < y Initial program 90.6%
associate-*l*90.6%
Simplified90.6%
Taylor expanded in x around inf 66.1%
*-commutative66.1%
times-frac68.3%
Applied egg-rr68.3%
if -1.2e-150 < y < 3.0000000000000003e-231Initial program 96.2%
associate-*l*96.2%
Simplified96.2%
Taylor expanded in x around 0 79.9%
if 3.0000000000000003e-231 < y < 1.9e10Initial program 93.4%
associate-*l*93.4%
Simplified93.4%
div-sub93.4%
div-inv93.4%
*-commutative93.4%
associate-/r*93.4%
metadata-eval93.4%
times-frac99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 71.0%
*-commutative71.0%
associate-/l*72.2%
Simplified72.2%
Final simplification71.5%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.85e-149)
(/ y (* 2.0 (/ a x)))
(if (<= y 3.5e-231)
(* -4.5 (/ (* z t) a))
(if (<= y 18000000000.0) (* -4.5 (/ z (/ a t))) (* (/ y a) (/ x 2.0))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.85e-149) {
tmp = y / (2.0 * (a / x));
} else if (y <= 3.5e-231) {
tmp = -4.5 * ((z * t) / a);
} else if (y <= 18000000000.0) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = (y / a) * (x / 2.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-1.85d-149)) then
tmp = y / (2.0d0 * (a / x))
else if (y <= 3.5d-231) then
tmp = (-4.5d0) * ((z * t) / a)
else if (y <= 18000000000.0d0) then
tmp = (-4.5d0) * (z / (a / t))
else
tmp = (y / a) * (x / 2.0d0)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.85e-149) {
tmp = y / (2.0 * (a / x));
} else if (y <= 3.5e-231) {
tmp = -4.5 * ((z * t) / a);
} else if (y <= 18000000000.0) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = (y / a) * (x / 2.0);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -1.85e-149: tmp = y / (2.0 * (a / x)) elif y <= 3.5e-231: tmp = -4.5 * ((z * t) / a) elif y <= 18000000000.0: tmp = -4.5 * (z / (a / t)) else: tmp = (y / a) * (x / 2.0) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.85e-149) tmp = Float64(y / Float64(2.0 * Float64(a / x))); elseif (y <= 3.5e-231) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (y <= 18000000000.0) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); else tmp = Float64(Float64(y / a) * Float64(x / 2.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -1.85e-149)
tmp = y / (2.0 * (a / x));
elseif (y <= 3.5e-231)
tmp = -4.5 * ((z * t) / a);
elseif (y <= 18000000000.0)
tmp = -4.5 * (z / (a / t));
else
tmp = (y / a) * (x / 2.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.85e-149], N[(y / N[(2.0 * N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.5e-231], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 18000000000.0], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{-149}:\\
\;\;\;\;\frac{y}{2 \cdot \frac{a}{x}}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-231}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;y \leq 18000000000:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \frac{x}{2}\\
\end{array}
\end{array}
if y < -1.84999999999999995e-149Initial program 92.6%
associate-*l*92.7%
Simplified92.7%
Taylor expanded in x around inf 68.7%
associate-/l*68.0%
associate-/r/66.3%
Simplified66.3%
metadata-eval66.3%
associate-*l/68.7%
times-frac68.7%
*-un-lft-identity68.7%
*-commutative68.7%
times-frac66.3%
clear-num65.6%
frac-times66.4%
*-un-lft-identity66.4%
Applied egg-rr66.4%
if -1.84999999999999995e-149 < y < 3.5000000000000001e-231Initial program 96.2%
associate-*l*96.2%
Simplified96.2%
Taylor expanded in x around 0 79.9%
if 3.5000000000000001e-231 < y < 1.8e10Initial program 93.4%
associate-*l*93.4%
Simplified93.4%
div-sub93.4%
div-inv93.4%
*-commutative93.4%
associate-/r*93.4%
metadata-eval93.4%
times-frac99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 71.0%
*-commutative71.0%
associate-/l*72.2%
Simplified72.2%
if 1.8e10 < y Initial program 87.6%
associate-*l*87.6%
Simplified87.6%
Taylor expanded in x around inf 62.3%
*-commutative62.3%
times-frac68.3%
Applied egg-rr68.3%
Final simplification70.8%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (/ t (/ a z))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (t / (a / z));
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (-4.5d0) * (t / (a / z))
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (t / (a / z));
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return -4.5 * (t / (a / z))
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(t / Float64(a / z))) end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (t / (a / z));
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \frac{t}{\frac{a}{z}}
\end{array}
Initial program 92.3%
associate-*l*92.3%
Simplified92.3%
Taylor expanded in x around 0 49.7%
associate-/l*50.8%
Simplified50.8%
Final simplification50.8%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (/ z (/ a t))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (z / (a / t));
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (-4.5d0) * (z / (a / t))
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (z / (a / t));
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return -4.5 * (z / (a / t))
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(z / Float64(a / t))) end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (z / (a / t));
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \frac{z}{\frac{a}{t}}
\end{array}
Initial program 92.3%
associate-*l*92.3%
Simplified92.3%
div-sub90.0%
div-inv89.9%
*-commutative89.9%
associate-/r*89.9%
metadata-eval89.9%
times-frac89.4%
Applied egg-rr89.4%
Taylor expanded in x around 0 49.7%
*-commutative49.7%
associate-/l*51.1%
Simplified51.1%
Final simplification51.1%
(FPCore (x y z t a)
:precision binary64
(if (< a -2.090464557976709e+86)
(- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z))))
(if (< a 2.144030707833976e+99)
(/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))
(- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a < -2.090464557976709e+86) {
tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
} else if (a < 2.144030707833976e+99) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a < (-2.090464557976709d+86)) then
tmp = (0.5d0 * ((y * x) / a)) - (4.5d0 * (t / (a / z)))
else if (a < 2.144030707833976d+99) then
tmp = ((x * y) - (z * (9.0d0 * t))) / (a * 2.0d0)
else
tmp = ((y / a) * (x * 0.5d0)) - ((t / a) * (z * 4.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a < -2.090464557976709e+86) {
tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
} else if (a < 2.144030707833976e+99) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a < -2.090464557976709e+86: tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z))) elif a < 2.144030707833976e+99: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) else: tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a < -2.090464557976709e+86) tmp = Float64(Float64(0.5 * Float64(Float64(y * x) / a)) - Float64(4.5 * Float64(t / Float64(a / z)))); elseif (a < 2.144030707833976e+99) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); else tmp = Float64(Float64(Float64(y / a) * Float64(x * 0.5)) - Float64(Float64(t / a) * Float64(z * 4.5))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a < -2.090464557976709e+86) tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z))); elseif (a < 2.144030707833976e+99) tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0); else tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Less[a, -2.090464557976709e+86], N[(N[(0.5 * N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] - N[(4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[a, 2.144030707833976e+99], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / a), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a < -2.090464557976709 \cdot 10^{+86}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;a < 2.144030707833976 \cdot 10^{+99}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(x \cdot 0.5\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\
\end{array}
\end{array}
herbie shell --seed 2023290
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
:herbie-target
(if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))