
(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 11 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: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (* z 9.0))))
(if (<= t_1 -2e+265)
(* -4.5 (/ t (/ a z)))
(if (<= t_1 5e+247)
(+ (* -4.5 (/ (* z t) a)) (* 0.5 (/ (* x y) a)))
(* z (* -4.5 (/ t a)))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (z * 9.0);
double tmp;
if (t_1 <= -2e+265) {
tmp = -4.5 * (t / (a / z));
} else if (t_1 <= 5e+247) {
tmp = (-4.5 * ((z * t) / a)) + (0.5 * ((x * y) / a));
} else {
tmp = z * (-4.5 * (t / a));
}
return tmp;
}
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 = t * (z * 9.0d0)
if (t_1 <= (-2d+265)) then
tmp = (-4.5d0) * (t / (a / z))
else if (t_1 <= 5d+247) then
tmp = ((-4.5d0) * ((z * t) / a)) + (0.5d0 * ((x * y) / a))
else
tmp = z * ((-4.5d0) * (t / a))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t * (z * 9.0);
double tmp;
if (t_1 <= -2e+265) {
tmp = -4.5 * (t / (a / z));
} else if (t_1 <= 5e+247) {
tmp = (-4.5 * ((z * t) / a)) + (0.5 * ((x * y) / a));
} else {
tmp = z * (-4.5 * (t / a));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = t * (z * 9.0) tmp = 0 if t_1 <= -2e+265: tmp = -4.5 * (t / (a / z)) elif t_1 <= 5e+247: tmp = (-4.5 * ((z * t) / a)) + (0.5 * ((x * y) / a)) else: tmp = z * (-4.5 * (t / a)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(t * Float64(z * 9.0)) tmp = 0.0 if (t_1 <= -2e+265) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); elseif (t_1 <= 5e+247) tmp = Float64(Float64(-4.5 * Float64(Float64(z * t) / a)) + Float64(0.5 * Float64(Float64(x * y) / a))); else tmp = Float64(z * Float64(-4.5 * Float64(t / a))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = t * (z * 9.0);
tmp = 0.0;
if (t_1 <= -2e+265)
tmp = -4.5 * (t / (a / z));
elseif (t_1 <= 5e+247)
tmp = (-4.5 * ((z * t) / a)) + (0.5 * ((x * y) / a));
else
tmp = z * (-4.5 * (t / a));
end
tmp_2 = tmp;
end
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[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+265], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+247], N[(N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(-4.5 * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(z \cdot 9\right)\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+265}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+247}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a} + 0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-4.5 \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < -2.00000000000000013e265Initial program 74.4%
associate-*l*74.4%
Simplified74.4%
Taylor expanded in x around 0 74.4%
Taylor expanded in t around inf 74.4%
associate-/l*99.8%
Simplified99.8%
if -2.00000000000000013e265 < (*.f64 (*.f64 z 9) t) < 5.00000000000000023e247Initial program 96.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in x around 0 96.8%
if 5.00000000000000023e247 < (*.f64 (*.f64 z 9) t) Initial program 76.6%
associate-*l*76.7%
Simplified76.7%
Taylor expanded in x around 0 72.7%
Taylor expanded in t around inf 76.8%
*-commutative76.8%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.9%
*-commutative99.9%
associate-*r/99.7%
Simplified99.7%
Taylor expanded in t around 0 99.9%
Final simplification97.4%
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) 1e-32) (/ (fma x y (* -9.0 (* z t))) (* a 2.0)) (fma x (* y (/ 0.5 a)) (* (/ z a) (* (* t 9.0) (- 0.5))))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= 1e-32) {
tmp = fma(x, y, (-9.0 * (z * t))) / (a * 2.0);
} else {
tmp = fma(x, (y * (0.5 / a)), ((z / a) * ((t * 9.0) * -0.5)));
}
return tmp;
}
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= 1e-32) tmp = Float64(fma(x, y, Float64(-9.0 * Float64(z * t))) / Float64(a * 2.0)); else tmp = fma(x, Float64(y * Float64(0.5 / a)), Float64(Float64(z / a) * Float64(Float64(t * 9.0) * Float64(-0.5)))); end return tmp end
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], 1e-32], N[(N[(x * y + N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision] + N[(N[(z / a), $MachinePrecision] * N[(N[(t * 9.0), $MachinePrecision] * (-0.5)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq 10^{-32}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, -9 \cdot \left(z \cdot t\right)\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot \frac{0.5}{a}, \frac{z}{a} \cdot \left(\left(t \cdot 9\right) \cdot \left(-0.5\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 a 2) < 1.00000000000000006e-32Initial program 95.9%
fma-neg95.9%
*-commutative95.9%
associate-*l*95.9%
distribute-lft-neg-in95.9%
metadata-eval95.9%
Simplified95.9%
if 1.00000000000000006e-32 < (*.f64 a 2) Initial program 85.0%
associate-*l*85.1%
Simplified85.1%
div-sub85.0%
div-inv85.0%
*-commutative85.0%
associate-/r*85.0%
metadata-eval85.0%
times-frac92.9%
Applied egg-rr92.9%
cancel-sign-sub-inv92.9%
associate-*l*93.5%
fma-def93.5%
div-inv93.5%
*-commutative93.5%
metadata-eval93.5%
Applied egg-rr93.5%
Final simplification95.2%
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) 1e-32) (/ (fma x y (* -9.0 (* z t))) (* a 2.0)) (- (* (/ 0.5 a) (* x y)) (* (/ z a) (/ (* t 9.0) 2.0)))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= 1e-32) {
tmp = fma(x, y, (-9.0 * (z * t))) / (a * 2.0);
} else {
tmp = ((0.5 / a) * (x * y)) - ((z / a) * ((t * 9.0) / 2.0));
}
return tmp;
}
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= 1e-32) tmp = Float64(fma(x, y, Float64(-9.0 * Float64(z * t))) / Float64(a * 2.0)); else tmp = Float64(Float64(Float64(0.5 / a) * Float64(x * y)) - Float64(Float64(z / a) * Float64(Float64(t * 9.0) / 2.0))); end return tmp end
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], 1e-32], N[(N[(x * y + N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 / a), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(z / a), $MachinePrecision] * N[(N[(t * 9.0), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq 10^{-32}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, -9 \cdot \left(z \cdot t\right)\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(x \cdot y\right) - \frac{z}{a} \cdot \frac{t \cdot 9}{2}\\
\end{array}
\end{array}
if (*.f64 a 2) < 1.00000000000000006e-32Initial program 95.9%
fma-neg95.9%
*-commutative95.9%
associate-*l*95.9%
distribute-lft-neg-in95.9%
metadata-eval95.9%
Simplified95.9%
if 1.00000000000000006e-32 < (*.f64 a 2) Initial program 85.0%
associate-*l*85.1%
Simplified85.1%
div-sub85.0%
div-inv85.0%
*-commutative85.0%
associate-/r*85.0%
metadata-eval85.0%
times-frac92.9%
Applied egg-rr92.9%
Final simplification95.0%
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 (* t (* z 9.0))))
(if (<= t_1 -4e+217)
(* -4.5 (/ t (/ a z)))
(if (<= t_1 5e+205)
(/ (- (* x y) (* z (* t 9.0))) (* a 2.0))
(* z (* -4.5 (/ t a)))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (z * 9.0);
double tmp;
if (t_1 <= -4e+217) {
tmp = -4.5 * (t / (a / z));
} else if (t_1 <= 5e+205) {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = z * (-4.5 * (t / a));
}
return tmp;
}
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 = t * (z * 9.0d0)
if (t_1 <= (-4d+217)) then
tmp = (-4.5d0) * (t / (a / z))
else if (t_1 <= 5d+205) then
tmp = ((x * y) - (z * (t * 9.0d0))) / (a * 2.0d0)
else
tmp = z * ((-4.5d0) * (t / a))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t * (z * 9.0);
double tmp;
if (t_1 <= -4e+217) {
tmp = -4.5 * (t / (a / z));
} else if (t_1 <= 5e+205) {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = z * (-4.5 * (t / a));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = t * (z * 9.0) tmp = 0 if t_1 <= -4e+217: tmp = -4.5 * (t / (a / z)) elif t_1 <= 5e+205: tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0) else: tmp = z * (-4.5 * (t / a)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(t * Float64(z * 9.0)) tmp = 0.0 if (t_1 <= -4e+217) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); elseif (t_1 <= 5e+205) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(t * 9.0))) / Float64(a * 2.0)); else tmp = Float64(z * Float64(-4.5 * Float64(t / a))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = t * (z * 9.0);
tmp = 0.0;
if (t_1 <= -4e+217)
tmp = -4.5 * (t / (a / z));
elseif (t_1 <= 5e+205)
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
else
tmp = z * (-4.5 * (t / a));
end
tmp_2 = tmp;
end
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[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+217], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+205], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(-4.5 * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(z \cdot 9\right)\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+217}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+205}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-4.5 \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < -3.99999999999999984e217Initial program 77.0%
associate-*l*77.0%
Simplified77.0%
Taylor expanded in x around 0 77.0%
Taylor expanded in t around inf 77.0%
associate-/l*99.8%
Simplified99.8%
if -3.99999999999999984e217 < (*.f64 (*.f64 z 9) t) < 5.0000000000000002e205Initial program 97.1%
associate-*l*97.1%
Simplified97.1%
if 5.0000000000000002e205 < (*.f64 (*.f64 z 9) t) Initial program 78.0%
associate-*l*78.1%
Simplified78.1%
Taylor expanded in x around 0 78.1%
Taylor expanded in t around inf 81.5%
*-commutative81.5%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.8%
*-commutative99.8%
associate-*r/99.7%
Simplified99.7%
Taylor expanded in t around 0 99.8%
Final simplification97.7%
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 (* x (* y (/ 0.5 a)))))
(if (<= (* x y) -2e+40)
t_1
(if (<= (* x y) 4e-119)
(* -4.5 (/ t (/ a z)))
(if (<= (* x y) 2e-52)
t_1
(if (<= (* x y) 2e+26)
(* -4.5 (/ (* z t) a))
(* y (* 0.5 (/ x a)))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = x * (y * (0.5 / a));
double tmp;
if ((x * y) <= -2e+40) {
tmp = t_1;
} else if ((x * y) <= 4e-119) {
tmp = -4.5 * (t / (a / z));
} else if ((x * y) <= 2e-52) {
tmp = t_1;
} else if ((x * y) <= 2e+26) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = y * (0.5 * (x / a));
}
return tmp;
}
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 = x * (y * (0.5d0 / a))
if ((x * y) <= (-2d+40)) then
tmp = t_1
else if ((x * y) <= 4d-119) then
tmp = (-4.5d0) * (t / (a / z))
else if ((x * y) <= 2d-52) then
tmp = t_1
else if ((x * y) <= 2d+26) then
tmp = (-4.5d0) * ((z * t) / a)
else
tmp = y * (0.5d0 * (x / a))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x * (y * (0.5 / a));
double tmp;
if ((x * y) <= -2e+40) {
tmp = t_1;
} else if ((x * y) <= 4e-119) {
tmp = -4.5 * (t / (a / z));
} else if ((x * y) <= 2e-52) {
tmp = t_1;
} else if ((x * y) <= 2e+26) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = y * (0.5 * (x / a));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = x * (y * (0.5 / a)) tmp = 0 if (x * y) <= -2e+40: tmp = t_1 elif (x * y) <= 4e-119: tmp = -4.5 * (t / (a / z)) elif (x * y) <= 2e-52: tmp = t_1 elif (x * y) <= 2e+26: tmp = -4.5 * ((z * t) / a) else: tmp = y * (0.5 * (x / a)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(x * Float64(y * Float64(0.5 / a))) tmp = 0.0 if (Float64(x * y) <= -2e+40) tmp = t_1; elseif (Float64(x * y) <= 4e-119) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); elseif (Float64(x * y) <= 2e-52) tmp = t_1; elseif (Float64(x * y) <= 2e+26) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); else tmp = Float64(y * Float64(0.5 * Float64(x / a))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = x * (y * (0.5 / a));
tmp = 0.0;
if ((x * y) <= -2e+40)
tmp = t_1;
elseif ((x * y) <= 4e-119)
tmp = -4.5 * (t / (a / z));
elseif ((x * y) <= 2e-52)
tmp = t_1;
elseif ((x * y) <= 2e+26)
tmp = -4.5 * ((z * t) / a);
else
tmp = y * (0.5 * (x / a));
end
tmp_2 = tmp;
end
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[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+40], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4e-119], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-52], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+26], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-119}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-52}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+26}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000006e40 or 4.00000000000000005e-119 < (*.f64 x y) < 2e-52Initial program 93.6%
associate-*l*93.6%
Simplified93.6%
Taylor expanded in x around 0 93.7%
expm1-log1p-u56.9%
expm1-udef40.2%
Applied egg-rr40.2%
expm1-def56.9%
expm1-log1p93.7%
associate-/l*93.2%
Simplified93.2%
Applied egg-rr91.3%
Taylor expanded in t around 0 78.8%
associate-*r/78.8%
associate-*l/78.7%
*-commutative78.7%
associate-*l*79.2%
Simplified79.2%
if -2.00000000000000006e40 < (*.f64 x y) < 4.00000000000000005e-119Initial program 91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in x around 0 92.4%
Taylor expanded in t around inf 77.6%
associate-/l*79.6%
Simplified79.6%
if 2e-52 < (*.f64 x y) < 2.0000000000000001e26Initial program 99.8%
associate-*l*99.6%
Simplified99.6%
Taylor expanded in x around 0 60.5%
if 2.0000000000000001e26 < (*.f64 x y) Initial program 91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in x around 0 88.1%
expm1-log1p-u49.6%
expm1-udef44.6%
Applied egg-rr44.6%
expm1-def49.6%
expm1-log1p88.1%
associate-/l*89.7%
Simplified89.7%
Taylor expanded in t around 0 82.9%
associate-*l/83.0%
*-commutative83.0%
*-commutative83.0%
associate-*l*83.0%
Simplified83.0%
Final simplification79.0%
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 (* x (* y (/ 0.5 a)))))
(if (<= (* x y) -2e+40)
t_1
(if (<= (* x y) 4e-119)
(* z (* -4.5 (/ t a)))
(if (<= (* x y) 2e-52)
t_1
(if (<= (* x y) 2e+26)
(* -4.5 (/ (* z t) a))
(* y (* 0.5 (/ x a)))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = x * (y * (0.5 / a));
double tmp;
if ((x * y) <= -2e+40) {
tmp = t_1;
} else if ((x * y) <= 4e-119) {
tmp = z * (-4.5 * (t / a));
} else if ((x * y) <= 2e-52) {
tmp = t_1;
} else if ((x * y) <= 2e+26) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = y * (0.5 * (x / a));
}
return tmp;
}
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 = x * (y * (0.5d0 / a))
if ((x * y) <= (-2d+40)) then
tmp = t_1
else if ((x * y) <= 4d-119) then
tmp = z * ((-4.5d0) * (t / a))
else if ((x * y) <= 2d-52) then
tmp = t_1
else if ((x * y) <= 2d+26) then
tmp = (-4.5d0) * ((z * t) / a)
else
tmp = y * (0.5d0 * (x / a))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x * (y * (0.5 / a));
double tmp;
if ((x * y) <= -2e+40) {
tmp = t_1;
} else if ((x * y) <= 4e-119) {
tmp = z * (-4.5 * (t / a));
} else if ((x * y) <= 2e-52) {
tmp = t_1;
} else if ((x * y) <= 2e+26) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = y * (0.5 * (x / a));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = x * (y * (0.5 / a)) tmp = 0 if (x * y) <= -2e+40: tmp = t_1 elif (x * y) <= 4e-119: tmp = z * (-4.5 * (t / a)) elif (x * y) <= 2e-52: tmp = t_1 elif (x * y) <= 2e+26: tmp = -4.5 * ((z * t) / a) else: tmp = y * (0.5 * (x / a)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(x * Float64(y * Float64(0.5 / a))) tmp = 0.0 if (Float64(x * y) <= -2e+40) tmp = t_1; elseif (Float64(x * y) <= 4e-119) tmp = Float64(z * Float64(-4.5 * Float64(t / a))); elseif (Float64(x * y) <= 2e-52) tmp = t_1; elseif (Float64(x * y) <= 2e+26) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); else tmp = Float64(y * Float64(0.5 * Float64(x / a))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = x * (y * (0.5 / a));
tmp = 0.0;
if ((x * y) <= -2e+40)
tmp = t_1;
elseif ((x * y) <= 4e-119)
tmp = z * (-4.5 * (t / a));
elseif ((x * y) <= 2e-52)
tmp = t_1;
elseif ((x * y) <= 2e+26)
tmp = -4.5 * ((z * t) / a);
else
tmp = y * (0.5 * (x / a));
end
tmp_2 = tmp;
end
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[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+40], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4e-119], N[(z * N[(-4.5 * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-52], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+26], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-119}:\\
\;\;\;\;z \cdot \left(-4.5 \cdot \frac{t}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-52}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+26}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000006e40 or 4.00000000000000005e-119 < (*.f64 x y) < 2e-52Initial program 93.6%
associate-*l*93.6%
Simplified93.6%
Taylor expanded in x around 0 93.7%
expm1-log1p-u56.9%
expm1-udef40.2%
Applied egg-rr40.2%
expm1-def56.9%
expm1-log1p93.7%
associate-/l*93.2%
Simplified93.2%
Applied egg-rr91.3%
Taylor expanded in t around 0 78.8%
associate-*r/78.8%
associate-*l/78.7%
*-commutative78.7%
associate-*l*79.2%
Simplified79.2%
if -2.00000000000000006e40 < (*.f64 x y) < 4.00000000000000005e-119Initial program 91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in x around 0 92.4%
Taylor expanded in t around inf 77.6%
*-commutative77.6%
associate-*l/83.8%
*-commutative83.8%
associate-*l*84.0%
*-commutative84.0%
associate-*r/83.9%
Simplified83.9%
Taylor expanded in t around 0 84.0%
if 2e-52 < (*.f64 x y) < 2.0000000000000001e26Initial program 99.8%
associate-*l*99.6%
Simplified99.6%
Taylor expanded in x around 0 60.5%
if 2.0000000000000001e26 < (*.f64 x y) Initial program 91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in x around 0 88.1%
expm1-log1p-u49.6%
expm1-udef44.6%
Applied egg-rr44.6%
expm1-def49.6%
expm1-log1p88.1%
associate-/l*89.7%
Simplified89.7%
Taylor expanded in t around 0 82.9%
associate-*l/83.0%
*-commutative83.0%
*-commutative83.0%
associate-*l*83.0%
Simplified83.0%
Final simplification81.0%
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-53) (/ (- (* x y) (* z (* t 9.0))) (* a 2.0)) (- (* (/ 0.5 a) (* x y)) (* (/ z a) (/ (* t 9.0) 2.0)))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= 2e-53) {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = ((0.5 / a) * (x * y)) - ((z / a) * ((t * 9.0) / 2.0));
}
return tmp;
}
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-53) then
tmp = ((x * y) - (z * (t * 9.0d0))) / (a * 2.0d0)
else
tmp = ((0.5d0 / a) * (x * y)) - ((z / a) * ((t * 9.0d0) / 2.0d0))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= 2e-53) {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = ((0.5 / a) * (x * y)) - ((z / a) * ((t * 9.0) / 2.0));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (a * 2.0) <= 2e-53: tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0) else: tmp = ((0.5 / a) * (x * y)) - ((z / a) * ((t * 9.0) / 2.0)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= 2e-53) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(t * 9.0))) / Float64(a * 2.0)); else tmp = Float64(Float64(Float64(0.5 / a) * Float64(x * y)) - Float64(Float64(z / a) * Float64(Float64(t * 9.0) / 2.0))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((a * 2.0) <= 2e-53)
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
else
tmp = ((0.5 / a) * (x * y)) - ((z / a) * ((t * 9.0) / 2.0));
end
tmp_2 = tmp;
end
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-53], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 / a), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(z / a), $MachinePrecision] * N[(N[(t * 9.0), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq 2 \cdot 10^{-53}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(x \cdot y\right) - \frac{z}{a} \cdot \frac{t \cdot 9}{2}\\
\end{array}
\end{array}
if (*.f64 a 2) < 2.00000000000000006e-53Initial program 95.8%
associate-*l*95.8%
Simplified95.8%
if 2.00000000000000006e-53 < (*.f64 a 2) Initial program 85.4%
associate-*l*85.4%
Simplified85.4%
div-sub85.4%
div-inv85.4%
*-commutative85.4%
associate-/r*85.4%
metadata-eval85.4%
times-frac93.0%
Applied egg-rr93.0%
Final simplification94.9%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -2e+40) (* 0.5 (/ x (/ a y))) (if (<= (* x y) 5e-126) (* -4.5 (/ t (/ a z))) (* 0.5 (/ (* x y) a)))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+40) {
tmp = 0.5 * (x / (a / y));
} else if ((x * y) <= 5e-126) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
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 ((x * y) <= (-2d+40)) then
tmp = 0.5d0 * (x / (a / y))
else if ((x * y) <= 5d-126) then
tmp = (-4.5d0) * (t / (a / z))
else
tmp = 0.5d0 * ((x * y) / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+40) {
tmp = 0.5 * (x / (a / y));
} else if ((x * y) <= 5e-126) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e+40: tmp = 0.5 * (x / (a / y)) elif (x * y) <= 5e-126: tmp = -4.5 * (t / (a / z)) else: tmp = 0.5 * ((x * y) / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+40) tmp = Float64(0.5 * Float64(x / Float64(a / y))); elseif (Float64(x * y) <= 5e-126) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); else tmp = Float64(0.5 * Float64(Float64(x * y) / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e+40)
tmp = 0.5 * (x / (a / y));
elseif ((x * y) <= 5e-126)
tmp = -4.5 * (t / (a / z));
else
tmp = 0.5 * ((x * y) / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+40], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-126], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+40}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-126}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000006e40Initial program 92.2%
associate-*l*92.2%
Simplified92.2%
Taylor expanded in x around inf 79.5%
associate-/l*83.1%
Simplified83.1%
if -2.00000000000000006e40 < (*.f64 x y) < 5.00000000000000006e-126Initial program 92.2%
associate-*l*92.2%
Simplified92.2%
Taylor expanded in x around 0 93.1%
Taylor expanded in t around inf 78.9%
associate-/l*80.1%
Simplified80.1%
if 5.00000000000000006e-126 < (*.f64 x y) Initial program 93.4%
associate-*l*93.3%
Simplified93.3%
Taylor expanded in x around inf 73.5%
Final simplification78.4%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -2e+40) (* x (* y (/ 0.5 a))) (if (<= (* x y) 5e-126) (* -4.5 (/ t (/ a z))) (* 0.5 (/ (* x y) a)))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+40) {
tmp = x * (y * (0.5 / a));
} else if ((x * y) <= 5e-126) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
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 ((x * y) <= (-2d+40)) then
tmp = x * (y * (0.5d0 / a))
else if ((x * y) <= 5d-126) then
tmp = (-4.5d0) * (t / (a / z))
else
tmp = 0.5d0 * ((x * y) / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+40) {
tmp = x * (y * (0.5 / a));
} else if ((x * y) <= 5e-126) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e+40: tmp = x * (y * (0.5 / a)) elif (x * y) <= 5e-126: tmp = -4.5 * (t / (a / z)) else: tmp = 0.5 * ((x * y) / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+40) tmp = Float64(x * Float64(y * Float64(0.5 / a))); elseif (Float64(x * y) <= 5e-126) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); else tmp = Float64(0.5 * Float64(Float64(x * y) / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e+40)
tmp = x * (y * (0.5 / a));
elseif ((x * y) <= 5e-126)
tmp = -4.5 * (t / (a / z));
else
tmp = 0.5 * ((x * y) / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+40], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-126], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+40}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-126}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000006e40Initial program 92.2%
associate-*l*92.2%
Simplified92.2%
Taylor expanded in x around 0 92.2%
expm1-log1p-u52.8%
expm1-udef42.7%
Applied egg-rr42.7%
expm1-def52.8%
expm1-log1p92.2%
associate-/l*94.0%
Simplified94.0%
Applied egg-rr92.4%
Taylor expanded in t around 0 79.5%
associate-*r/79.5%
associate-*l/79.4%
*-commutative79.4%
associate-*l*81.3%
Simplified81.3%
if -2.00000000000000006e40 < (*.f64 x y) < 5.00000000000000006e-126Initial program 92.2%
associate-*l*92.2%
Simplified92.2%
Taylor expanded in x around 0 93.1%
Taylor expanded in t around inf 78.9%
associate-/l*80.1%
Simplified80.1%
if 5.00000000000000006e-126 < (*.f64 x y) Initial program 93.4%
associate-*l*93.3%
Simplified93.3%
Taylor expanded in x around inf 73.5%
Final simplification78.1%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -6.6e+78) (* -4.5 (/ t (/ a z))) (if (<= z 3.5e-146) (* 0.5 (/ x (/ a y))) (* -4.5 (* z (/ t a))))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.6e+78) {
tmp = -4.5 * (t / (a / z));
} else if (z <= 3.5e-146) {
tmp = 0.5 * (x / (a / y));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
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 (z <= (-6.6d+78)) then
tmp = (-4.5d0) * (t / (a / z))
else if (z <= 3.5d-146) then
tmp = 0.5d0 * (x / (a / y))
else
tmp = (-4.5d0) * (z * (t / a))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.6e+78) {
tmp = -4.5 * (t / (a / z));
} else if (z <= 3.5e-146) {
tmp = 0.5 * (x / (a / y));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if z <= -6.6e+78: tmp = -4.5 * (t / (a / z)) elif z <= 3.5e-146: tmp = 0.5 * (x / (a / y)) else: tmp = -4.5 * (z * (t / a)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.6e+78) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); elseif (z <= 3.5e-146) tmp = Float64(0.5 * Float64(x / Float64(a / y))); else tmp = Float64(-4.5 * Float64(z * Float64(t / a))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -6.6e+78)
tmp = -4.5 * (t / (a / z));
elseif (z <= 3.5e-146)
tmp = 0.5 * (x / (a / y));
else
tmp = -4.5 * (z * (t / a));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.6e+78], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-146], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+78}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-146}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if z < -6.6e78Initial program 83.2%
associate-*l*83.2%
Simplified83.2%
Taylor expanded in x around 0 83.4%
Taylor expanded in t around inf 61.9%
associate-/l*69.1%
Simplified69.1%
if -6.6e78 < z < 3.5000000000000001e-146Initial program 96.4%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in x around inf 75.1%
associate-/l*69.1%
Simplified69.1%
if 3.5000000000000001e-146 < z Initial program 92.3%
associate-*l*92.3%
Simplified92.3%
Taylor expanded in x around 0 59.7%
associate-/l*65.9%
associate-/r/67.0%
Simplified67.0%
Final simplification68.4%
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 (/ t a))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
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 * (t / a))
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): return -4.5 * (z * (t / a))
z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(z * Float64(t / a))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (z * (t / a));
end
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[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \left(z \cdot \frac{t}{a}\right)
\end{array}
Initial program 92.6%
associate-*l*92.6%
Simplified92.6%
Taylor expanded in x around 0 50.1%
associate-/l*52.0%
associate-/r/54.2%
Simplified54.2%
Final simplification54.2%
(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 2023285
(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)))