
(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 17 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
(let* ((t_1 (* c (* t z))))
(if (<= z -4.5e+145)
(* t (fma -4.0 (/ a c) (fma 9.0 (/ (* x y) t_1) (/ b t_1))))
(if (<= z 4e-10)
(/ (fma (* 9.0 x) y (- b (* a (* t (* 4.0 z))))) (* z c))
(fma
(fma (* 9.0 x) (/ y z) (/ (* (* (* t a) z) -4.0) z))
(/ 1.0 c)
(/ 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 t_1 = c * (t * z);
double tmp;
if (z <= -4.5e+145) {
tmp = t * fma(-4.0, (a / c), fma(9.0, ((x * y) / t_1), (b / t_1)));
} else if (z <= 4e-10) {
tmp = fma((9.0 * x), y, (b - (a * (t * (4.0 * z))))) / (z * c);
} else {
tmp = fma(fma((9.0 * x), (y / z), ((((t * a) * z) * -4.0) / z)), (1.0 / c), (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) t_1 = Float64(c * Float64(t * z)) tmp = 0.0 if (z <= -4.5e+145) tmp = Float64(t * fma(-4.0, Float64(a / c), fma(9.0, Float64(Float64(x * y) / t_1), Float64(b / t_1)))); elseif (z <= 4e-10) tmp = Float64(fma(Float64(9.0 * x), y, Float64(b - Float64(a * Float64(t * Float64(4.0 * z))))) / Float64(z * c)); else tmp = fma(fma(Float64(9.0 * x), Float64(y / z), Float64(Float64(Float64(Float64(t * a) * z) * -4.0) / z)), Float64(1.0 / c), Float64(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_] := Block[{t$95$1 = N[(c * N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+145], N[(t * N[(-4.0 * N[(a / c), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(b / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e-10], N[(N[(N[(9.0 * x), $MachinePrecision] * y + N[(b - N[(a * N[(t * N[(4.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(9.0 * x), $MachinePrecision] * N[(y / z), $MachinePrecision] + N[(N[(N[(N[(t * a), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / c), $MachinePrecision] + N[(b / 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}
t_1 := c \cdot \left(t \cdot z\right)\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{+145}:\\
\;\;\;\;t \cdot \mathsf{fma}\left(-4, \frac{a}{c}, \mathsf{fma}\left(9, \frac{x \cdot y}{t\_1}, \frac{b}{t\_1}\right)\right)\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-10}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, b - a \cdot \left(t \cdot \left(4 \cdot z\right)\right)\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(9 \cdot x, \frac{y}{z}, \frac{\left(\left(t \cdot a\right) \cdot z\right) \cdot -4}{z}\right), \frac{1}{c}, \frac{b}{c \cdot z}\right)\\
\end{array}
\end{array}
if z < -4.4999999999999998e145Initial program 79.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6469.2
Applied rewrites69.2%
if -4.4999999999999998e145 < z < 4.00000000000000015e-10Initial program 79.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-flipN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negate-revN/A
lower--.f6480.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.2
Applied rewrites80.2%
if 4.00000000000000015e-10 < z Initial program 79.9%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
inv-powN/A
lower-fma.f64N/A
Applied rewrites76.4%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
sub-flip-reverseN/A
div-addN/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites75.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
(let* ((t_1 (* c (* t z))))
(if (<= z -4.5e+145)
(* t (fma -4.0 (/ a c) (fma 9.0 (/ (* x y) t_1) (/ b t_1))))
(if (<= z 1.2e-21)
(/ (fma (* 9.0 x) y (- b (* a (* t (* 4.0 z))))) (* z c))
(fma
(/ (fma (* y x) 9.0 (* -4.0 (* z (* a t)))) z)
(/ 1.0 c)
(/ 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 t_1 = c * (t * z);
double tmp;
if (z <= -4.5e+145) {
tmp = t * fma(-4.0, (a / c), fma(9.0, ((x * y) / t_1), (b / t_1)));
} else if (z <= 1.2e-21) {
tmp = fma((9.0 * x), y, (b - (a * (t * (4.0 * z))))) / (z * c);
} else {
tmp = fma((fma((y * x), 9.0, (-4.0 * (z * (a * t)))) / z), (1.0 / c), (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) t_1 = Float64(c * Float64(t * z)) tmp = 0.0 if (z <= -4.5e+145) tmp = Float64(t * fma(-4.0, Float64(a / c), fma(9.0, Float64(Float64(x * y) / t_1), Float64(b / t_1)))); elseif (z <= 1.2e-21) tmp = Float64(fma(Float64(9.0 * x), y, Float64(b - Float64(a * Float64(t * Float64(4.0 * z))))) / Float64(z * c)); else tmp = fma(Float64(fma(Float64(y * x), 9.0, Float64(-4.0 * Float64(z * Float64(a * t)))) / z), Float64(1.0 / c), Float64(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_] := Block[{t$95$1 = N[(c * N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+145], N[(t * N[(-4.0 * N[(a / c), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(b / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-21], N[(N[(N[(9.0 * x), $MachinePrecision] * y + N[(b - N[(a * N[(t * N[(4.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y * x), $MachinePrecision] * 9.0 + N[(-4.0 * N[(z * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * N[(1.0 / c), $MachinePrecision] + N[(b / 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}
t_1 := c \cdot \left(t \cdot z\right)\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{+145}:\\
\;\;\;\;t \cdot \mathsf{fma}\left(-4, \frac{a}{c}, \mathsf{fma}\left(9, \frac{x \cdot y}{t\_1}, \frac{b}{t\_1}\right)\right)\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, b - a \cdot \left(t \cdot \left(4 \cdot z\right)\right)\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(y \cdot x, 9, -4 \cdot \left(z \cdot \left(a \cdot t\right)\right)\right)}{z}, \frac{1}{c}, \frac{b}{c \cdot z}\right)\\
\end{array}
\end{array}
if z < -4.4999999999999998e145Initial program 79.9%
Taylor expanded in t around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6469.2
Applied rewrites69.2%
if -4.4999999999999998e145 < z < 1.2e-21Initial program 79.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-flipN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negate-revN/A
lower--.f6480.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.2
Applied rewrites80.2%
if 1.2e-21 < z Initial program 79.9%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
inv-powN/A
lower-fma.f64N/A
Applied rewrites76.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 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))))
(if (<= t_1 -5e-296)
(/ (+ (fma (* y x) 9.0 (* -4.0 (* z (* a t)))) b) (* z c))
(if (<= t_1 INFINITY)
(/ (/ (fma (* y x) 9.0 (- b (* a (* t (* 4.0 z))))) c) z)
(* a (fma -4.0 (/ t c) (* 9.0 (/ (* x y) (* a (* 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) - (((z * 4.0) * t) * a)) + b) / (z * c);
double tmp;
if (t_1 <= -5e-296) {
tmp = (fma((y * x), 9.0, (-4.0 * (z * (a * t)))) + b) / (z * c);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (fma((y * x), 9.0, (b - (a * (t * (4.0 * z))))) / c) / z;
} else {
tmp = a * fma(-4.0, (t / c), (9.0 * ((x * y) / (a * (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(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) tmp = 0.0 if (t_1 <= -5e-296) tmp = Float64(Float64(fma(Float64(y * x), 9.0, Float64(-4.0 * Float64(z * Float64(a * t)))) + b) / Float64(z * c)); elseif (t_1 <= Inf) tmp = Float64(Float64(fma(Float64(y * x), 9.0, Float64(b - Float64(a * Float64(t * Float64(4.0 * z))))) / c) / z); else tmp = Float64(a * fma(-4.0, Float64(t / c), Float64(9.0 * Float64(Float64(x * y) / Float64(a * 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_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -5e-296], N[(N[(N[(N[(y * x), $MachinePrecision] * 9.0 + N[(-4.0 * N[(z * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(N[(y * x), $MachinePrecision] * 9.0 + N[(b - N[(a * N[(t * N[(4.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], N[(a * N[(-4.0 * N[(t / c), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / N[(a * N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 := \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}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-296}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, -4 \cdot \left(z \cdot \left(a \cdot t\right)\right)\right) + b}{z \cdot c}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(y \cdot x, 9, b - a \cdot \left(t \cdot \left(4 \cdot z\right)\right)\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \mathsf{fma}\left(-4, \frac{t}{c}, 9 \cdot \frac{x \cdot y}{a \cdot \left(c \cdot z\right)}\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) < -5.0000000000000003e-296Initial program 79.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6480.4
Applied rewrites80.4%
if -5.0000000000000003e-296 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) < +inf.0Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.5%
if +inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) Initial program 79.9%
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.0
Applied rewrites56.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6458.7
Applied rewrites58.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) (* (* (* z 4.0) t) a)) b) (* z c))))
(if (<= t_1 -5e-296)
(/ (+ (fma (* y x) 9.0 (* -4.0 (* z (* a t)))) b) (* z c))
(if (<= t_1 INFINITY)
(/ (/ (fma (* y x) 9.0 (- b (* a (* t (* 4.0 z))))) c) z)
(* a (* -4.0 (/ t 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) - (((z * 4.0) * t) * a)) + b) / (z * c);
double tmp;
if (t_1 <= -5e-296) {
tmp = (fma((y * x), 9.0, (-4.0 * (z * (a * t)))) + b) / (z * c);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (fma((y * x), 9.0, (b - (a * (t * (4.0 * z))))) / c) / z;
} else {
tmp = a * (-4.0 * (t / 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(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) tmp = 0.0 if (t_1 <= -5e-296) tmp = Float64(Float64(fma(Float64(y * x), 9.0, Float64(-4.0 * Float64(z * Float64(a * t)))) + b) / Float64(z * c)); elseif (t_1 <= Inf) tmp = Float64(Float64(fma(Float64(y * x), 9.0, Float64(b - Float64(a * Float64(t * Float64(4.0 * z))))) / c) / z); else tmp = Float64(a * Float64(-4.0 * Float64(t / 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[(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]}, If[LessEqual[t$95$1, -5e-296], N[(N[(N[(N[(y * x), $MachinePrecision] * 9.0 + N[(-4.0 * N[(z * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(N[(y * x), $MachinePrecision] * 9.0 + N[(b - N[(a * N[(t * N[(4.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], N[(a * N[(-4.0 * N[(t / 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 := \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}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-296}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, -4 \cdot \left(z \cdot \left(a \cdot t\right)\right)\right) + b}{z \cdot c}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(y \cdot x, 9, b - a \cdot \left(t \cdot \left(4 \cdot z\right)\right)\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(-4 \cdot \frac{t}{c}\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) < -5.0000000000000003e-296Initial program 79.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6480.4
Applied rewrites80.4%
if -5.0000000000000003e-296 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) < +inf.0Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.5%
if +inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) Initial program 79.9%
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.0
Applied rewrites56.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6458.7
Applied rewrites58.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f6439.9
Applied rewrites39.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 (<= z -7.8e+149) (/ (fma -4.0 (* a t) (* 9.0 (/ (* x y) z))) c) (/ (fma (* 9.0 x) y (- b (* a (* t (* 4.0 z))))) (* 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 <= -7.8e+149) {
tmp = fma(-4.0, (a * t), (9.0 * ((x * y) / z))) / c;
} else {
tmp = fma((9.0 * x), y, (b - (a * (t * (4.0 * z))))) / (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 <= -7.8e+149) tmp = Float64(fma(-4.0, Float64(a * t), Float64(9.0 * Float64(Float64(x * y) / z))) / c); else tmp = Float64(fma(Float64(9.0 * x), y, Float64(b - Float64(a * Float64(t * Float64(4.0 * z))))) / Float64(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, -7.8e+149], N[(N[(-4.0 * N[(a * t), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(9.0 * x), $MachinePrecision] * y + N[(b - N[(a * N[(t * N[(4.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $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}\;z \leq -7.8 \cdot 10^{+149}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, a \cdot t, 9 \cdot \frac{x \cdot y}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, b - a \cdot \left(t \cdot \left(4 \cdot z\right)\right)\right)}{z \cdot c}\\
\end{array}
\end{array}
if z < -7.7999999999999998e149Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites78.9%
Applied rewrites76.9%
Taylor expanded in b around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6462.5
Applied rewrites62.5%
if -7.7999999999999998e149 < z Initial program 79.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-flipN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negate-revN/A
lower--.f6480.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.2
Applied rewrites80.2%
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.2e+97)
(/ (fma -4.0 (* a t) (* 9.0 (/ (* x y) z))) c)
(if (<= z 6.2e+124)
(/ (- b (fma (* a (* 4.0 z)) t (* -9.0 (* x y)))) (* z c))
(/ (fma -4.0 (* a t) (/ 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.2e+97) {
tmp = fma(-4.0, (a * t), (9.0 * ((x * y) / z))) / c;
} else if (z <= 6.2e+124) {
tmp = (b - fma((a * (4.0 * z)), t, (-9.0 * (x * y)))) / (z * c);
} else {
tmp = fma(-4.0, (a * t), (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.2e+97) tmp = Float64(fma(-4.0, Float64(a * t), Float64(9.0 * Float64(Float64(x * y) / z))) / c); elseif (z <= 6.2e+124) tmp = Float64(Float64(b - fma(Float64(a * Float64(4.0 * z)), t, Float64(-9.0 * Float64(x * y)))) / Float64(z * c)); else tmp = Float64(fma(-4.0, Float64(a * t), Float64(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.2e+97], N[(N[(-4.0 * N[(a * t), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[z, 6.2e+124], N[(N[(b - N[(N[(a * N[(4.0 * z), $MachinePrecision]), $MachinePrecision] * t + N[(-9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * N[(a * t), $MachinePrecision] + N[(b / 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.2 \cdot 10^{+97}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, a \cdot t, 9 \cdot \frac{x \cdot y}{z}\right)}{c}\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+124}:\\
\;\;\;\;\frac{b - \mathsf{fma}\left(a \cdot \left(4 \cdot z\right), t, -9 \cdot \left(x \cdot y\right)\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, a \cdot t, \frac{b}{z}\right)}{c}\\
\end{array}
\end{array}
if z < -1.2e97Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites78.9%
Applied rewrites76.9%
Taylor expanded in b around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6462.5
Applied rewrites62.5%
if -1.2e97 < z < 6.2000000000000004e124Initial program 79.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-*.f6480.0
Applied rewrites80.0%
if 6.2000000000000004e124 < z Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites78.9%
Applied rewrites76.9%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f6463.8
Applied rewrites63.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
(if (<= b -9e-16)
(/ (fma -4.0 (* a t) (/ b z)) c)
(if (<= b 1.15e-39)
(/ (fma -4.0 (* a t) (* 9.0 (/ (* x y) z))) c)
(/ (/ (fma (* 9.0 y) x 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 (b <= -9e-16) {
tmp = fma(-4.0, (a * t), (b / z)) / c;
} else if (b <= 1.15e-39) {
tmp = fma(-4.0, (a * t), (9.0 * ((x * y) / z))) / c;
} else {
tmp = (fma((9.0 * y), x, 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 (b <= -9e-16) tmp = Float64(fma(-4.0, Float64(a * t), Float64(b / z)) / c); elseif (b <= 1.15e-39) tmp = Float64(fma(-4.0, Float64(a * t), Float64(9.0 * Float64(Float64(x * y) / z))) / c); else tmp = Float64(Float64(fma(Float64(9.0 * y), x, b) / 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[b, -9e-16], N[(N[(-4.0 * N[(a * t), $MachinePrecision] + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[b, 1.15e-39], N[(N[(-4.0 * N[(a * t), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(N[(9.0 * y), $MachinePrecision] * x + b), $MachinePrecision] / c), $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}\;b \leq -9 \cdot 10^{-16}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, a \cdot t, \frac{b}{z}\right)}{c}\\
\mathbf{elif}\;b \leq 1.15 \cdot 10^{-39}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, a \cdot t, 9 \cdot \frac{x \cdot y}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(9 \cdot y, x, b\right)}{c}}{z}\\
\end{array}
\end{array}
if b < -9.0000000000000003e-16Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites78.9%
Applied rewrites76.9%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f6463.8
Applied rewrites63.8%
if -9.0000000000000003e-16 < b < 1.15000000000000004e-39Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites78.9%
Applied rewrites76.9%
Taylor expanded in b around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6462.5
Applied rewrites62.5%
if 1.15000000000000004e-39 < b Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.5%
Taylor expanded in z around 0
Applied rewrites61.4%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6461.4
Applied rewrites61.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 (* a t) (/ b z)) c)))
(if (<= z -3.5e-22)
t_1
(if (<= z 7.5e+122) (/ (/ (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, (a * t), (b / z)) / c;
double tmp;
if (z <= -3.5e-22) {
tmp = t_1;
} else if (z <= 7.5e+122) {
tmp = (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(-4.0, Float64(a * t), Float64(b / z)) / c) tmp = 0.0 if (z <= -3.5e-22) tmp = t_1; elseif (z <= 7.5e+122) tmp = Float64(Float64(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[(-4.0 * N[(a * t), $MachinePrecision] + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[z, -3.5e-22], t$95$1, If[LessEqual[z, 7.5e+122], N[(N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $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, a \cdot t, \frac{b}{z}\right)}{c}\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+122}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.50000000000000005e-22 or 7.5000000000000002e122 < z Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites78.9%
Applied rewrites76.9%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f6463.8
Applied rewrites63.8%
if -3.50000000000000005e-22 < z < 7.5000000000000002e122Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.5%
Taylor expanded in z around 0
Applied rewrites61.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 (* a t) (/ b z)) c)))
(if (<= z -3.5e-22)
t_1
(if (<= z 7.5e+122) (/ (/ (fma (* 9.0 y) x 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, (a * t), (b / z)) / c;
double tmp;
if (z <= -3.5e-22) {
tmp = t_1;
} else if (z <= 7.5e+122) {
tmp = (fma((9.0 * y), x, 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(-4.0, Float64(a * t), Float64(b / z)) / c) tmp = 0.0 if (z <= -3.5e-22) tmp = t_1; elseif (z <= 7.5e+122) tmp = Float64(Float64(fma(Float64(9.0 * y), x, 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[(-4.0 * N[(a * t), $MachinePrecision] + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[z, -3.5e-22], t$95$1, If[LessEqual[z, 7.5e+122], N[(N[(N[(N[(9.0 * y), $MachinePrecision] * x + b), $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, a \cdot t, \frac{b}{z}\right)}{c}\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+122}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(9 \cdot y, x, b\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.50000000000000005e-22 or 7.5000000000000002e122 < z Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites78.9%
Applied rewrites76.9%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f6463.8
Applied rewrites63.8%
if -3.50000000000000005e-22 < z < 7.5000000000000002e122Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.5%
Taylor expanded in z around 0
Applied rewrites61.4%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6461.4
Applied rewrites61.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 (* a t) (/ b z)) c)))
(if (<= z -3.5e-22)
t_1
(if (<= z 7.5e+122) (/ (fma (* 9.0 x) y 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, (a * t), (b / z)) / c;
double tmp;
if (z <= -3.5e-22) {
tmp = t_1;
} else if (z <= 7.5e+122) {
tmp = fma((9.0 * x), y, 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(-4.0, Float64(a * t), Float64(b / z)) / c) tmp = 0.0 if (z <= -3.5e-22) tmp = t_1; elseif (z <= 7.5e+122) tmp = Float64(fma(Float64(9.0 * x), y, b) / Float64(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[(-4.0 * N[(a * t), $MachinePrecision] + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[z, -3.5e-22], t$95$1, If[LessEqual[z, 7.5e+122], N[(N[(N[(9.0 * x), $MachinePrecision] * y + b), $MachinePrecision] / 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 := \frac{\mathsf{fma}\left(-4, a \cdot t, \frac{b}{z}\right)}{c}\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+122}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.50000000000000005e-22 or 7.5000000000000002e122 < z Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites78.9%
Applied rewrites76.9%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f6463.8
Applied rewrites63.8%
if -3.50000000000000005e-22 < z < 7.5000000000000002e122Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.5%
Taylor expanded in z around 0
Applied rewrites61.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lower-/.f6460.9
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6460.9
Applied rewrites60.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 (<= z -2.05e+15)
(* -4.0 (/ (* a t) c))
(if (<= z 6.4e+137)
(/ (fma (* 9.0 x) y b) (* c z))
(* a (* -4.0 (/ t 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 <= -2.05e+15) {
tmp = -4.0 * ((a * t) / c);
} else if (z <= 6.4e+137) {
tmp = fma((9.0 * x), y, b) / (c * z);
} else {
tmp = a * (-4.0 * (t / 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 <= -2.05e+15) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); elseif (z <= 6.4e+137) tmp = Float64(fma(Float64(9.0 * x), y, b) / Float64(c * z)); else tmp = Float64(a * Float64(-4.0 * Float64(t / 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, -2.05e+15], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.4e+137], N[(N[(N[(9.0 * x), $MachinePrecision] * y + b), $MachinePrecision] / N[(c * z), $MachinePrecision]), $MachinePrecision], N[(a * N[(-4.0 * N[(t / 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}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+15}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+137}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c \cdot z}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(-4 \cdot \frac{t}{c}\right)\\
\end{array}
\end{array}
if z < -2.05e15Initial program 79.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.2
Applied rewrites38.2%
if -2.05e15 < z < 6.40000000000000038e137Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.5%
Taylor expanded in z around 0
Applied rewrites61.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lower-/.f6460.9
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6460.9
Applied rewrites60.9%
if 6.40000000000000038e137 < z Initial program 79.9%
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.0
Applied rewrites56.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6458.7
Applied rewrites58.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f6439.9
Applied rewrites39.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
(let* ((t_1 (* a (* -4.0 (/ t c))))
(t_2 (* (* x 9.0) y))
(t_3 (/ (* 9.0 (/ (* x y) c)) z)))
(if (<= t_2 -2e+141)
t_3
(if (<= t_2 -2e-181)
t_1
(if (<= t_2 2e-236)
(* (/ b c) (/ 1.0 z))
(if (<= t_2 1e+146) t_1 t_3))))))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 = a * (-4.0 * (t / c));
double t_2 = (x * 9.0) * y;
double t_3 = (9.0 * ((x * y) / c)) / z;
double tmp;
if (t_2 <= -2e+141) {
tmp = t_3;
} else if (t_2 <= -2e-181) {
tmp = t_1;
} else if (t_2 <= 2e-236) {
tmp = (b / c) * (1.0 / z);
} else if (t_2 <= 1e+146) {
tmp = t_1;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = a * ((-4.0d0) * (t / c))
t_2 = (x * 9.0d0) * y
t_3 = (9.0d0 * ((x * y) / c)) / z
if (t_2 <= (-2d+141)) then
tmp = t_3
else if (t_2 <= (-2d-181)) then
tmp = t_1
else if (t_2 <= 2d-236) then
tmp = (b / c) * (1.0d0 / z)
else if (t_2 <= 1d+146) then
tmp = t_1
else
tmp = t_3
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 = a * (-4.0 * (t / c));
double t_2 = (x * 9.0) * y;
double t_3 = (9.0 * ((x * y) / c)) / z;
double tmp;
if (t_2 <= -2e+141) {
tmp = t_3;
} else if (t_2 <= -2e-181) {
tmp = t_1;
} else if (t_2 <= 2e-236) {
tmp = (b / c) * (1.0 / z);
} else if (t_2 <= 1e+146) {
tmp = t_1;
} else {
tmp = t_3;
}
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 = a * (-4.0 * (t / c)) t_2 = (x * 9.0) * y t_3 = (9.0 * ((x * y) / c)) / z tmp = 0 if t_2 <= -2e+141: tmp = t_3 elif t_2 <= -2e-181: tmp = t_1 elif t_2 <= 2e-236: tmp = (b / c) * (1.0 / z) elif t_2 <= 1e+146: tmp = t_1 else: tmp = t_3 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(a * Float64(-4.0 * Float64(t / c))) t_2 = Float64(Float64(x * 9.0) * y) t_3 = Float64(Float64(9.0 * Float64(Float64(x * y) / c)) / z) tmp = 0.0 if (t_2 <= -2e+141) tmp = t_3; elseif (t_2 <= -2e-181) tmp = t_1; elseif (t_2 <= 2e-236) tmp = Float64(Float64(b / c) * Float64(1.0 / z)); elseif (t_2 <= 1e+146) tmp = t_1; else tmp = t_3; 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 = a * (-4.0 * (t / c));
t_2 = (x * 9.0) * y;
t_3 = (9.0 * ((x * y) / c)) / z;
tmp = 0.0;
if (t_2 <= -2e+141)
tmp = t_3;
elseif (t_2 <= -2e-181)
tmp = t_1;
elseif (t_2 <= 2e-236)
tmp = (b / c) * (1.0 / z);
elseif (t_2 <= 1e+146)
tmp = t_1;
else
tmp = t_3;
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[(a * N[(-4.0 * N[(t / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$3 = N[(N[(9.0 * N[(N[(x * y), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+141], t$95$3, If[LessEqual[t$95$2, -2e-181], t$95$1, If[LessEqual[t$95$2, 2e-236], N[(N[(b / c), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+146], t$95$1, t$95$3]]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(-4 \cdot \frac{t}{c}\right)\\
t_2 := \left(x \cdot 9\right) \cdot y\\
t_3 := \frac{9 \cdot \frac{x \cdot y}{c}}{z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+141}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-181}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-236}:\\
\;\;\;\;\frac{b}{c} \cdot \frac{1}{z}\\
\mathbf{elif}\;t\_2 \leq 10^{+146}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000003e141 or 9.99999999999999934e145 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6435.5
Applied rewrites35.5%
if -2.00000000000000003e141 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000009e-181 or 2.0000000000000001e-236 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999934e145Initial program 79.9%
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.0
Applied rewrites56.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6458.7
Applied rewrites58.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f6439.9
Applied rewrites39.9%
if -2.00000000000000009e-181 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.0000000000000001e-236Initial program 79.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6435.7
Applied rewrites35.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6435.0
Applied rewrites35.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 (* a (* -4.0 (/ t c)))) (t_2 (* (* x 9.0) y)))
(if (<= t_2 -2e+141)
(* 9.0 (/ (* x y) (* c z)))
(if (<= t_2 -2e-181)
t_1
(if (<= t_2 2e-236)
(* (/ b c) (/ 1.0 z))
(if (<= t_2 1e+146) t_1 (/ (* 9.0 (* x 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 = a * (-4.0 * (t / c));
double t_2 = (x * 9.0) * y;
double tmp;
if (t_2 <= -2e+141) {
tmp = 9.0 * ((x * y) / (c * z));
} else if (t_2 <= -2e-181) {
tmp = t_1;
} else if (t_2 <= 2e-236) {
tmp = (b / c) * (1.0 / z);
} else if (t_2 <= 1e+146) {
tmp = t_1;
} else {
tmp = (9.0 * (x * y)) / (c * z);
}
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 = a * ((-4.0d0) * (t / c))
t_2 = (x * 9.0d0) * y
if (t_2 <= (-2d+141)) then
tmp = 9.0d0 * ((x * y) / (c * z))
else if (t_2 <= (-2d-181)) then
tmp = t_1
else if (t_2 <= 2d-236) then
tmp = (b / c) * (1.0d0 / z)
else if (t_2 <= 1d+146) then
tmp = t_1
else
tmp = (9.0d0 * (x * y)) / (c * z)
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 = a * (-4.0 * (t / c));
double t_2 = (x * 9.0) * y;
double tmp;
if (t_2 <= -2e+141) {
tmp = 9.0 * ((x * y) / (c * z));
} else if (t_2 <= -2e-181) {
tmp = t_1;
} else if (t_2 <= 2e-236) {
tmp = (b / c) * (1.0 / z);
} else if (t_2 <= 1e+146) {
tmp = t_1;
} else {
tmp = (9.0 * (x * y)) / (c * z);
}
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 = a * (-4.0 * (t / c)) t_2 = (x * 9.0) * y tmp = 0 if t_2 <= -2e+141: tmp = 9.0 * ((x * y) / (c * z)) elif t_2 <= -2e-181: tmp = t_1 elif t_2 <= 2e-236: tmp = (b / c) * (1.0 / z) elif t_2 <= 1e+146: tmp = t_1 else: tmp = (9.0 * (x * 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(a * Float64(-4.0 * Float64(t / c))) t_2 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_2 <= -2e+141) tmp = Float64(9.0 * Float64(Float64(x * y) / Float64(c * z))); elseif (t_2 <= -2e-181) tmp = t_1; elseif (t_2 <= 2e-236) tmp = Float64(Float64(b / c) * Float64(1.0 / z)); elseif (t_2 <= 1e+146) tmp = t_1; else tmp = Float64(Float64(9.0 * Float64(x * y)) / Float64(c * z)); 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 = a * (-4.0 * (t / c));
t_2 = (x * 9.0) * y;
tmp = 0.0;
if (t_2 <= -2e+141)
tmp = 9.0 * ((x * y) / (c * z));
elseif (t_2 <= -2e-181)
tmp = t_1;
elseif (t_2 <= 2e-236)
tmp = (b / c) * (1.0 / z);
elseif (t_2 <= 1e+146)
tmp = t_1;
else
tmp = (9.0 * (x * y)) / (c * z);
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[(a * N[(-4.0 * N[(t / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+141], N[(9.0 * N[(N[(x * y), $MachinePrecision] / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-181], t$95$1, If[LessEqual[t$95$2, 2e-236], N[(N[(b / c), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+146], t$95$1, N[(N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision] / N[(c * z), $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 := a \cdot \left(-4 \cdot \frac{t}{c}\right)\\
t_2 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+141}:\\
\;\;\;\;9 \cdot \frac{x \cdot y}{c \cdot z}\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-181}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-236}:\\
\;\;\;\;\frac{b}{c} \cdot \frac{1}{z}\\
\mathbf{elif}\;t\_2 \leq 10^{+146}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{9 \cdot \left(x \cdot y\right)}{c \cdot z}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000003e141Initial program 79.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.8%
if -2.00000000000000003e141 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000009e-181 or 2.0000000000000001e-236 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999934e145Initial program 79.9%
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.0
Applied rewrites56.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6458.7
Applied rewrites58.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f6439.9
Applied rewrites39.9%
if -2.00000000000000009e-181 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.0000000000000001e-236Initial program 79.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6435.7
Applied rewrites35.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
if 9.99999999999999934e145 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.9%
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.0
Applied rewrites56.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6430.3
Applied rewrites30.3%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.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 (* a (* -4.0 (/ t c))))
(t_2 (* (* x 9.0) y))
(t_3 (* 9.0 (/ (* x y) (* c z)))))
(if (<= t_2 -2e+141)
t_3
(if (<= t_2 -2e-181)
t_1
(if (<= t_2 2e-236)
(* (/ b c) (/ 1.0 z))
(if (<= t_2 1e+146) t_1 t_3))))))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 = a * (-4.0 * (t / c));
double t_2 = (x * 9.0) * y;
double t_3 = 9.0 * ((x * y) / (c * z));
double tmp;
if (t_2 <= -2e+141) {
tmp = t_3;
} else if (t_2 <= -2e-181) {
tmp = t_1;
} else if (t_2 <= 2e-236) {
tmp = (b / c) * (1.0 / z);
} else if (t_2 <= 1e+146) {
tmp = t_1;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = a * ((-4.0d0) * (t / c))
t_2 = (x * 9.0d0) * y
t_3 = 9.0d0 * ((x * y) / (c * z))
if (t_2 <= (-2d+141)) then
tmp = t_3
else if (t_2 <= (-2d-181)) then
tmp = t_1
else if (t_2 <= 2d-236) then
tmp = (b / c) * (1.0d0 / z)
else if (t_2 <= 1d+146) then
tmp = t_1
else
tmp = t_3
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 = a * (-4.0 * (t / c));
double t_2 = (x * 9.0) * y;
double t_3 = 9.0 * ((x * y) / (c * z));
double tmp;
if (t_2 <= -2e+141) {
tmp = t_3;
} else if (t_2 <= -2e-181) {
tmp = t_1;
} else if (t_2 <= 2e-236) {
tmp = (b / c) * (1.0 / z);
} else if (t_2 <= 1e+146) {
tmp = t_1;
} else {
tmp = t_3;
}
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 = a * (-4.0 * (t / c)) t_2 = (x * 9.0) * y t_3 = 9.0 * ((x * y) / (c * z)) tmp = 0 if t_2 <= -2e+141: tmp = t_3 elif t_2 <= -2e-181: tmp = t_1 elif t_2 <= 2e-236: tmp = (b / c) * (1.0 / z) elif t_2 <= 1e+146: tmp = t_1 else: tmp = t_3 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(a * Float64(-4.0 * Float64(t / c))) t_2 = Float64(Float64(x * 9.0) * y) t_3 = Float64(9.0 * Float64(Float64(x * y) / Float64(c * z))) tmp = 0.0 if (t_2 <= -2e+141) tmp = t_3; elseif (t_2 <= -2e-181) tmp = t_1; elseif (t_2 <= 2e-236) tmp = Float64(Float64(b / c) * Float64(1.0 / z)); elseif (t_2 <= 1e+146) tmp = t_1; else tmp = t_3; 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 = a * (-4.0 * (t / c));
t_2 = (x * 9.0) * y;
t_3 = 9.0 * ((x * y) / (c * z));
tmp = 0.0;
if (t_2 <= -2e+141)
tmp = t_3;
elseif (t_2 <= -2e-181)
tmp = t_1;
elseif (t_2 <= 2e-236)
tmp = (b / c) * (1.0 / z);
elseif (t_2 <= 1e+146)
tmp = t_1;
else
tmp = t_3;
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[(a * N[(-4.0 * N[(t / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$3 = N[(9.0 * N[(N[(x * y), $MachinePrecision] / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+141], t$95$3, If[LessEqual[t$95$2, -2e-181], t$95$1, If[LessEqual[t$95$2, 2e-236], N[(N[(b / c), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+146], t$95$1, t$95$3]]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(-4 \cdot \frac{t}{c}\right)\\
t_2 := \left(x \cdot 9\right) \cdot y\\
t_3 := 9 \cdot \frac{x \cdot y}{c \cdot z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+141}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-181}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-236}:\\
\;\;\;\;\frac{b}{c} \cdot \frac{1}{z}\\
\mathbf{elif}\;t\_2 \leq 10^{+146}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000003e141 or 9.99999999999999934e145 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.8%
if -2.00000000000000003e141 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000009e-181 or 2.0000000000000001e-236 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999934e145Initial program 79.9%
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.0
Applied rewrites56.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6458.7
Applied rewrites58.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f6439.9
Applied rewrites39.9%
if -2.00000000000000009e-181 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.0000000000000001e-236Initial program 79.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6435.7
Applied rewrites35.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6435.0
Applied rewrites35.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 (* a (* -4.0 (/ t c))))) (if (<= t -0.00155) t_1 (if (<= t 7.2e-77) (/ 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 = a * (-4.0 * (t / c));
double tmp;
if (t <= -0.00155) {
tmp = t_1;
} else if (t <= 7.2e-77) {
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 = a * ((-4.0d0) * (t / c))
if (t <= (-0.00155d0)) then
tmp = t_1
else if (t <= 7.2d-77) 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 = a * (-4.0 * (t / c));
double tmp;
if (t <= -0.00155) {
tmp = t_1;
} else if (t <= 7.2e-77) {
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 = a * (-4.0 * (t / c)) tmp = 0 if t <= -0.00155: tmp = t_1 elif t <= 7.2e-77: 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(a * Float64(-4.0 * Float64(t / c))) tmp = 0.0 if (t <= -0.00155) tmp = t_1; elseif (t <= 7.2e-77) 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 = a * (-4.0 * (t / c));
tmp = 0.0;
if (t <= -0.00155)
tmp = t_1;
elseif (t <= 7.2e-77)
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[(a * N[(-4.0 * N[(t / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -0.00155], t$95$1, If[LessEqual[t, 7.2e-77], 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 := a \cdot \left(-4 \cdot \frac{t}{c}\right)\\
\mathbf{if}\;t \leq -0.00155:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-77}:\\
\;\;\;\;\frac{b}{c \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -0.00154999999999999995 or 7.2e-77 < t Initial program 79.9%
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.0
Applied rewrites56.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6458.7
Applied rewrites58.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f6439.9
Applied rewrites39.9%
if -0.00154999999999999995 < t < 7.2e-77Initial program 79.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6435.7
Applied rewrites35.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 (/ (/ 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 79.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.5%
Taylor expanded in b around inf
lower-/.f6435.1
Applied rewrites35.1%
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 79.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6435.7
Applied rewrites35.7%
herbie shell --seed 2025151
(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)))