
(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 14 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 (<= a 5e+58) (/ (fma (* -4.0 a) t (/ (fma (* y x) 9.0 b) z)) c) (* (/ (fma -4.0 t (/ (fma (* x y) 9.0 b) (* a z))) c) a)))
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 (a <= 5e+58) {
tmp = fma((-4.0 * a), t, (fma((y * x), 9.0, b) / z)) / c;
} else {
tmp = (fma(-4.0, t, (fma((x * y), 9.0, b) / (a * z))) / c) * a;
}
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 (a <= 5e+58) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(fma(Float64(y * x), 9.0, b) / z)) / c); else tmp = Float64(Float64(fma(-4.0, t, Float64(fma(Float64(x * y), 9.0, b) / Float64(a * z))) / c) * a); 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[a, 5e+58], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(-4.0 * t + N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] * a), $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}\;a \leq 5 \cdot 10^{+58}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, t, \frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{a \cdot z}\right)}{c} \cdot a\\
\end{array}
\end{array}
if a < 4.99999999999999986e58Initial program 80.0%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.1
Applied rewrites80.1%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites79.5%
Taylor expanded in x around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6487.2
Applied rewrites87.2%
if 4.99999999999999986e58 < a Initial program 80.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.3%
Taylor expanded in c around 0
lower-/.f64N/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6478.5
Applied rewrites78.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 (* (/ (fma (* x (/ y (* a z))) 9.0 (* -4.0 t)) c) a))
(t_2 (* (* x 9.0) y)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 1e+109)
(/ (fma (* -4.0 a) t (/ (fma (* y x) 9.0 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((x * (y / (a * z))), 9.0, (-4.0 * t)) / c) * a;
double t_2 = (x * 9.0) * y;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+109) {
tmp = fma((-4.0 * a), t, (fma((y * x), 9.0, 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(Float64(fma(Float64(x * Float64(y / Float64(a * z))), 9.0, Float64(-4.0 * t)) / c) * a) t_2 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+109) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(fma(Float64(y * x), 9.0, b) / 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[(N[(x * N[(y / N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 9.0 + N[(-4.0 * t), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+109], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $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(x \cdot \frac{y}{a \cdot z}, 9, -4 \cdot t\right)}{c} \cdot a\\
t_2 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+109}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -inf.0 or 9.99999999999999982e108 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.3%
Taylor expanded in c around 0
lower-/.f64N/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6478.5
Applied rewrites78.5%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-*.f6462.8
Applied rewrites62.8%
if -inf.0 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999982e108Initial program 80.0%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.1
Applied rewrites80.1%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites79.5%
Taylor expanded in x around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6487.2
Applied rewrites87.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
(let* ((t_1 (* (* x 9.0) y)))
(if (<= t_1 (- INFINITY))
(* (/ (* x 9.0) (* c z)) y)
(if (<= t_1 5e+189)
(/ (fma (* -4.0 a) t (/ (fma (* y x) 9.0 b) z)) c)
(* (/ (fma 9.0 x (/ b y)) (* c z)) y)))))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 <= -((double) INFINITY)) {
tmp = ((x * 9.0) / (c * z)) * y;
} else if (t_1 <= 5e+189) {
tmp = fma((-4.0 * a), t, (fma((y * x), 9.0, b) / z)) / c;
} else {
tmp = (fma(9.0, x, (b / y)) / (c * z)) * y;
}
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 <= Float64(-Inf)) tmp = Float64(Float64(Float64(x * 9.0) / Float64(c * z)) * y); elseif (t_1 <= 5e+189) tmp = Float64(fma(Float64(-4.0 * a), t, Float64(fma(Float64(y * x), 9.0, b) / z)) / c); else tmp = Float64(Float64(fma(9.0, x, Float64(b / y)) / Float64(c * z)) * y); 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, (-Infinity)], N[(N[(N[(x * 9.0), $MachinePrecision] / N[(c * z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 5e+189], N[(N[(N[(-4.0 * a), $MachinePrecision] * t + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(9.0 * x + N[(b / y), $MachinePrecision]), $MachinePrecision] / N[(c * z), $MachinePrecision]), $MachinePrecision] * y), $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 -\infty:\\
\;\;\;\;\frac{x \cdot 9}{c \cdot z} \cdot y\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+189}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4 \cdot a, t, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9, x, \frac{b}{y}\right)}{c \cdot z} \cdot y\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -inf.0Initial program 80.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6438.4
Applied rewrites38.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6438.3
Applied rewrites38.3%
if -inf.0 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5.0000000000000004e189Initial program 80.0%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.1
Applied rewrites80.1%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites79.5%
Taylor expanded in x around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6487.2
Applied rewrites87.2%
if 5.0000000000000004e189 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f6456.0
Applied rewrites56.0%
Taylor expanded in c around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f6456.1
Applied rewrites56.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
(let* ((t_1 (* (* x 9.0) y)))
(if (<= t_1 -1e+40)
(* (/ (fma 9.0 x (/ b y)) (* c z)) y)
(if (<= t_1 1e+109)
(/ (fma (* (* t z) a) -4.0 b) (* z c))
(* (/ (* (/ x c) 9.0) z) y)))))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+40) {
tmp = (fma(9.0, x, (b / y)) / (c * z)) * y;
} else if (t_1 <= 1e+109) {
tmp = fma(((t * z) * a), -4.0, b) / (z * c);
} else {
tmp = (((x / c) * 9.0) / z) * y;
}
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+40) tmp = Float64(Float64(fma(9.0, x, Float64(b / y)) / Float64(c * z)) * y); elseif (t_1 <= 1e+109) tmp = Float64(fma(Float64(Float64(t * z) * a), -4.0, b) / Float64(z * c)); else tmp = Float64(Float64(Float64(Float64(x / c) * 9.0) / z) * y); 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+40], N[(N[(N[(9.0 * x + N[(b / y), $MachinePrecision]), $MachinePrecision] / N[(c * z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 1e+109], N[(N[(N[(N[(t * z), $MachinePrecision] * a), $MachinePrecision] * -4.0 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x / c), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision] * y), $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^{+40}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9, x, \frac{b}{y}\right)}{c \cdot z} \cdot y\\
\mathbf{elif}\;t\_1 \leq 10^{+109}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(t \cdot z\right) \cdot a, -4, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{c} \cdot 9}{z} \cdot y\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -1.00000000000000003e40Initial program 80.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f6456.0
Applied rewrites56.0%
Taylor expanded in c around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f6456.1
Applied rewrites56.1%
if -1.00000000000000003e40 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999982e108Initial program 80.0%
Taylor expanded in x around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6456.7
Applied rewrites56.7%
if 9.99999999999999982e108 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f6456.0
Applied rewrites56.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6438.5
Applied rewrites38.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 (* (/ (* (/ x c) 9.0) z) y)))
(if (<= t_1 -4e+50)
t_2
(if (<= t_1 1e+109) (/ (fma (* (* t z) a) -4.0 b) (* z 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 / c) * 9.0) / z) * y;
double tmp;
if (t_1 <= -4e+50) {
tmp = t_2;
} else if (t_1 <= 1e+109) {
tmp = fma(((t * z) * a), -4.0, b) / (z * 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(Float64(x / c) * 9.0) / z) * y) tmp = 0.0 if (t_1 <= -4e+50) tmp = t_2; elseif (t_1 <= 1e+109) tmp = Float64(fma(Float64(Float64(t * z) * a), -4.0, b) / Float64(z * c)); else tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(N[(N[(x / c), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+50], t$95$2, If[LessEqual[t$95$1, 1e+109], N[(N[(N[(N[(t * z), $MachinePrecision] * a), $MachinePrecision] * -4.0 + b), $MachinePrecision] / N[(z * 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{\frac{x}{c} \cdot 9}{z} \cdot y\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+50}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+109}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(t \cdot z\right) \cdot a, -4, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.0000000000000003e50 or 9.99999999999999982e108 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f6456.0
Applied rewrites56.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6438.5
Applied rewrites38.5%
if -4.0000000000000003e50 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999982e108Initial program 80.0%
Taylor expanded in x around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6456.7
Applied rewrites56.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 (if (<= t -1.1e+230) (* (* (/ t c) -4.0) a) (/ (fma (* y x) 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 (t <= -1.1e+230) {
tmp = ((t / c) * -4.0) * a;
} else {
tmp = fma((y * x), 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 (t <= -1.1e+230) tmp = Float64(Float64(Float64(t / c) * -4.0) * a); else tmp = Float64(fma(Float64(y * x), 9.0, b) / 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[t, -1.1e+230], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $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}\;t \leq -1.1 \cdot 10^{+230}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c}\\
\end{array}
\end{array}
if t < -1.1e230Initial program 80.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6440.1
Applied rewrites40.1%
if -1.1e230 < t Initial program 80.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6460.1
Applied rewrites60.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
(let* ((t_1 (* (* x 9.0) y)) (t_2 (* (/ (* (/ x c) 9.0) z) y)))
(if (<= t_1 -1e+98)
t_2
(if (<= t_1 -4e-21)
(* -4.0 (/ (* a t) c))
(if (<= t_1 1e+109) (/ b (* c z)) 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 / c) * 9.0) / z) * y;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= -4e-21) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 1e+109) {
tmp = b / (c * z);
} 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 / c) * 9.0d0) / z) * y
if (t_1 <= (-1d+98)) then
tmp = t_2
else if (t_1 <= (-4d-21)) then
tmp = (-4.0d0) * ((a * t) / c)
else if (t_1 <= 1d+109) then
tmp = b / (c * z)
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 / c) * 9.0) / z) * y;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= -4e-21) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 1e+109) {
tmp = b / (c * z);
} 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 / c) * 9.0) / z) * y tmp = 0 if t_1 <= -1e+98: tmp = t_2 elif t_1 <= -4e-21: tmp = -4.0 * ((a * t) / c) elif t_1 <= 1e+109: tmp = b / (c * z) 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(Float64(x / c) * 9.0) / z) * y) tmp = 0.0 if (t_1 <= -1e+98) tmp = t_2; elseif (t_1 <= -4e-21) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); elseif (t_1 <= 1e+109) tmp = Float64(b / Float64(c * z)); 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 / c) * 9.0) / z) * y;
tmp = 0.0;
if (t_1 <= -1e+98)
tmp = t_2;
elseif (t_1 <= -4e-21)
tmp = -4.0 * ((a * t) / c);
elseif (t_1 <= 1e+109)
tmp = b / (c * z);
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[(N[(x / c), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+98], t$95$2, If[LessEqual[t$95$1, -4e-21], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+109], N[(b / N[(c * z), $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{\frac{x}{c} \cdot 9}{z} \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-21}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{elif}\;t\_1 \leq 10^{+109}:\\
\;\;\;\;\frac{b}{c \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999998e97 or 9.99999999999999982e108 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f6456.0
Applied rewrites56.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6438.5
Applied rewrites38.5%
if -9.99999999999999998e97 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -3.99999999999999963e-21Initial program 80.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.2
Applied rewrites38.2%
if -3.99999999999999963e-21 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999982e108Initial program 80.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.9
Applied rewrites34.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 (* (* x 9.0) y)) (t_2 (* (/ (* x 9.0) (* c z)) y)))
(if (<= t_1 -1e+98)
t_2
(if (<= t_1 -4e-21)
(* -4.0 (/ (* a t) c))
(if (<= t_1 1e+109) (/ b (* c z)) 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) / (c * z)) * y;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= -4e-21) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 1e+109) {
tmp = b / (c * z);
} 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) / (c * z)) * y
if (t_1 <= (-1d+98)) then
tmp = t_2
else if (t_1 <= (-4d-21)) then
tmp = (-4.0d0) * ((a * t) / c)
else if (t_1 <= 1d+109) then
tmp = b / (c * z)
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) / (c * z)) * y;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= -4e-21) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 1e+109) {
tmp = b / (c * z);
} 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) / (c * z)) * y tmp = 0 if t_1 <= -1e+98: tmp = t_2 elif t_1 <= -4e-21: tmp = -4.0 * ((a * t) / c) elif t_1 <= 1e+109: tmp = b / (c * z) 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(c * z)) * y) tmp = 0.0 if (t_1 <= -1e+98) tmp = t_2; elseif (t_1 <= -4e-21) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); elseif (t_1 <= 1e+109) tmp = Float64(b / Float64(c * z)); 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) / (c * z)) * y;
tmp = 0.0;
if (t_1 <= -1e+98)
tmp = t_2;
elseif (t_1 <= -4e-21)
tmp = -4.0 * ((a * t) / c);
elseif (t_1 <= 1e+109)
tmp = b / (c * z);
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[(c * z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+98], t$95$2, If[LessEqual[t$95$1, -4e-21], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+109], N[(b / N[(c * z), $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{x \cdot 9}{c \cdot z} \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-21}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{elif}\;t\_1 \leq 10^{+109}:\\
\;\;\;\;\frac{b}{c \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999998e97 or 9.99999999999999982e108 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6438.4
Applied rewrites38.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6438.3
Applied rewrites38.3%
if -9.99999999999999998e97 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -3.99999999999999963e-21Initial program 80.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.2
Applied rewrites38.2%
if -3.99999999999999963e-21 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999982e108Initial program 80.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.9
Applied rewrites34.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 (* (* x 9.0) y)) (t_2 (* (* (/ x (* c z)) 9.0) y)))
(if (<= t_1 -1e+98)
t_2
(if (<= t_1 -4e-21)
(* -4.0 (/ (* a t) c))
(if (<= t_1 1e+109) (/ b (* c z)) 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 / (c * z)) * 9.0) * y;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= -4e-21) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 1e+109) {
tmp = b / (c * z);
} 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 / (c * z)) * 9.0d0) * y
if (t_1 <= (-1d+98)) then
tmp = t_2
else if (t_1 <= (-4d-21)) then
tmp = (-4.0d0) * ((a * t) / c)
else if (t_1 <= 1d+109) then
tmp = b / (c * z)
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 / (c * z)) * 9.0) * y;
double tmp;
if (t_1 <= -1e+98) {
tmp = t_2;
} else if (t_1 <= -4e-21) {
tmp = -4.0 * ((a * t) / c);
} else if (t_1 <= 1e+109) {
tmp = b / (c * z);
} 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 / (c * z)) * 9.0) * y tmp = 0 if t_1 <= -1e+98: tmp = t_2 elif t_1 <= -4e-21: tmp = -4.0 * ((a * t) / c) elif t_1 <= 1e+109: tmp = b / (c * z) 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 / Float64(c * z)) * 9.0) * y) tmp = 0.0 if (t_1 <= -1e+98) tmp = t_2; elseif (t_1 <= -4e-21) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); elseif (t_1 <= 1e+109) tmp = Float64(b / Float64(c * z)); 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 / (c * z)) * 9.0) * y;
tmp = 0.0;
if (t_1 <= -1e+98)
tmp = t_2;
elseif (t_1 <= -4e-21)
tmp = -4.0 * ((a * t) / c);
elseif (t_1 <= 1e+109)
tmp = b / (c * z);
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 / N[(c * z), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+98], t$95$2, If[LessEqual[t$95$1, -4e-21], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+109], N[(b / N[(c * z), $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 := \left(\frac{x}{c \cdot z} \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-21}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{elif}\;t\_1 \leq 10^{+109}:\\
\;\;\;\;\frac{b}{c \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999998e97 or 9.99999999999999982e108 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 80.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6438.4
Applied rewrites38.4%
if -9.99999999999999998e97 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -3.99999999999999963e-21Initial program 80.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.2
Applied rewrites38.2%
if -3.99999999999999963e-21 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999982e108Initial program 80.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.9
Applied rewrites34.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 (<= b -3.8e+56) (/ (/ b c) z) (if (<= b 3.6e+56) (* (* (/ t c) -4.0) a) (/ (* b (/ 1.0 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 <= -3.8e+56) {
tmp = (b / c) / z;
} else if (b <= 3.6e+56) {
tmp = ((t / c) * -4.0) * a;
} else {
tmp = (b * (1.0 / 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) :: tmp
if (b <= (-3.8d+56)) then
tmp = (b / c) / z
else if (b <= 3.6d+56) then
tmp = ((t / c) * (-4.0d0)) * a
else
tmp = (b * (1.0d0 / 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 tmp;
if (b <= -3.8e+56) {
tmp = (b / c) / z;
} else if (b <= 3.6e+56) {
tmp = ((t / c) * -4.0) * a;
} else {
tmp = (b * (1.0 / 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): tmp = 0 if b <= -3.8e+56: tmp = (b / c) / z elif b <= 3.6e+56: tmp = ((t / c) * -4.0) * a else: tmp = (b * (1.0 / 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 <= -3.8e+56) tmp = Float64(Float64(b / c) / z); elseif (b <= 3.6e+56) tmp = Float64(Float64(Float64(t / c) * -4.0) * a); else tmp = Float64(Float64(b * Float64(1.0 / 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)
tmp = 0.0;
if (b <= -3.8e+56)
tmp = (b / c) / z;
elseif (b <= 3.6e+56)
tmp = ((t / c) * -4.0) * a;
else
tmp = (b * (1.0 / 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_] := If[LessEqual[b, -3.8e+56], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[b, 3.6e+56], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision], N[(N[(b * N[(1.0 / 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}\;b \leq -3.8 \cdot 10^{+56}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{+56}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot \frac{1}{c}}{z}\\
\end{array}
\end{array}
if b < -3.79999999999999996e56Initial program 80.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.9
Applied rewrites34.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.1
Applied rewrites34.1%
if -3.79999999999999996e56 < b < 3.59999999999999998e56Initial program 80.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6440.1
Applied rewrites40.1%
if 3.59999999999999998e56 < b Initial program 80.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.9
Applied rewrites34.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.1
Applied rewrites34.1%
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift-/.f6434.1
Applied rewrites34.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 (let* ((t_1 (/ (/ b c) z))) (if (<= b -3.8e+56) t_1 (if (<= b 3.6e+56) (* (* (/ t c) -4.0) a) 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 = (b / c) / z;
double tmp;
if (b <= -3.8e+56) {
tmp = t_1;
} else if (b <= 3.6e+56) {
tmp = ((t / c) * -4.0) * a;
} 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 = (b / c) / z
if (b <= (-3.8d+56)) then
tmp = t_1
else if (b <= 3.6d+56) then
tmp = ((t / c) * (-4.0d0)) * a
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 = (b / c) / z;
double tmp;
if (b <= -3.8e+56) {
tmp = t_1;
} else if (b <= 3.6e+56) {
tmp = ((t / c) * -4.0) * a;
} 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 = (b / c) / z tmp = 0 if b <= -3.8e+56: tmp = t_1 elif b <= 3.6e+56: tmp = ((t / c) * -4.0) * a 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(Float64(b / c) / z) tmp = 0.0 if (b <= -3.8e+56) tmp = t_1; elseif (b <= 3.6e+56) tmp = Float64(Float64(Float64(t / c) * -4.0) * a); 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 = (b / c) / z;
tmp = 0.0;
if (b <= -3.8e+56)
tmp = t_1;
elseif (b <= 3.6e+56)
tmp = ((t / c) * -4.0) * a;
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[(N[(b / c), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[b, -3.8e+56], t$95$1, If[LessEqual[b, 3.6e+56], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $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{\frac{b}{c}}{z}\\
\mathbf{if}\;b \leq -3.8 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{+56}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -3.79999999999999996e56 or 3.59999999999999998e56 < b Initial program 80.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.9
Applied rewrites34.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.1
Applied rewrites34.1%
if -3.79999999999999996e56 < b < 3.59999999999999998e56Initial program 80.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6440.1
Applied rewrites40.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 (let* ((t_1 (/ (/ b c) z))) (if (<= b -3.6e+56) t_1 (if (<= b 1.9e+56) (* -4.0 (/ (* a t) 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 = (b / c) / z;
double tmp;
if (b <= -3.6e+56) {
tmp = t_1;
} else if (b <= 1.9e+56) {
tmp = -4.0 * ((a * t) / c);
} 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 = (b / c) / z
if (b <= (-3.6d+56)) then
tmp = t_1
else if (b <= 1.9d+56) then
tmp = (-4.0d0) * ((a * t) / c)
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 = (b / c) / z;
double tmp;
if (b <= -3.6e+56) {
tmp = t_1;
} else if (b <= 1.9e+56) {
tmp = -4.0 * ((a * t) / c);
} 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 = (b / c) / z tmp = 0 if b <= -3.6e+56: tmp = t_1 elif b <= 1.9e+56: tmp = -4.0 * ((a * t) / 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(Float64(b / c) / z) tmp = 0.0 if (b <= -3.6e+56) tmp = t_1; elseif (b <= 1.9e+56) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); 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 = (b / c) / z;
tmp = 0.0;
if (b <= -3.6e+56)
tmp = t_1;
elseif (b <= 1.9e+56)
tmp = -4.0 * ((a * t) / c);
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[(N[(b / c), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[b, -3.6e+56], t$95$1, If[LessEqual[b, 1.9e+56], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / 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{\frac{b}{c}}{z}\\
\mathbf{if}\;b \leq -3.6 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 1.9 \cdot 10^{+56}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -3.59999999999999998e56 or 1.89999999999999998e56 < b Initial program 80.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.9
Applied rewrites34.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.1
Applied rewrites34.1%
if -3.59999999999999998e56 < b < 1.89999999999999998e56Initial program 80.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.2
Applied rewrites38.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 (<= a 1.8e-280) (/ (/ b c) z) (/ 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 (a <= 1.8e-280) {
tmp = (b / c) / z;
} else {
tmp = b / (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) :: tmp
if (a <= 1.8d-280) then
tmp = (b / c) / z
else
tmp = b / (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 tmp;
if (a <= 1.8e-280) {
tmp = (b / c) / z;
} else {
tmp = b / (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): tmp = 0 if a <= 1.8e-280: tmp = (b / c) / z else: tmp = 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 (a <= 1.8e-280) tmp = Float64(Float64(b / c) / z); else tmp = Float64(b / 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)
tmp = 0.0;
if (a <= 1.8e-280)
tmp = (b / c) / z;
else
tmp = b / (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_] := If[LessEqual[a, 1.8e-280], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.8 \cdot 10^{-280}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c \cdot z}\\
\end{array}
\end{array}
if a < 1.79999999999999997e-280Initial program 80.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.9
Applied rewrites34.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.1
Applied rewrites34.1%
if 1.79999999999999997e-280 < a Initial program 80.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.9
Applied rewrites34.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 (/ 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.0%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.9
Applied rewrites34.9%
herbie shell --seed 2025136
(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)))