
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
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), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
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), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(*
c_s
(if (<= c_m 5000000000000.0)
(/ (fma (* -4.0 a) t (/ (fma (* 9.0 x) y b) z)) c_m)
(fma -4.0 (* a (/ t c_m)) (/ (fma (* y x) 9.0 b) (* c_m z))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double tmp;
if (c_m <= 5000000000000.0) {
tmp = fma((-4.0 * a), t, (fma((9.0 * x), y, b) / z)) / c_m;
} else {
tmp = fma(-4.0, (a * (t / c_m)), (fma((y * x), 9.0, b) / (c_m * z)));
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) tmp = 0.0 if (c_m <= 5000000000000.0) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(fma(Float64(9.0 * x), y, b) / z)) / c_m); else tmp = fma(-4.0, Float64(a * Float64(t / c_m)), Float64(fma(Float64(y * x), 9.0, b) / Float64(c_m * z))); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * If[LessEqual[c$95$m, 5000000000000.0], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(N[(N[(9.0 * x), $MachinePrecision] * y + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], N[(-4.0 * N[(a * N[(t / c$95$m), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;c\_m \leq 5000000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, a \cdot \frac{t}{c\_m}, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{c\_m \cdot z}\right)\\
\end{array}
\end{array}
if c < 5e12Initial program 80.1%
Taylor expanded in b around inf
Applied rewrites34.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6432.6
Applied rewrites32.6%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
*-commutativeN/A
div-addN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites87.0%
if 5e12 < c Initial program 80.1%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.6
Applied rewrites84.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.3
Applied rewrites84.3%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(*
c_s
(if (<= t 1.28e+26)
(/ (fma (* a t) -4.0 (/ (fma (* y x) 9.0 b) z)) c_m)
(* (fma (/ a c_m) -4.0 (/ b (* (* t z) c_m))) t))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double tmp;
if (t <= 1.28e+26) {
tmp = fma((a * t), -4.0, (fma((y * x), 9.0, b) / z)) / c_m;
} else {
tmp = fma((a / c_m), -4.0, (b / ((t * z) * c_m))) * t;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) tmp = 0.0 if (t <= 1.28e+26) tmp = Float64(fma(Float64(a * t), -4.0, Float64(fma(Float64(y * x), 9.0, b) / z)) / c_m); else tmp = Float64(fma(Float64(a / c_m), -4.0, Float64(b / Float64(Float64(t * z) * c_m))) * t); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * If[LessEqual[t, 1.28e+26], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], N[(N[(N[(a / c$95$m), $MachinePrecision] * -4.0 + N[(b / N[(N[(t * z), $MachinePrecision] * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 1.28 \cdot 10^{+26}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z}\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{c\_m}, -4, \frac{b}{\left(t \cdot z\right) \cdot c\_m}\right) \cdot t\\
\end{array}
\end{array}
if t < 1.28e26Initial program 80.1%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in c around 0
lower-/.f64N/A
Applied rewrites86.5%
if 1.28e26 < t Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in x around 0
Applied rewrites60.8%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (* (fma (/ a c_m) -4.0 (/ b (* (* t z) c_m))) t)))
(*
c_s
(if (<= t -1.35e+77)
t_1
(if (<= t -5e-43)
(- (/ (* (- (* (/ x c_m) -9.0) (/ b (* c_m y))) y) z))
(if (<= t -6.3e-173)
(/ (fma (* a t) -4.0 (/ b z)) c_m)
(if (<= t 3.9e-24) (/ (fma (* y x) 9.0 b) (* z c_m)) t_1)))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = fma((a / c_m), -4.0, (b / ((t * z) * c_m))) * t;
double tmp;
if (t <= -1.35e+77) {
tmp = t_1;
} else if (t <= -5e-43) {
tmp = -(((((x / c_m) * -9.0) - (b / (c_m * y))) * y) / z);
} else if (t <= -6.3e-173) {
tmp = fma((a * t), -4.0, (b / z)) / c_m;
} else if (t <= 3.9e-24) {
tmp = fma((y * x), 9.0, b) / (z * c_m);
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(fma(Float64(a / c_m), -4.0, Float64(b / Float64(Float64(t * z) * c_m))) * t) tmp = 0.0 if (t <= -1.35e+77) tmp = t_1; elseif (t <= -5e-43) tmp = Float64(-Float64(Float64(Float64(Float64(Float64(x / c_m) * -9.0) - Float64(b / Float64(c_m * y))) * y) / z)); elseif (t <= -6.3e-173) tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c_m); elseif (t <= 3.9e-24) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c_m)); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(a / c$95$m), $MachinePrecision] * -4.0 + N[(b / N[(N[(t * z), $MachinePrecision] * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t, -1.35e+77], t$95$1, If[LessEqual[t, -5e-43], (-N[(N[(N[(N[(N[(x / c$95$m), $MachinePrecision] * -9.0), $MachinePrecision] - N[(b / N[(c$95$m * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]), If[LessEqual[t, -6.3e-173], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[t, 3.9e-24], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision], t$95$1]]]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a}{c\_m}, -4, \frac{b}{\left(t \cdot z\right) \cdot c\_m}\right) \cdot t\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5 \cdot 10^{-43}:\\
\;\;\;\;-\frac{\left(\frac{x}{c\_m} \cdot -9 - \frac{b}{c\_m \cdot y}\right) \cdot y}{z}\\
\mathbf{elif}\;t \leq -6.3 \cdot 10^{-173}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c\_m}\\
\mathbf{elif}\;t \leq 3.9 \cdot 10^{-24}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if t < -1.3499999999999999e77 or 3.9e-24 < t Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in x around 0
Applied rewrites60.8%
if -1.3499999999999999e77 < t < -5.00000000000000019e-43Initial program 80.1%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.0%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6455.4
Applied rewrites55.4%
if -5.00000000000000019e-43 < t < -6.29999999999999968e-173Initial program 80.1%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in c around 0
lower-/.f64N/A
Applied rewrites86.5%
Taylor expanded in x around 0
Applied rewrites64.0%
if -6.29999999999999968e-173 < t < 3.9e-24Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(*
c_s
(if (<= z -7.5e-69)
(* (fma (/ a c_m) -4.0 (/ b (* (* t z) c_m))) t)
(if (<= z 5.6e+82)
(/ (fma (* y x) 9.0 b) (* z c_m))
(/ (fma (* a t) -4.0 (* (* x (/ y z)) 9.0)) c_m)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double tmp;
if (z <= -7.5e-69) {
tmp = fma((a / c_m), -4.0, (b / ((t * z) * c_m))) * t;
} else if (z <= 5.6e+82) {
tmp = fma((y * x), 9.0, b) / (z * c_m);
} else {
tmp = fma((a * t), -4.0, ((x * (y / z)) * 9.0)) / c_m;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) tmp = 0.0 if (z <= -7.5e-69) tmp = Float64(fma(Float64(a / c_m), -4.0, Float64(b / Float64(Float64(t * z) * c_m))) * t); elseif (z <= 5.6e+82) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c_m)); else tmp = Float64(fma(Float64(a * t), -4.0, Float64(Float64(x * Float64(y / z)) * 9.0)) / c_m); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * If[LessEqual[z, -7.5e-69], N[(N[(N[(a / c$95$m), $MachinePrecision] * -4.0 + N[(b / N[(N[(t * z), $MachinePrecision] * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 5.6e+82], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-69}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{c\_m}, -4, \frac{b}{\left(t \cdot z\right) \cdot c\_m}\right) \cdot t\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+82}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \left(x \cdot \frac{y}{z}\right) \cdot 9\right)}{c\_m}\\
\end{array}
\end{array}
if z < -7.5e-69Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in x around 0
Applied rewrites60.8%
if -7.5e-69 < z < 5.6000000000000001e82Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
if 5.6000000000000001e82 < z Initial program 80.1%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in c around 0
lower-/.f64N/A
Applied rewrites86.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6464.6
Applied rewrites64.6%
lift-*.f64N/A
*-commutativeN/A
lower-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.9
Applied rewrites65.9%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (/ (fma (* -4.0 a) t (/ b z)) c_m)))
(*
c_s
(if (<= b -2.6e+86)
t_1
(if (<= b 1.55e+28)
(/ (fma (* a t) -4.0 (* (* x (/ y z)) 9.0)) c_m)
t_1)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = fma((-4.0 * a), t, (b / z)) / c_m;
double tmp;
if (b <= -2.6e+86) {
tmp = t_1;
} else if (b <= 1.55e+28) {
tmp = fma((a * t), -4.0, ((x * (y / z)) * 9.0)) / c_m;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(fma(Float64(-4.0 * a), t, Float64(b / z)) / c_m) tmp = 0.0 if (b <= -2.6e+86) tmp = t_1; elseif (b <= 1.55e+28) tmp = Float64(fma(Float64(a * t), -4.0, Float64(Float64(x * Float64(y / z)) * 9.0)) / c_m); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(b / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision]}, N[(c$95$s * If[LessEqual[b, -2.6e+86], t$95$1, If[LessEqual[b, 1.55e+28], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{b}{z}\right)}{c\_m}\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{+86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 1.55 \cdot 10^{+28}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \left(x \cdot \frac{y}{z}\right) \cdot 9\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if b < -2.5999999999999998e86 or 1.55e28 < b Initial program 80.1%
Taylor expanded in b around inf
Applied rewrites34.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6432.6
Applied rewrites32.6%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
*-commutativeN/A
div-addN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites87.0%
Taylor expanded in x around 0
Applied rewrites64.2%
if -2.5999999999999998e86 < b < 1.55e28Initial program 80.1%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in c around 0
lower-/.f64N/A
Applied rewrites86.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6464.6
Applied rewrites64.6%
lift-*.f64N/A
*-commutativeN/A
lower-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.9
Applied rewrites65.9%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (/ (fma (* a t) -4.0 (/ b z)) c_m)))
(*
c_s
(if (<= z -7.8e-69)
t_1
(if (<= z 3e-77) (/ (fma (* y x) 9.0 b) (* z c_m)) t_1)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = fma((a * t), -4.0, (b / z)) / c_m;
double tmp;
if (z <= -7.8e-69) {
tmp = t_1;
} else if (z <= 3e-77) {
tmp = fma((y * x), 9.0, b) / (z * c_m);
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c_m) tmp = 0.0 if (z <= -7.8e-69) tmp = t_1; elseif (z <= 3e-77) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c_m)); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision]}, N[(c$95$s * If[LessEqual[z, -7.8e-69], t$95$1, If[LessEqual[z, 3e-77], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c\_m}\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-77}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -7.79999999999999961e-69 or 3.00000000000000016e-77 < z Initial program 80.1%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in c around 0
lower-/.f64N/A
Applied rewrites86.5%
Taylor expanded in x around 0
Applied rewrites64.0%
if -7.79999999999999961e-69 < z < 3.00000000000000016e-77Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (* (* (/ a c_m) -4.0) t)))
(*
c_s
(if (<= t -1.28e+91)
t_1
(if (<= t 2.3e+52) (/ (fma (* y x) 9.0 b) (* z c_m)) t_1)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((a / c_m) * -4.0) * t;
double tmp;
if (t <= -1.28e+91) {
tmp = t_1;
} else if (t <= 2.3e+52) {
tmp = fma((y * x), 9.0, b) / (z * c_m);
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(Float64(a / c_m) * -4.0) * t) tmp = 0.0 if (t <= -1.28e+91) tmp = t_1; elseif (t <= 2.3e+52) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c_m)); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(a / c$95$m), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t, -1.28e+91], t$95$1, If[LessEqual[t, 2.3e+52], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \left(\frac{a}{c\_m} \cdot -4\right) \cdot t\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.28 \cdot 10^{+91}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{+52}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if t < -1.27999999999999999e91 or 2.3e52 < t Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6441.4
Applied rewrites41.4%
if -1.27999999999999999e91 < t < 2.3e52Initial program 80.1%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (* (* (/ a c_m) -4.0) t)))
(*
c_s
(if (<= t -1.28e+91)
t_1
(if (<= t 2.3e+52) (/ (fma (* 9.0 x) y b) (* c_m z)) t_1)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((a / c_m) * -4.0) * t;
double tmp;
if (t <= -1.28e+91) {
tmp = t_1;
} else if (t <= 2.3e+52) {
tmp = fma((9.0 * x), y, b) / (c_m * z);
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(Float64(a / c_m) * -4.0) * t) tmp = 0.0 if (t <= -1.28e+91) tmp = t_1; elseif (t <= 2.3e+52) tmp = Float64(fma(Float64(9.0 * x), y, b) / Float64(c_m * z)); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(a / c$95$m), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t, -1.28e+91], t$95$1, If[LessEqual[t, 2.3e+52], N[(N[(N[(9.0 * x), $MachinePrecision] * y + b), $MachinePrecision] / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \left(\frac{a}{c\_m} \cdot -4\right) \cdot t\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.28 \cdot 10^{+91}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{+52}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c\_m \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if t < -1.27999999999999999e91 or 2.3e52 < t Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6441.4
Applied rewrites41.4%
if -1.27999999999999999e91 < t < 2.3e52Initial program 80.1%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in c around 0
lower-/.f64N/A
Applied rewrites86.5%
Taylor expanded in z around 0
associate-/l/N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
lower-/.f64N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f6459.3
Applied rewrites59.3%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (* (* (/ a c_m) -4.0) t)))
(*
c_s
(if (<= t -1.4e+77)
t_1
(if (<= t -12000.0)
(- (* (/ (* -9.0 x) (* c_m z)) y))
(if (<= t -5.5e-252)
(* (/ b (* (* t z) c_m)) t)
(if (<= t 1.55e+48) (- (* (* (/ x (* c_m z)) -9.0) y)) t_1)))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((a / c_m) * -4.0) * t;
double tmp;
if (t <= -1.4e+77) {
tmp = t_1;
} else if (t <= -12000.0) {
tmp = -(((-9.0 * x) / (c_m * z)) * y);
} else if (t <= -5.5e-252) {
tmp = (b / ((t * z) * c_m)) * t;
} else if (t <= 1.55e+48) {
tmp = -(((x / (c_m * z)) * -9.0) * y);
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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), intent (in) :: b
real(8), intent (in) :: c_m
real(8) :: t_1
real(8) :: tmp
t_1 = ((a / c_m) * (-4.0d0)) * t
if (t <= (-1.4d+77)) then
tmp = t_1
else if (t <= (-12000.0d0)) then
tmp = -((((-9.0d0) * x) / (c_m * z)) * y)
else if (t <= (-5.5d-252)) then
tmp = (b / ((t * z) * c_m)) * t
else if (t <= 1.55d+48) then
tmp = -(((x / (c_m * z)) * (-9.0d0)) * y)
else
tmp = t_1
end if
code = c_s * tmp
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((a / c_m) * -4.0) * t;
double tmp;
if (t <= -1.4e+77) {
tmp = t_1;
} else if (t <= -12000.0) {
tmp = -(((-9.0 * x) / (c_m * z)) * y);
} else if (t <= -5.5e-252) {
tmp = (b / ((t * z) * c_m)) * t;
} else if (t <= 1.55e+48) {
tmp = -(((x / (c_m * z)) * -9.0) * y);
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): t_1 = ((a / c_m) * -4.0) * t tmp = 0 if t <= -1.4e+77: tmp = t_1 elif t <= -12000.0: tmp = -(((-9.0 * x) / (c_m * z)) * y) elif t <= -5.5e-252: tmp = (b / ((t * z) * c_m)) * t elif t <= 1.55e+48: tmp = -(((x / (c_m * z)) * -9.0) * y) else: tmp = t_1 return c_s * tmp
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(Float64(a / c_m) * -4.0) * t) tmp = 0.0 if (t <= -1.4e+77) tmp = t_1; elseif (t <= -12000.0) tmp = Float64(-Float64(Float64(Float64(-9.0 * x) / Float64(c_m * z)) * y)); elseif (t <= -5.5e-252) tmp = Float64(Float64(b / Float64(Float64(t * z) * c_m)) * t); elseif (t <= 1.55e+48) tmp = Float64(-Float64(Float64(Float64(x / Float64(c_m * z)) * -9.0) * y)); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp_2 = code(c_s, x, y, z, t, a, b, c_m)
t_1 = ((a / c_m) * -4.0) * t;
tmp = 0.0;
if (t <= -1.4e+77)
tmp = t_1;
elseif (t <= -12000.0)
tmp = -(((-9.0 * x) / (c_m * z)) * y);
elseif (t <= -5.5e-252)
tmp = (b / ((t * z) * c_m)) * t;
elseif (t <= 1.55e+48)
tmp = -(((x / (c_m * z)) * -9.0) * y);
else
tmp = t_1;
end
tmp_2 = c_s * tmp;
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(a / c$95$m), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t, -1.4e+77], t$95$1, If[LessEqual[t, -12000.0], (-N[(N[(N[(-9.0 * x), $MachinePrecision] / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), If[LessEqual[t, -5.5e-252], N[(N[(b / N[(N[(t * z), $MachinePrecision] * c$95$m), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t, 1.55e+48], (-N[(N[(N[(x / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision] * y), $MachinePrecision]), t$95$1]]]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \left(\frac{a}{c\_m} \cdot -4\right) \cdot t\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -12000:\\
\;\;\;\;-\frac{-9 \cdot x}{c\_m \cdot z} \cdot y\\
\mathbf{elif}\;t \leq -5.5 \cdot 10^{-252}:\\
\;\;\;\;\frac{b}{\left(t \cdot z\right) \cdot c\_m} \cdot t\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{+48}:\\
\;\;\;\;-\left(\frac{x}{c\_m \cdot z} \cdot -9\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if t < -1.4e77 or 1.55000000000000003e48 < t Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6441.4
Applied rewrites41.4%
if -1.4e77 < t < -12000Initial program 80.1%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6437.7
Applied rewrites37.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f6437.6
Applied rewrites37.6%
if -12000 < t < -5.5e-252Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in b around inf
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6430.1
Applied rewrites30.1%
if -5.5e-252 < t < 1.55000000000000003e48Initial program 80.1%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6437.7
Applied rewrites37.7%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (- (* (* (/ x (* c_m z)) -9.0) y)))
(t_2 (* (* (/ a c_m) -4.0) t)))
(*
c_s
(if (<= t -1.9e+86)
t_2
(if (<= t -4500.0)
t_1
(if (<= t -5.5e-252)
(* (/ b (* (* t z) c_m)) t)
(if (<= t 1.55e+48) t_1 t_2)))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = -(((x / (c_m * z)) * -9.0) * y);
double t_2 = ((a / c_m) * -4.0) * t;
double tmp;
if (t <= -1.9e+86) {
tmp = t_2;
} else if (t <= -4500.0) {
tmp = t_1;
} else if (t <= -5.5e-252) {
tmp = (b / ((t * z) * c_m)) * t;
} else if (t <= 1.55e+48) {
tmp = t_1;
} else {
tmp = t_2;
}
return c_s * tmp;
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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), intent (in) :: b
real(8), intent (in) :: c_m
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = -(((x / (c_m * z)) * (-9.0d0)) * y)
t_2 = ((a / c_m) * (-4.0d0)) * t
if (t <= (-1.9d+86)) then
tmp = t_2
else if (t <= (-4500.0d0)) then
tmp = t_1
else if (t <= (-5.5d-252)) then
tmp = (b / ((t * z) * c_m)) * t
else if (t <= 1.55d+48) then
tmp = t_1
else
tmp = t_2
end if
code = c_s * tmp
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = -(((x / (c_m * z)) * -9.0) * y);
double t_2 = ((a / c_m) * -4.0) * t;
double tmp;
if (t <= -1.9e+86) {
tmp = t_2;
} else if (t <= -4500.0) {
tmp = t_1;
} else if (t <= -5.5e-252) {
tmp = (b / ((t * z) * c_m)) * t;
} else if (t <= 1.55e+48) {
tmp = t_1;
} else {
tmp = t_2;
}
return c_s * tmp;
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): t_1 = -(((x / (c_m * z)) * -9.0) * y) t_2 = ((a / c_m) * -4.0) * t tmp = 0 if t <= -1.9e+86: tmp = t_2 elif t <= -4500.0: tmp = t_1 elif t <= -5.5e-252: tmp = (b / ((t * z) * c_m)) * t elif t <= 1.55e+48: tmp = t_1 else: tmp = t_2 return c_s * tmp
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(-Float64(Float64(Float64(x / Float64(c_m * z)) * -9.0) * y)) t_2 = Float64(Float64(Float64(a / c_m) * -4.0) * t) tmp = 0.0 if (t <= -1.9e+86) tmp = t_2; elseif (t <= -4500.0) tmp = t_1; elseif (t <= -5.5e-252) tmp = Float64(Float64(b / Float64(Float64(t * z) * c_m)) * t); elseif (t <= 1.55e+48) tmp = t_1; else tmp = t_2; end return Float64(c_s * tmp) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp_2 = code(c_s, x, y, z, t, a, b, c_m)
t_1 = -(((x / (c_m * z)) * -9.0) * y);
t_2 = ((a / c_m) * -4.0) * t;
tmp = 0.0;
if (t <= -1.9e+86)
tmp = t_2;
elseif (t <= -4500.0)
tmp = t_1;
elseif (t <= -5.5e-252)
tmp = (b / ((t * z) * c_m)) * t;
elseif (t <= 1.55e+48)
tmp = t_1;
else
tmp = t_2;
end
tmp_2 = c_s * tmp;
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = (-N[(N[(N[(x / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision] * y), $MachinePrecision])}, Block[{t$95$2 = N[(N[(N[(a / c$95$m), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t, -1.9e+86], t$95$2, If[LessEqual[t, -4500.0], t$95$1, If[LessEqual[t, -5.5e-252], N[(N[(b / N[(N[(t * z), $MachinePrecision] * c$95$m), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t, 1.55e+48], t$95$1, t$95$2]]]]), $MachinePrecision]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := -\left(\frac{x}{c\_m \cdot z} \cdot -9\right) \cdot y\\
t_2 := \left(\frac{a}{c\_m} \cdot -4\right) \cdot t\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+86}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -4500:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5.5 \cdot 10^{-252}:\\
\;\;\;\;\frac{b}{\left(t \cdot z\right) \cdot c\_m} \cdot t\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
\end{array}
if t < -1.89999999999999989e86 or 1.55000000000000003e48 < t Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6441.4
Applied rewrites41.4%
if -1.89999999999999989e86 < t < -4500 or -5.5e-252 < t < 1.55000000000000003e48Initial program 80.1%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6437.7
Applied rewrites37.7%
if -4500 < t < -5.5e-252Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in b around inf
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6430.1
Applied rewrites30.1%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (/ (* (* y x) 9.0) (* z c_m))) (t_2 (* (* (/ a c_m) -4.0) t)))
(*
c_s
(if (<= t -1.35e+77)
t_2
(if (<= t -1.7e-42)
t_1
(if (<= t -1.8e-257) (/ (/ b z) c_m) (if (<= t 1.45e+48) t_1 t_2)))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((y * x) * 9.0) / (z * c_m);
double t_2 = ((a / c_m) * -4.0) * t;
double tmp;
if (t <= -1.35e+77) {
tmp = t_2;
} else if (t <= -1.7e-42) {
tmp = t_1;
} else if (t <= -1.8e-257) {
tmp = (b / z) / c_m;
} else if (t <= 1.45e+48) {
tmp = t_1;
} else {
tmp = t_2;
}
return c_s * tmp;
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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), intent (in) :: b
real(8), intent (in) :: c_m
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((y * x) * 9.0d0) / (z * c_m)
t_2 = ((a / c_m) * (-4.0d0)) * t
if (t <= (-1.35d+77)) then
tmp = t_2
else if (t <= (-1.7d-42)) then
tmp = t_1
else if (t <= (-1.8d-257)) then
tmp = (b / z) / c_m
else if (t <= 1.45d+48) then
tmp = t_1
else
tmp = t_2
end if
code = c_s * tmp
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((y * x) * 9.0) / (z * c_m);
double t_2 = ((a / c_m) * -4.0) * t;
double tmp;
if (t <= -1.35e+77) {
tmp = t_2;
} else if (t <= -1.7e-42) {
tmp = t_1;
} else if (t <= -1.8e-257) {
tmp = (b / z) / c_m;
} else if (t <= 1.45e+48) {
tmp = t_1;
} else {
tmp = t_2;
}
return c_s * tmp;
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): t_1 = ((y * x) * 9.0) / (z * c_m) t_2 = ((a / c_m) * -4.0) * t tmp = 0 if t <= -1.35e+77: tmp = t_2 elif t <= -1.7e-42: tmp = t_1 elif t <= -1.8e-257: tmp = (b / z) / c_m elif t <= 1.45e+48: tmp = t_1 else: tmp = t_2 return c_s * tmp
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(Float64(y * x) * 9.0) / Float64(z * c_m)) t_2 = Float64(Float64(Float64(a / c_m) * -4.0) * t) tmp = 0.0 if (t <= -1.35e+77) tmp = t_2; elseif (t <= -1.7e-42) tmp = t_1; elseif (t <= -1.8e-257) tmp = Float64(Float64(b / z) / c_m); elseif (t <= 1.45e+48) tmp = t_1; else tmp = t_2; end return Float64(c_s * tmp) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp_2 = code(c_s, x, y, z, t, a, b, c_m)
t_1 = ((y * x) * 9.0) / (z * c_m);
t_2 = ((a / c_m) * -4.0) * t;
tmp = 0.0;
if (t <= -1.35e+77)
tmp = t_2;
elseif (t <= -1.7e-42)
tmp = t_1;
elseif (t <= -1.8e-257)
tmp = (b / z) / c_m;
elseif (t <= 1.45e+48)
tmp = t_1;
else
tmp = t_2;
end
tmp_2 = c_s * tmp;
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(y * x), $MachinePrecision] * 9.0), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a / c$95$m), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t, -1.35e+77], t$95$2, If[LessEqual[t, -1.7e-42], t$95$1, If[LessEqual[t, -1.8e-257], N[(N[(b / z), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[t, 1.45e+48], t$95$1, t$95$2]]]]), $MachinePrecision]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{\left(y \cdot x\right) \cdot 9}{z \cdot c\_m}\\
t_2 := \left(\frac{a}{c\_m} \cdot -4\right) \cdot t\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+77}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -1.7 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-257}:\\
\;\;\;\;\frac{\frac{b}{z}}{c\_m}\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
\end{array}
if t < -1.3499999999999999e77 or 1.4499999999999999e48 < t Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6441.4
Applied rewrites41.4%
if -1.3499999999999999e77 < t < -1.70000000000000011e-42 or -1.80000000000000003e-257 < t < 1.4499999999999999e48Initial program 80.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6435.9
Applied rewrites35.9%
if -1.70000000000000011e-42 < t < -1.80000000000000003e-257Initial program 80.1%
Taylor expanded in b around inf
Applied rewrites34.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6432.6
Applied rewrites32.6%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (/ (* (* 9.0 x) y) (* c_m z))) (t_2 (* (* (/ a c_m) -4.0) t)))
(*
c_s
(if (<= t -1.35e+77)
t_2
(if (<= t -1.7e-42)
t_1
(if (<= t -1.8e-257) (/ (/ b z) c_m) (if (<= t 1.45e+48) t_1 t_2)))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((9.0 * x) * y) / (c_m * z);
double t_2 = ((a / c_m) * -4.0) * t;
double tmp;
if (t <= -1.35e+77) {
tmp = t_2;
} else if (t <= -1.7e-42) {
tmp = t_1;
} else if (t <= -1.8e-257) {
tmp = (b / z) / c_m;
} else if (t <= 1.45e+48) {
tmp = t_1;
} else {
tmp = t_2;
}
return c_s * tmp;
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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), intent (in) :: b
real(8), intent (in) :: c_m
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((9.0d0 * x) * y) / (c_m * z)
t_2 = ((a / c_m) * (-4.0d0)) * t
if (t <= (-1.35d+77)) then
tmp = t_2
else if (t <= (-1.7d-42)) then
tmp = t_1
else if (t <= (-1.8d-257)) then
tmp = (b / z) / c_m
else if (t <= 1.45d+48) then
tmp = t_1
else
tmp = t_2
end if
code = c_s * tmp
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((9.0 * x) * y) / (c_m * z);
double t_2 = ((a / c_m) * -4.0) * t;
double tmp;
if (t <= -1.35e+77) {
tmp = t_2;
} else if (t <= -1.7e-42) {
tmp = t_1;
} else if (t <= -1.8e-257) {
tmp = (b / z) / c_m;
} else if (t <= 1.45e+48) {
tmp = t_1;
} else {
tmp = t_2;
}
return c_s * tmp;
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): t_1 = ((9.0 * x) * y) / (c_m * z) t_2 = ((a / c_m) * -4.0) * t tmp = 0 if t <= -1.35e+77: tmp = t_2 elif t <= -1.7e-42: tmp = t_1 elif t <= -1.8e-257: tmp = (b / z) / c_m elif t <= 1.45e+48: tmp = t_1 else: tmp = t_2 return c_s * tmp
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(Float64(9.0 * x) * y) / Float64(c_m * z)) t_2 = Float64(Float64(Float64(a / c_m) * -4.0) * t) tmp = 0.0 if (t <= -1.35e+77) tmp = t_2; elseif (t <= -1.7e-42) tmp = t_1; elseif (t <= -1.8e-257) tmp = Float64(Float64(b / z) / c_m); elseif (t <= 1.45e+48) tmp = t_1; else tmp = t_2; end return Float64(c_s * tmp) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp_2 = code(c_s, x, y, z, t, a, b, c_m)
t_1 = ((9.0 * x) * y) / (c_m * z);
t_2 = ((a / c_m) * -4.0) * t;
tmp = 0.0;
if (t <= -1.35e+77)
tmp = t_2;
elseif (t <= -1.7e-42)
tmp = t_1;
elseif (t <= -1.8e-257)
tmp = (b / z) / c_m;
elseif (t <= 1.45e+48)
tmp = t_1;
else
tmp = t_2;
end
tmp_2 = c_s * tmp;
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(9.0 * x), $MachinePrecision] * y), $MachinePrecision] / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a / c$95$m), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t, -1.35e+77], t$95$2, If[LessEqual[t, -1.7e-42], t$95$1, If[LessEqual[t, -1.8e-257], N[(N[(b / z), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[t, 1.45e+48], t$95$1, t$95$2]]]]), $MachinePrecision]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{\left(9 \cdot x\right) \cdot y}{c\_m \cdot z}\\
t_2 := \left(\frac{a}{c\_m} \cdot -4\right) \cdot t\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+77}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -1.7 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-257}:\\
\;\;\;\;\frac{\frac{b}{z}}{c\_m}\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
\end{array}
if t < -1.3499999999999999e77 or 1.4499999999999999e48 < t Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6441.4
Applied rewrites41.4%
if -1.3499999999999999e77 < t < -1.70000000000000011e-42 or -1.80000000000000003e-257 < t < 1.4499999999999999e48Initial program 80.1%
Taylor expanded in b around inf
Applied rewrites34.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6432.6
Applied rewrites32.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6434.6
Applied rewrites34.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites35.8%
if -1.70000000000000011e-42 < t < -1.80000000000000003e-257Initial program 80.1%
Taylor expanded in b around inf
Applied rewrites34.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6432.6
Applied rewrites32.6%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (/ b (* z c_m))))
(*
c_s
(if (<= b -4.2e+116)
t_1
(if (<= b 5.4e+72) (* (* (/ a c_m) -4.0) t) t_1)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = b / (z * c_m);
double tmp;
if (b <= -4.2e+116) {
tmp = t_1;
} else if (b <= 5.4e+72) {
tmp = ((a / c_m) * -4.0) * t;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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), intent (in) :: b
real(8), intent (in) :: c_m
real(8) :: t_1
real(8) :: tmp
t_1 = b / (z * c_m)
if (b <= (-4.2d+116)) then
tmp = t_1
else if (b <= 5.4d+72) then
tmp = ((a / c_m) * (-4.0d0)) * t
else
tmp = t_1
end if
code = c_s * tmp
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = b / (z * c_m);
double tmp;
if (b <= -4.2e+116) {
tmp = t_1;
} else if (b <= 5.4e+72) {
tmp = ((a / c_m) * -4.0) * t;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): t_1 = b / (z * c_m) tmp = 0 if b <= -4.2e+116: tmp = t_1 elif b <= 5.4e+72: tmp = ((a / c_m) * -4.0) * t else: tmp = t_1 return c_s * tmp
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(b / Float64(z * c_m)) tmp = 0.0 if (b <= -4.2e+116) tmp = t_1; elseif (b <= 5.4e+72) tmp = Float64(Float64(Float64(a / c_m) * -4.0) * t); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp_2 = code(c_s, x, y, z, t, a, b, c_m)
t_1 = b / (z * c_m);
tmp = 0.0;
if (b <= -4.2e+116)
tmp = t_1;
elseif (b <= 5.4e+72)
tmp = ((a / c_m) * -4.0) * t;
else
tmp = t_1;
end
tmp_2 = c_s * tmp;
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(b / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision]}, N[(c$95$s * If[LessEqual[b, -4.2e+116], t$95$1, If[LessEqual[b, 5.4e+72], N[(N[(N[(a / c$95$m), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{b}{z \cdot c\_m}\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;b \leq -4.2 \cdot 10^{+116}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{+72}:\\
\;\;\;\;\left(\frac{a}{c\_m} \cdot -4\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if b < -4.2000000000000002e116 or 5.4000000000000001e72 < b Initial program 80.1%
Taylor expanded in b around inf
Applied rewrites34.3%
if -4.2000000000000002e116 < b < 5.4000000000000001e72Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6441.4
Applied rewrites41.4%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (/ b (* z c_m))))
(*
c_s
(if (<= b -4.2e+116)
t_1
(if (<= b 5.4e+72) (* -4.0 (/ (* a t) c_m)) t_1)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = b / (z * c_m);
double tmp;
if (b <= -4.2e+116) {
tmp = t_1;
} else if (b <= 5.4e+72) {
tmp = -4.0 * ((a * t) / c_m);
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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), intent (in) :: b
real(8), intent (in) :: c_m
real(8) :: t_1
real(8) :: tmp
t_1 = b / (z * c_m)
if (b <= (-4.2d+116)) then
tmp = t_1
else if (b <= 5.4d+72) then
tmp = (-4.0d0) * ((a * t) / c_m)
else
tmp = t_1
end if
code = c_s * tmp
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = b / (z * c_m);
double tmp;
if (b <= -4.2e+116) {
tmp = t_1;
} else if (b <= 5.4e+72) {
tmp = -4.0 * ((a * t) / c_m);
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): t_1 = b / (z * c_m) tmp = 0 if b <= -4.2e+116: tmp = t_1 elif b <= 5.4e+72: tmp = -4.0 * ((a * t) / c_m) else: tmp = t_1 return c_s * tmp
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(b / Float64(z * c_m)) tmp = 0.0 if (b <= -4.2e+116) tmp = t_1; elseif (b <= 5.4e+72) tmp = Float64(-4.0 * Float64(Float64(a * t) / c_m)); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp_2 = code(c_s, x, y, z, t, a, b, c_m)
t_1 = b / (z * c_m);
tmp = 0.0;
if (b <= -4.2e+116)
tmp = t_1;
elseif (b <= 5.4e+72)
tmp = -4.0 * ((a * t) / c_m);
else
tmp = t_1;
end
tmp_2 = c_s * tmp;
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(b / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision]}, N[(c$95$s * If[LessEqual[b, -4.2e+116], t$95$1, If[LessEqual[b, 5.4e+72], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{b}{z \cdot c\_m}\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;b \leq -4.2 \cdot 10^{+116}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{+72}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if b < -4.2000000000000002e116 or 5.4000000000000001e72 < b Initial program 80.1%
Taylor expanded in b around inf
Applied rewrites34.3%
if -4.2000000000000002e116 < b < 5.4000000000000001e72Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6439.3
Applied rewrites39.3%
c\_m = (fabs.f64 c) c\_s = (copysign.f64 #s(literal 1 binary64) c) NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function. (FPCore (c_s x y z t a b c_m) :precision binary64 (* c_s (/ b (* z c_m))))
c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
return c_s * (b / (z * c_m));
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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), intent (in) :: b
real(8), intent (in) :: c_m
code = c_s * (b / (z * c_m))
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
return c_s * (b / (z * c_m));
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): return c_s * (b / (z * c_m))
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) return Float64(c_s * Float64(b / Float64(z * c_m))) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp = code(c_s, x, y, z, t, a, b, c_m)
tmp = c_s * (b / (z * c_m));
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * N[(b / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \frac{b}{z \cdot c\_m}
\end{array}
Initial program 80.1%
Taylor expanded in b around inf
Applied rewrites34.3%
herbie shell --seed 2025123
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, J"
:precision binary64
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))