
(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 19 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}
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(if (<= z -1.15e+39)
(fma (/ (* 9.0 y) c) (/ x z) (/ (fma (* -4.0 a) t (/ b z)) c))
(if (<= z 2.6e-26)
(/ (/ (fma (* a (* -4.0 z)) t (fma (* y x) 9.0 b)) c) z)
(/ (fma (* -4.0 t) a (/ (fma (* x y) 9.0 b) z)) c))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -1.15e+39) {
tmp = fma(((9.0 * y) / c), (x / z), (fma((-4.0 * a), t, (b / z)) / c));
} else if (z <= 2.6e-26) {
tmp = (fma((a * (-4.0 * z)), t, fma((y * x), 9.0, b)) / c) / z;
} else {
tmp = fma((-4.0 * t), a, (fma((x * y), 9.0, b) / z)) / c;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -1.15e+39) tmp = fma(Float64(Float64(9.0 * y) / c), Float64(x / z), Float64(fma(Float64(-4.0 * a), t, Float64(b / z)) / c)); elseif (z <= 2.6e-26) tmp = Float64(Float64(fma(Float64(a * Float64(-4.0 * z)), t, fma(Float64(y * x), 9.0, b)) / c) / z); else tmp = Float64(fma(Float64(-4.0 * t), a, Float64(fma(Float64(x * y), 9.0, b) / z)) / c); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -1.15e+39], N[(N[(N[(9.0 * y), $MachinePrecision] / c), $MachinePrecision] * N[(x / z), $MachinePrecision] + N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e-26], N[(N[(N[(N[(a * N[(-4.0 * z), $MachinePrecision]), $MachinePrecision] * t + N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(\frac{9 \cdot y}{c}, \frac{x}{z}, \frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{b}{z}\right)}{c}\right)\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-26}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(a \cdot \left(-4 \cdot z\right), t, \mathsf{fma}\left(y \cdot x, 9, b\right)\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{z}\right)}{c}\\
\end{array}
\end{array}
if z < -1.15000000000000006e39Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites79.9%
if -1.15000000000000006e39 < z < 2.6000000000000001e-26Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
if 2.6000000000000001e-26 < z Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6487.4
Applied rewrites87.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (fma (* -4.0 t) a (/ (fma (* x y) 9.0 b) z)) c)))
(if (<= z -2e-5)
t_1
(if (<= z 2.6e-26)
(/ (/ (fma (* a (* -4.0 z)) t (fma (* y x) 9.0 b)) c) z)
t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((-4.0 * t), a, (fma((x * y), 9.0, b) / z)) / c;
double tmp;
if (z <= -2e-5) {
tmp = t_1;
} else if (z <= 2.6e-26) {
tmp = (fma((a * (-4.0 * z)), t, fma((y * x), 9.0, b)) / c) / z;
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(fma(Float64(-4.0 * t), a, Float64(fma(Float64(x * y), 9.0, b) / z)) / c) tmp = 0.0 if (z <= -2e-5) tmp = t_1; elseif (z <= 2.6e-26) tmp = Float64(Float64(fma(Float64(a * Float64(-4.0 * z)), t, fma(Float64(y * x), 9.0, b)) / c) / z); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[z, -2e-5], t$95$1, If[LessEqual[z, 2.6e-26], N[(N[(N[(N[(a * N[(-4.0 * z), $MachinePrecision]), $MachinePrecision] * t + N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{z}\right)}{c}\\
\mathbf{if}\;z \leq -2 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-26}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(a \cdot \left(-4 \cdot z\right), t, \mathsf{fma}\left(y \cdot x, 9, b\right)\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.00000000000000016e-5 or 2.6000000000000001e-26 < z Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6487.4
Applied rewrites87.4%
if -2.00000000000000016e-5 < z < 2.6000000000000001e-26Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (<= c 8.5e+68) (/ (fma (* -4.0 t) a (/ (fma (* x y) 9.0 b) z)) c) (fma (* t -4.0) (/ a c) (/ (fma (* x 9.0) y b) (* c z)))))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (c <= 8.5e+68) {
tmp = fma((-4.0 * t), a, (fma((x * y), 9.0, b) / z)) / c;
} else {
tmp = fma((t * -4.0), (a / c), (fma((x * 9.0), y, b) / (c * z)));
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (c <= 8.5e+68) tmp = Float64(fma(Float64(-4.0 * t), a, Float64(fma(Float64(x * y), 9.0, b) / z)) / c); else tmp = fma(Float64(t * -4.0), Float64(a / c), Float64(fma(Float64(x * 9.0), y, b) / Float64(c * z))); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[c, 8.5e+68], N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(t * -4.0), $MachinePrecision] * N[(a / c), $MachinePrecision] + N[(N[(N[(x * 9.0), $MachinePrecision] * y + b), $MachinePrecision] / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;c \leq 8.5 \cdot 10^{+68}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot -4, \frac{a}{c}, \frac{\mathsf{fma}\left(x \cdot 9, y, b\right)}{c \cdot z}\right)\\
\end{array}
\end{array}
if c < 8.49999999999999966e68Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6487.4
Applied rewrites87.4%
if 8.49999999999999966e68 < c Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
associate-/l*N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
add-flipN/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
add-flipN/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites85.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(if (<= z -4.6e+51)
(* (fma (* a -4.0) t (/ (fma (* x 9.0) y b) z)) (/ 1.0 c))
(if (<= z 3.2e-21)
(/ (fma (* y x) 9.0 (fma -4.0 (* (* a t) z) b)) (* z c))
(/ (fma (* -4.0 t) a (/ (fma (* x y) 9.0 b) z)) c))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -4.6e+51) {
tmp = fma((a * -4.0), t, (fma((x * 9.0), y, b) / z)) * (1.0 / c);
} else if (z <= 3.2e-21) {
tmp = fma((y * x), 9.0, fma(-4.0, ((a * t) * z), b)) / (z * c);
} else {
tmp = fma((-4.0 * t), a, (fma((x * y), 9.0, b) / z)) / c;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -4.6e+51) tmp = Float64(fma(Float64(a * -4.0), t, Float64(fma(Float64(x * 9.0), y, b) / z)) * Float64(1.0 / c)); elseif (z <= 3.2e-21) tmp = Float64(fma(Float64(y * x), 9.0, fma(-4.0, Float64(Float64(a * t) * z), b)) / Float64(z * c)); else tmp = Float64(fma(Float64(-4.0 * t), a, Float64(fma(Float64(x * y), 9.0, b) / z)) / c); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -4.6e+51], N[(N[(N[(a * -4.0), $MachinePrecision] * t + N[(N[(N[(x * 9.0), $MachinePrecision] * y + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e-21], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + N[(-4.0 * N[(N[(a * t), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot -4, t, \frac{\mathsf{fma}\left(x \cdot 9, y, b\right)}{z}\right) \cdot \frac{1}{c}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, \mathsf{fma}\left(-4, \left(a \cdot t\right) \cdot z, b\right)\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{z}\right)}{c}\\
\end{array}
\end{array}
if z < -4.6000000000000001e51Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites87.3%
if -4.6000000000000001e51 < z < 3.2000000000000002e-21Initial program 80.1%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
add-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
add-flip-revN/A
lower-fma.f64N/A
lower-*.f64N/A
add-flip-revN/A
Applied rewrites80.9%
if 3.2000000000000002e-21 < z Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6487.4
Applied rewrites87.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (fma (* -4.0 t) a (/ (fma (* x y) 9.0 b) z)) c)))
(if (<= z -8.6e+45)
t_1
(if (<= z 3.2e-21)
(/ (fma (* y x) 9.0 (fma -4.0 (* (* a t) z) b)) (* z c))
t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((-4.0 * t), a, (fma((x * y), 9.0, b) / z)) / c;
double tmp;
if (z <= -8.6e+45) {
tmp = t_1;
} else if (z <= 3.2e-21) {
tmp = fma((y * x), 9.0, fma(-4.0, ((a * t) * z), b)) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(fma(Float64(-4.0 * t), a, Float64(fma(Float64(x * y), 9.0, b) / z)) / c) tmp = 0.0 if (z <= -8.6e+45) tmp = t_1; elseif (z <= 3.2e-21) tmp = Float64(fma(Float64(y * x), 9.0, fma(-4.0, Float64(Float64(a * t) * z), b)) / Float64(z * c)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[z, -8.6e+45], t$95$1, If[LessEqual[z, 3.2e-21], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + N[(-4.0 * N[(N[(a * t), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{z}\right)}{c}\\
\mathbf{if}\;z \leq -8.6 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, \mathsf{fma}\left(-4, \left(a \cdot t\right) \cdot z, b\right)\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.6000000000000006e45 or 3.2000000000000002e-21 < z Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6487.4
Applied rewrites87.4%
if -8.6000000000000006e45 < z < 3.2000000000000002e-21Initial program 80.1%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
add-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
add-flip-revN/A
lower-fma.f64N/A
lower-*.f64N/A
add-flip-revN/A
Applied rewrites80.9%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (<= x 2.7e+55) (/ (fma (* -4.0 t) a (/ (fma (* x y) 9.0 b) z)) c) (/ (* (* x 9.0) (/ y c)) z)))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (x <= 2.7e+55) {
tmp = fma((-4.0 * t), a, (fma((x * y), 9.0, b) / z)) / c;
} else {
tmp = ((x * 9.0) * (y / c)) / z;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (x <= 2.7e+55) tmp = Float64(fma(Float64(-4.0 * t), a, Float64(fma(Float64(x * y), 9.0, b) / z)) / c); else tmp = Float64(Float64(Float64(x * 9.0) * Float64(y / c)) / z); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[x, 2.7e+55], N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(x * 9.0), $MachinePrecision] * N[(y / c), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.7 \cdot 10^{+55}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 9\right) \cdot \frac{y}{c}}{z}\\
\end{array}
\end{array}
if x < 2.69999999999999977e55Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6487.4
Applied rewrites87.4%
if 2.69999999999999977e55 < x Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6436.5
Applied rewrites36.5%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (<= x 2.7e+55) (/ (fma (* -4.0 t) a (/ (fma (* 9.0 y) x b) z)) c) (/ (* (* x 9.0) (/ y c)) z)))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (x <= 2.7e+55) {
tmp = fma((-4.0 * t), a, (fma((9.0 * y), x, b) / z)) / c;
} else {
tmp = ((x * 9.0) * (y / c)) / z;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (x <= 2.7e+55) tmp = Float64(fma(Float64(-4.0 * t), a, Float64(fma(Float64(9.0 * y), x, b) / z)) / c); else tmp = Float64(Float64(Float64(x * 9.0) * Float64(y / c)) / z); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[x, 2.7e+55], N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(N[(N[(9.0 * y), $MachinePrecision] * x + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(x * 9.0), $MachinePrecision] * N[(y / c), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.7 \cdot 10^{+55}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{\mathsf{fma}\left(9 \cdot y, x, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 9\right) \cdot \frac{y}{c}}{z}\\
\end{array}
\end{array}
if x < 2.69999999999999977e55Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
if 2.69999999999999977e55 < x Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6436.5
Applied rewrites36.5%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(if (<= t_1 -1e-118)
(/ (/ (+ b (* 9.0 (* x y))) c) z)
(if (<= t_1 2e+62)
(/ (fma (* -4.0 t) a (/ b z)) c)
(/ (fma (* -4.0 t) a (* (/ y z) (* 9.0 x))) c)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if (t_1 <= -1e-118) {
tmp = ((b + (9.0 * (x * y))) / c) / z;
} else if (t_1 <= 2e+62) {
tmp = fma((-4.0 * t), a, (b / z)) / c;
} else {
tmp = fma((-4.0 * t), a, ((y / z) * (9.0 * x))) / c;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -1e-118) tmp = Float64(Float64(Float64(b + Float64(9.0 * Float64(x * y))) / c) / z); elseif (t_1 <= 2e+62) tmp = Float64(fma(Float64(-4.0 * t), a, Float64(b / z)) / c); else tmp = Float64(fma(Float64(-4.0 * t), a, Float64(Float64(y / z) * Float64(9.0 * x))) / c); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-118], N[(N[(N[(b + N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 2e+62], N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(N[(y / z), $MachinePrecision] * N[(9.0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-118}:\\
\;\;\;\;\frac{\frac{b + 9 \cdot \left(x \cdot y\right)}{c}}{z}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+62}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{b}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{y}{z} \cdot \left(9 \cdot x\right)\right)}{c}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999985e-119Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in z around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6461.3
Applied rewrites61.3%
if -9.99999999999999985e-119 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.00000000000000007e62Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
Taylor expanded in x around 0
Applied rewrites63.4%
if 2.00000000000000007e62 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.1%
Taylor expanded in b around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6456.5
Applied rewrites56.5%
Applied rewrites65.0%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(if (<= t_1 -2e+294)
(* y (/ (* 9.0 (/ x z)) c))
(if (<= t_1 -1e-118)
(/ (fma 9.0 (* y x) b) (* z c))
(if (<= t_1 1e+142)
(/ (fma (* -4.0 t) a (/ b z)) c)
(/ (* (* x 9.0) (/ y c)) z))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if (t_1 <= -2e+294) {
tmp = y * ((9.0 * (x / z)) / c);
} else if (t_1 <= -1e-118) {
tmp = fma(9.0, (y * x), b) / (z * c);
} else if (t_1 <= 1e+142) {
tmp = fma((-4.0 * t), a, (b / z)) / c;
} else {
tmp = ((x * 9.0) * (y / c)) / z;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -2e+294) tmp = Float64(y * Float64(Float64(9.0 * Float64(x / z)) / c)); elseif (t_1 <= -1e-118) tmp = Float64(fma(9.0, Float64(y * x), b) / Float64(z * c)); elseif (t_1 <= 1e+142) tmp = Float64(fma(Float64(-4.0 * t), a, Float64(b / z)) / c); else tmp = Float64(Float64(Float64(x * 9.0) * Float64(y / c)) / z); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+294], N[(y * N[(N[(9.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e-118], N[(N[(9.0 * N[(y * x), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+142], N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(x * 9.0), $MachinePrecision] * N[(y / c), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+294}:\\
\;\;\;\;y \cdot \frac{9 \cdot \frac{x}{z}}{c}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-118}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9, y \cdot x, b\right)}{z \cdot c}\\
\mathbf{elif}\;t\_1 \leq 10^{+142}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{b}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 9\right) \cdot \frac{y}{c}}{z}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000013e294Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6436.4
Applied rewrites36.4%
if -2.00000000000000013e294 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999985e-119Initial program 80.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6460.8
Applied rewrites60.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6460.8
lower-+.f64N/A
+-commutativeN/A
add-flip-revN/A
sub-flipN/A
remove-double-negN/A
*-rgt-identityN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-rgt-identityN/A
lower-fma.f6460.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6460.8
Applied rewrites60.8%
if -9.99999999999999985e-119 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000005e142Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
Taylor expanded in x around 0
Applied rewrites63.4%
if 1.00000000000000005e142 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6436.5
Applied rewrites36.5%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(if (<= t_1 -1e-118)
(/ (/ (+ b (* 9.0 (* x y))) c) z)
(if (<= t_1 1e+142)
(/ (fma (* -4.0 t) a (/ b z)) c)
(/ (* (* x 9.0) (/ y c)) z)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if (t_1 <= -1e-118) {
tmp = ((b + (9.0 * (x * y))) / c) / z;
} else if (t_1 <= 1e+142) {
tmp = fma((-4.0 * t), a, (b / z)) / c;
} else {
tmp = ((x * 9.0) * (y / c)) / z;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -1e-118) tmp = Float64(Float64(Float64(b + Float64(9.0 * Float64(x * y))) / c) / z); elseif (t_1 <= 1e+142) tmp = Float64(fma(Float64(-4.0 * t), a, Float64(b / z)) / c); else tmp = Float64(Float64(Float64(x * 9.0) * Float64(y / c)) / z); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-118], N[(N[(N[(b + N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 1e+142], N[(N[(N[(-4.0 * t), $MachinePrecision] * a + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(x * 9.0), $MachinePrecision] * N[(y / c), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-118}:\\
\;\;\;\;\frac{\frac{b + 9 \cdot \left(x \cdot y\right)}{c}}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+142}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot t, a, \frac{b}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 9\right) \cdot \frac{y}{c}}{z}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999985e-119Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in z around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6461.3
Applied rewrites61.3%
if -9.99999999999999985e-119 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000005e142Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Applied rewrites87.4%
Taylor expanded in x around 0
Applied rewrites63.4%
if 1.00000000000000005e142 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6436.5
Applied rewrites36.5%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* -4.0 (/ (* a t) c))))
(if (<= z -5.2e+40)
t_1
(if (<= z 1.45e+82) (/ (fma 9.0 (* y x) b) (* z c)) t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -5.2e+40) {
tmp = t_1;
} else if (z <= 1.45e+82) {
tmp = fma(9.0, (y * x), b) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(Float64(a * t) / c)) tmp = 0.0 if (z <= -5.2e+40) tmp = t_1; elseif (z <= 1.45e+82) tmp = Float64(fma(9.0, Float64(y * x), b) / Float64(z * c)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e+40], t$95$1, If[LessEqual[z, 1.45e+82], N[(N[(9.0 * N[(y * x), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \frac{a \cdot t}{c}\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+82}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9, y \cdot x, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.2000000000000001e40 or 1.4500000000000001e82 < z Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6437.7
Applied rewrites37.7%
if -5.2000000000000001e40 < z < 1.4500000000000001e82Initial program 80.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6460.8
Applied rewrites60.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6460.8
lower-+.f64N/A
+-commutativeN/A
add-flip-revN/A
sub-flipN/A
remove-double-negN/A
*-rgt-identityN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-rgt-identityN/A
lower-fma.f6460.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6460.8
Applied rewrites60.8%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (/ (* (* x 9.0) (/ y c)) z)))
(if (<= t_1 -4e+120)
t_2
(if (<= t_1 2e-168)
(/ (/ b c) z)
(if (<= t_1 1e+142) (* -4.0 (/ (* a t) c)) t_2)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = ((x * 9.0) * (y / c)) / z;
double tmp;
if (t_1 <= -4e+120) {
tmp = t_2;
} else if (t_1 <= 2e-168) {
tmp = (b / c) / z;
} else if (t_1 <= 1e+142) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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(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
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = ((x * 9.0d0) * (y / c)) / z
if (t_1 <= (-4d+120)) then
tmp = t_2
else if (t_1 <= 2d-168) then
tmp = (b / c) / z
else if (t_1 <= 1d+142) then
tmp = (-4.0d0) * ((a * t) / c)
else
tmp = t_2
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = ((x * 9.0) * (y / c)) / z;
double tmp;
if (t_1 <= -4e+120) {
tmp = t_2;
} else if (t_1 <= 2e-168) {
tmp = (b / c) / z;
} else if (t_1 <= 1e+142) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = ((x * 9.0) * (y / c)) / z tmp = 0 if t_1 <= -4e+120: tmp = t_2 elif t_1 <= 2e-168: tmp = (b / c) / z elif t_1 <= 1e+142: tmp = -4.0 * ((a * t) / c) else: tmp = t_2 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(Float64(x * 9.0) * Float64(y / c)) / z) tmp = 0.0 if (t_1 <= -4e+120) tmp = t_2; elseif (t_1 <= 2e-168) tmp = Float64(Float64(b / c) / z); elseif (t_1 <= 1e+142) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = t_2; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (x * 9.0) * y;
t_2 = ((x * 9.0) * (y / c)) / z;
tmp = 0.0;
if (t_1 <= -4e+120)
tmp = t_2;
elseif (t_1 <= 2e-168)
tmp = (b / c) / z;
elseif (t_1 <= 1e+142)
tmp = -4.0 * ((a * t) / c);
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * 9.0), $MachinePrecision] * N[(y / c), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+120], t$95$2, If[LessEqual[t$95$1, 2e-168], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 1e+142], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \frac{\left(x \cdot 9\right) \cdot \frac{y}{c}}{z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+120}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-168}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+142}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -3.9999999999999999e120 or 1.00000000000000005e142 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6436.5
Applied rewrites36.5%
if -3.9999999999999999e120 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.0000000000000001e-168Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in b around inf
lower-/.f6434.6
Applied rewrites34.6%
if 2.0000000000000001e-168 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000005e142Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6437.7
Applied rewrites37.7%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(if (<= t_1 -2e+51)
(* y (/ (* 9.0 (/ x z)) c))
(if (<= t_1 2e-168)
(/ (/ b c) z)
(if (<= t_1 1e+142)
(* -4.0 (/ (* a t) c))
(* (/ 9.0 z) (* y (/ x c))))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if (t_1 <= -2e+51) {
tmp = y * ((9.0 * (x / z)) / c);
} else if (t_1 <= 2e-168) {
tmp = (b / c) / z;
} else if (t_1 <= 1e+142) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = (9.0 / z) * (y * (x / c));
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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(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
real(8) :: t_1
real(8) :: tmp
t_1 = (x * 9.0d0) * y
if (t_1 <= (-2d+51)) then
tmp = y * ((9.0d0 * (x / z)) / c)
else if (t_1 <= 2d-168) then
tmp = (b / c) / z
else if (t_1 <= 1d+142) then
tmp = (-4.0d0) * ((a * t) / c)
else
tmp = (9.0d0 / z) * (y * (x / c))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if (t_1 <= -2e+51) {
tmp = y * ((9.0 * (x / z)) / c);
} else if (t_1 <= 2e-168) {
tmp = (b / c) / z;
} else if (t_1 <= 1e+142) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = (9.0 / z) * (y * (x / c));
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y tmp = 0 if t_1 <= -2e+51: tmp = y * ((9.0 * (x / z)) / c) elif t_1 <= 2e-168: tmp = (b / c) / z elif t_1 <= 1e+142: tmp = -4.0 * ((a * t) / c) else: tmp = (9.0 / z) * (y * (x / c)) return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -2e+51) tmp = Float64(y * Float64(Float64(9.0 * Float64(x / z)) / c)); elseif (t_1 <= 2e-168) tmp = Float64(Float64(b / c) / z); elseif (t_1 <= 1e+142) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = Float64(Float64(9.0 / z) * Float64(y * Float64(x / c))); end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (x * 9.0) * y;
tmp = 0.0;
if (t_1 <= -2e+51)
tmp = y * ((9.0 * (x / z)) / c);
elseif (t_1 <= 2e-168)
tmp = (b / c) / z;
elseif (t_1 <= 1e+142)
tmp = -4.0 * ((a * t) / c);
else
tmp = (9.0 / z) * (y * (x / c));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+51], N[(y * N[(N[(9.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-168], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 1e+142], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], N[(N[(9.0 / z), $MachinePrecision] * N[(y * N[(x / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+51}:\\
\;\;\;\;y \cdot \frac{9 \cdot \frac{x}{z}}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-168}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+142}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{9}{z} \cdot \left(y \cdot \frac{x}{c}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2e51Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6436.4
Applied rewrites36.4%
if -2e51 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.0000000000000001e-168Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in b around inf
lower-/.f6434.6
Applied rewrites34.6%
if 2.0000000000000001e-168 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000005e142Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6437.7
Applied rewrites37.7%
if 1.00000000000000005e142 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6436.5
Applied rewrites36.5%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* y (/ (* 9.0 (/ x z)) c))))
(if (<= t_1 -2e+51)
t_2
(if (<= t_1 2e-168)
(/ (/ b c) z)
(if (<= t_1 1e+142) (* -4.0 (/ (* a t) c)) t_2)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = y * ((9.0 * (x / z)) / c);
double tmp;
if (t_1 <= -2e+51) {
tmp = t_2;
} else if (t_1 <= 2e-168) {
tmp = (b / c) / z;
} else if (t_1 <= 1e+142) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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(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
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = y * ((9.0d0 * (x / z)) / c)
if (t_1 <= (-2d+51)) then
tmp = t_2
else if (t_1 <= 2d-168) then
tmp = (b / c) / z
else if (t_1 <= 1d+142) then
tmp = (-4.0d0) * ((a * t) / c)
else
tmp = t_2
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = y * ((9.0 * (x / z)) / c);
double tmp;
if (t_1 <= -2e+51) {
tmp = t_2;
} else if (t_1 <= 2e-168) {
tmp = (b / c) / z;
} else if (t_1 <= 1e+142) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = y * ((9.0 * (x / z)) / c) tmp = 0 if t_1 <= -2e+51: tmp = t_2 elif t_1 <= 2e-168: tmp = (b / c) / z elif t_1 <= 1e+142: tmp = -4.0 * ((a * t) / c) else: tmp = t_2 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(y * Float64(Float64(9.0 * Float64(x / z)) / c)) tmp = 0.0 if (t_1 <= -2e+51) tmp = t_2; elseif (t_1 <= 2e-168) tmp = Float64(Float64(b / c) / z); elseif (t_1 <= 1e+142) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = t_2; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (x * 9.0) * y;
t_2 = y * ((9.0 * (x / z)) / c);
tmp = 0.0;
if (t_1 <= -2e+51)
tmp = t_2;
elseif (t_1 <= 2e-168)
tmp = (b / c) / z;
elseif (t_1 <= 1e+142)
tmp = -4.0 * ((a * t) / c);
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(N[(9.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+51], t$95$2, If[LessEqual[t$95$1, 2e-168], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 1e+142], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := y \cdot \frac{9 \cdot \frac{x}{z}}{c}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+51}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-168}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+142}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2e51 or 1.00000000000000005e142 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6436.4
Applied rewrites36.4%
if -2e51 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.0000000000000001e-168Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in b around inf
lower-/.f6434.6
Applied rewrites34.6%
if 2.0000000000000001e-168 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000005e142Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6437.7
Applied rewrites37.7%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ b (* c z))) (t_2 (* -4.0 (/ (* a t) c))))
(if (<= z -7.4e-6)
t_2
(if (<= z -5.6e-80)
t_1
(if (<= z -1.25e-250)
(* y (* 9.0 (/ x (* c z))))
(if (<= z 2.8e+40) t_1 t_2))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = b / (c * z);
double t_2 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -7.4e-6) {
tmp = t_2;
} else if (z <= -5.6e-80) {
tmp = t_1;
} else if (z <= -1.25e-250) {
tmp = y * (9.0 * (x / (c * z)));
} else if (z <= 2.8e+40) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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(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
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = b / (c * z)
t_2 = (-4.0d0) * ((a * t) / c)
if (z <= (-7.4d-6)) then
tmp = t_2
else if (z <= (-5.6d-80)) then
tmp = t_1
else if (z <= (-1.25d-250)) then
tmp = y * (9.0d0 * (x / (c * z)))
else if (z <= 2.8d+40) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = b / (c * z);
double t_2 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -7.4e-6) {
tmp = t_2;
} else if (z <= -5.6e-80) {
tmp = t_1;
} else if (z <= -1.25e-250) {
tmp = y * (9.0 * (x / (c * z)));
} else if (z <= 2.8e+40) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = b / (c * z) t_2 = -4.0 * ((a * t) / c) tmp = 0 if z <= -7.4e-6: tmp = t_2 elif z <= -5.6e-80: tmp = t_1 elif z <= -1.25e-250: tmp = y * (9.0 * (x / (c * z))) elif z <= 2.8e+40: tmp = t_1 else: tmp = t_2 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(b / Float64(c * z)) t_2 = Float64(-4.0 * Float64(Float64(a * t) / c)) tmp = 0.0 if (z <= -7.4e-6) tmp = t_2; elseif (z <= -5.6e-80) tmp = t_1; elseif (z <= -1.25e-250) tmp = Float64(y * Float64(9.0 * Float64(x / Float64(c * z)))); elseif (z <= 2.8e+40) tmp = t_1; else tmp = t_2; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = b / (c * z);
t_2 = -4.0 * ((a * t) / c);
tmp = 0.0;
if (z <= -7.4e-6)
tmp = t_2;
elseif (z <= -5.6e-80)
tmp = t_1;
elseif (z <= -1.25e-250)
tmp = y * (9.0 * (x / (c * z)));
elseif (z <= 2.8e+40)
tmp = t_1;
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(b / N[(c * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.4e-6], t$95$2, If[LessEqual[z, -5.6e-80], t$95$1, If[LessEqual[z, -1.25e-250], N[(y * N[(9.0 * N[(x / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.8e+40], t$95$1, t$95$2]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \frac{b}{c \cdot z}\\
t_2 := -4 \cdot \frac{a \cdot t}{c}\\
\mathbf{if}\;z \leq -7.4 \cdot 10^{-6}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.25 \cdot 10^{-250}:\\
\;\;\;\;y \cdot \left(9 \cdot \frac{x}{c \cdot z}\right)\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -7.4000000000000003e-6 or 2.8000000000000001e40 < z Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6437.7
Applied rewrites37.7%
if -7.4000000000000003e-6 < z < -5.59999999999999978e-80 or -1.25000000000000007e-250 < z < 2.8000000000000001e40Initial program 80.1%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6435.4
Applied rewrites35.4%
if -5.59999999999999978e-80 < z < -1.25000000000000007e-250Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
mult-flip-revN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6437.5
lift-*.f64N/A
*-commutativeN/A
lift-*.f6437.5
Applied rewrites37.5%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* -4.0 (/ (* a t) c))))
(if (<= a -4.9e-91)
t_1
(if (<= a -1.1e-278)
(* 9.0 (/ (* x y) (* c z)))
(if (<= a 1e+121) (* (/ b c) (/ 1.0 z)) t_1)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (a <= -4.9e-91) {
tmp = t_1;
} else if (a <= -1.1e-278) {
tmp = 9.0 * ((x * y) / (c * z));
} else if (a <= 1e+121) {
tmp = (b / c) * (1.0 / z);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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(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
real(8) :: t_1
real(8) :: tmp
t_1 = (-4.0d0) * ((a * t) / c)
if (a <= (-4.9d-91)) then
tmp = t_1
else if (a <= (-1.1d-278)) then
tmp = 9.0d0 * ((x * y) / (c * z))
else if (a <= 1d+121) then
tmp = (b / c) * (1.0d0 / z)
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (a <= -4.9e-91) {
tmp = t_1;
} else if (a <= -1.1e-278) {
tmp = 9.0 * ((x * y) / (c * z));
} else if (a <= 1e+121) {
tmp = (b / c) * (1.0 / z);
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = -4.0 * ((a * t) / c) tmp = 0 if a <= -4.9e-91: tmp = t_1 elif a <= -1.1e-278: tmp = 9.0 * ((x * y) / (c * z)) elif a <= 1e+121: tmp = (b / c) * (1.0 / z) else: tmp = t_1 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(Float64(a * t) / c)) tmp = 0.0 if (a <= -4.9e-91) tmp = t_1; elseif (a <= -1.1e-278) tmp = Float64(9.0 * Float64(Float64(x * y) / Float64(c * z))); elseif (a <= 1e+121) tmp = Float64(Float64(b / c) * Float64(1.0 / z)); else tmp = t_1; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = -4.0 * ((a * t) / c);
tmp = 0.0;
if (a <= -4.9e-91)
tmp = t_1;
elseif (a <= -1.1e-278)
tmp = 9.0 * ((x * y) / (c * z));
elseif (a <= 1e+121)
tmp = (b / c) * (1.0 / z);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4.9e-91], t$95$1, If[LessEqual[a, -1.1e-278], N[(9.0 * N[(N[(x * y), $MachinePrecision] / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1e+121], N[(N[(b / c), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \frac{a \cdot t}{c}\\
\mathbf{if}\;a \leq -4.9 \cdot 10^{-91}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1.1 \cdot 10^{-278}:\\
\;\;\;\;9 \cdot \frac{x \cdot y}{c \cdot z}\\
\mathbf{elif}\;a \leq 10^{+121}:\\
\;\;\;\;\frac{b}{c} \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.8999999999999998e-91 or 1.00000000000000004e121 < a Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6437.7
Applied rewrites37.7%
if -4.8999999999999998e-91 < a < -1.1e-278Initial program 80.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.8%
if -1.1e-278 < a < 1.00000000000000004e121Initial program 80.1%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6435.4
Applied rewrites35.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6434.6
Applied rewrites34.6%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* -4.0 (/ (* a t) c)))) (if (<= z -7.4e-6) t_1 (if (<= z 2.8e+40) (/ b (* c z)) t_1))))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -7.4e-6) {
tmp = t_1;
} else if (z <= 2.8e+40) {
tmp = b / (c * z);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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(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
real(8) :: t_1
real(8) :: tmp
t_1 = (-4.0d0) * ((a * t) / c)
if (z <= (-7.4d-6)) then
tmp = t_1
else if (z <= 2.8d+40) then
tmp = b / (c * z)
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -7.4e-6) {
tmp = t_1;
} else if (z <= 2.8e+40) {
tmp = b / (c * z);
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = -4.0 * ((a * t) / c) tmp = 0 if z <= -7.4e-6: tmp = t_1 elif z <= 2.8e+40: tmp = b / (c * z) else: tmp = t_1 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(Float64(a * t) / c)) tmp = 0.0 if (z <= -7.4e-6) tmp = t_1; elseif (z <= 2.8e+40) tmp = Float64(b / Float64(c * z)); else tmp = t_1; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = -4.0 * ((a * t) / c);
tmp = 0.0;
if (z <= -7.4e-6)
tmp = t_1;
elseif (z <= 2.8e+40)
tmp = b / (c * z);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.4e-6], t$95$1, If[LessEqual[z, 2.8e+40], N[(b / N[(c * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \frac{a \cdot t}{c}\\
\mathbf{if}\;z \leq -7.4 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+40}:\\
\;\;\;\;\frac{b}{c \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.4000000000000003e-6 or 2.8000000000000001e40 < z Initial program 80.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6437.7
Applied rewrites37.7%
if -7.4000000000000003e-6 < z < 2.8000000000000001e40Initial program 80.1%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6435.4
Applied rewrites35.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (/ (/ b c) z))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
return (b / c) / z;
}
NOTE: x, y, z, t, a, b, and c 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(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 = (b / c) / z
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (b / c) / z;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): return (b / c) / z
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) return Float64(Float64(b / c) / z) end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp = code(x, y, z, t, a, b, c)
tmp = (b / c) / z;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\frac{\frac{b}{c}}{z}
\end{array}
Initial program 80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.6%
Taylor expanded in b around inf
lower-/.f6434.6
Applied rewrites34.6%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (/ b (* c z)))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (c * z);
}
NOTE: x, y, z, t, a, b, and c 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(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 = b / (c * z)
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (c * z);
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): return b / (c * z)
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) return Float64(b / Float64(c * z)) end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp = code(x, y, z, t, a, b, c)
tmp = b / (c * z);
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := N[(b / N[(c * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\frac{b}{c \cdot z}
\end{array}
Initial program 80.1%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6435.4
Applied rewrites35.4%
herbie shell --seed 2025149
(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)))