
(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 (fma (* x 9.0) y b)))
(if (<= z -2.4e+59)
(/ (fma (/ (* 9.0 y) z) x (fma (* a -4.0) t (/ b z))) c)
(if (<= z 2e-29)
(/ (* (fma (* (* z -4.0) a) t t_1) (/ -1.0 c)) (- z))
(/ (fma (* t -4.0) a (/ t_1 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 t_1 = fma((x * 9.0), y, b);
double tmp;
if (z <= -2.4e+59) {
tmp = fma(((9.0 * y) / z), x, fma((a * -4.0), t, (b / z))) / c;
} else if (z <= 2e-29) {
tmp = (fma(((z * -4.0) * a), t, t_1) * (-1.0 / c)) / -z;
} else {
tmp = fma((t * -4.0), a, (t_1 / 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) t_1 = fma(Float64(x * 9.0), y, b) tmp = 0.0 if (z <= -2.4e+59) tmp = Float64(fma(Float64(Float64(9.0 * y) / z), x, fma(Float64(a * -4.0), t, Float64(b / z))) / c); elseif (z <= 2e-29) tmp = Float64(Float64(fma(Float64(Float64(z * -4.0) * a), t, t_1) * Float64(-1.0 / c)) / Float64(-z)); else tmp = Float64(fma(Float64(t * -4.0), a, Float64(t_1 / 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_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y + b), $MachinePrecision]}, If[LessEqual[z, -2.4e+59], N[(N[(N[(N[(9.0 * y), $MachinePrecision] / z), $MachinePrecision] * x + N[(N[(a * -4.0), $MachinePrecision] * t + N[(b / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[z, 2e-29], N[(N[(N[(N[(N[(z * -4.0), $MachinePrecision] * a), $MachinePrecision] * t + t$95$1), $MachinePrecision] * N[(-1.0 / c), $MachinePrecision]), $MachinePrecision] / (-z)), $MachinePrecision], N[(N[(N[(t * -4.0), $MachinePrecision] * a + N[(t$95$1 / 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}
t_1 := \mathsf{fma}\left(x \cdot 9, y, b\right)\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+59}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{9 \cdot y}{z}, x, \mathsf{fma}\left(a \cdot -4, t, \frac{b}{z}\right)\right)}{c}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-29}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(z \cdot -4\right) \cdot a, t, t\_1\right) \cdot \frac{-1}{c}}{-z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t \cdot -4, a, \frac{t\_1}{z}\right)}{c}\\
\end{array}
\end{array}
if z < -2.4000000000000002e59Initial program 79.4%
Applied rewrites81.8%
Applied rewrites85.1%
if -2.4000000000000002e59 < z < 1.99999999999999989e-29Initial program 79.4%
Applied rewrites81.8%
Applied rewrites79.6%
if 1.99999999999999989e-29 < z Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.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 (fma (* x 9.0) y b)))
(if (<= z -2.4e+59)
(/ (fma (/ (* 9.0 y) z) x (fma (* a -4.0) t (/ b z))) c)
(if (<= z 2.65e-32)
(/ (/ (fma (* (* z -4.0) a) t t_1) c) z)
(* (fma (* t -4.0) a (/ t_1 z)) (/ 1.0 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 = fma((x * 9.0), y, b);
double tmp;
if (z <= -2.4e+59) {
tmp = fma(((9.0 * y) / z), x, fma((a * -4.0), t, (b / z))) / c;
} else if (z <= 2.65e-32) {
tmp = (fma(((z * -4.0) * a), t, t_1) / c) / z;
} else {
tmp = fma((t * -4.0), a, (t_1 / z)) * (1.0 / 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 = fma(Float64(x * 9.0), y, b) tmp = 0.0 if (z <= -2.4e+59) tmp = Float64(fma(Float64(Float64(9.0 * y) / z), x, fma(Float64(a * -4.0), t, Float64(b / z))) / c); elseif (z <= 2.65e-32) tmp = Float64(Float64(fma(Float64(Float64(z * -4.0) * a), t, t_1) / c) / z); else tmp = Float64(fma(Float64(t * -4.0), a, Float64(t_1 / z)) * Float64(1.0 / c)); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y + b), $MachinePrecision]}, If[LessEqual[z, -2.4e+59], N[(N[(N[(N[(9.0 * y), $MachinePrecision] / z), $MachinePrecision] * x + N[(N[(a * -4.0), $MachinePrecision] * t + N[(b / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[z, 2.65e-32], N[(N[(N[(N[(N[(z * -4.0), $MachinePrecision] * a), $MachinePrecision] * t + t$95$1), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(t * -4.0), $MachinePrecision] * a + N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / 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}
t_1 := \mathsf{fma}\left(x \cdot 9, y, b\right)\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+59}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{9 \cdot y}{z}, x, \mathsf{fma}\left(a \cdot -4, t, \frac{b}{z}\right)\right)}{c}\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{-32}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\left(z \cdot -4\right) \cdot a, t, t\_1\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot -4, a, \frac{t\_1}{z}\right) \cdot \frac{1}{c}\\
\end{array}
\end{array}
if z < -2.4000000000000002e59Initial program 79.4%
Applied rewrites81.8%
Applied rewrites85.1%
if -2.4000000000000002e59 < z < 2.65e-32Initial program 79.4%
Applied rewrites81.8%
Applied rewrites79.7%
if 2.65e-32 < z Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.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 (fma (* x 9.0) y b)) (t_2 (fma (* t -4.0) a (/ t_1 z))))
(if (<= z -1e+62)
(/ t_2 c)
(if (<= z 2.65e-32)
(/ (/ (fma (* (* z -4.0) a) t t_1) c) z)
(* t_2 (/ 1.0 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 = fma((x * 9.0), y, b);
double t_2 = fma((t * -4.0), a, (t_1 / z));
double tmp;
if (z <= -1e+62) {
tmp = t_2 / c;
} else if (z <= 2.65e-32) {
tmp = (fma(((z * -4.0) * a), t, t_1) / c) / z;
} else {
tmp = t_2 * (1.0 / 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 = fma(Float64(x * 9.0), y, b) t_2 = fma(Float64(t * -4.0), a, Float64(t_1 / z)) tmp = 0.0 if (z <= -1e+62) tmp = Float64(t_2 / c); elseif (z <= 2.65e-32) tmp = Float64(Float64(fma(Float64(Float64(z * -4.0) * a), t, t_1) / c) / z); else tmp = Float64(t_2 * Float64(1.0 / c)); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y + b), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * -4.0), $MachinePrecision] * a + N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e+62], N[(t$95$2 / c), $MachinePrecision], If[LessEqual[z, 2.65e-32], N[(N[(N[(N[(N[(z * -4.0), $MachinePrecision] * a), $MachinePrecision] * t + t$95$1), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], N[(t$95$2 * N[(1.0 / 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}
t_1 := \mathsf{fma}\left(x \cdot 9, y, b\right)\\
t_2 := \mathsf{fma}\left(t \cdot -4, a, \frac{t\_1}{z}\right)\\
\mathbf{if}\;z \leq -1 \cdot 10^{+62}:\\
\;\;\;\;\frac{t\_2}{c}\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{-32}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\left(z \cdot -4\right) \cdot a, t, t\_1\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \frac{1}{c}\\
\end{array}
\end{array}
if z < -1.00000000000000004e62Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.1%
if -1.00000000000000004e62 < z < 2.65e-32Initial program 79.4%
Applied rewrites81.8%
Applied rewrites79.7%
if 2.65e-32 < z Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.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 (/ (fma (* t -4.0) a (/ (fma (* x 9.0) y 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) {
return fma((t * -4.0), a, (fma((x * 9.0), y, b) / z)) / c;
}
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(fma(Float64(t * -4.0), a, Float64(fma(Float64(x * 9.0), y, b) / z)) / c) 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[(N[(t * -4.0), $MachinePrecision] * a + N[(N[(N[(x * 9.0), $MachinePrecision] * y + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\frac{\mathsf{fma}\left(t \cdot -4, a, \frac{\mathsf{fma}\left(x \cdot 9, y, b\right)}{z}\right)}{c}
\end{array}
Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.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 -5e-32)
(/ (fma -4.0 (* a t) (* 9.0 (/ (* x y) z))) c)
(if (<= t_1 5e+163)
(* (fma (* t -4.0) a (/ b z)) (/ 1.0 c))
(/ (* -1.0 (/ (+ b (* 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 = (x * 9.0) * y;
double tmp;
if (t_1 <= -5e-32) {
tmp = fma(-4.0, (a * t), (9.0 * ((x * y) / z))) / c;
} else if (t_1 <= 5e+163) {
tmp = fma((t * -4.0), a, (b / z)) * (1.0 / c);
} else {
tmp = (-1.0 * ((b + (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(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -5e-32) tmp = Float64(fma(-4.0, Float64(a * t), Float64(9.0 * Float64(Float64(x * y) / z))) / c); elseif (t_1 <= 5e+163) tmp = Float64(fma(Float64(t * -4.0), a, Float64(b / z)) * Float64(1.0 / c)); else tmp = Float64(Float64(-1.0 * Float64(Float64(b + Float64(9.0 * Float64(x * y))) / c)) / Float64(-z)); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-32], N[(N[(-4.0 * N[(a * t), $MachinePrecision] + N[(9.0 * N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 5e+163], N[(N[(N[(t * -4.0), $MachinePrecision] * a + N[(b / z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / c), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[(b + N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / (-z)), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-32}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, a \cdot t, 9 \cdot \frac{x \cdot y}{z}\right)}{c}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot -4, a, \frac{b}{z}\right) \cdot \frac{1}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot \frac{b + 9 \cdot \left(x \cdot y\right)}{c}}{-z}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5e-32Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.0%
Taylor expanded in b around 0
Applied rewrites63.6%
if -5e-32 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5e163Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.0%
Taylor expanded in x around 0
Applied rewrites64.4%
if 5e163 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.4%
Applied rewrites81.8%
Applied rewrites79.6%
Taylor expanded in z around 0
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 (/ (* -1.0 (/ (+ b (* 9.0 (* x y))) c)) (- z))))
(if (<= t_1 -4e+85)
t_2
(if (<= t_1 5e+163) (* (fma (* t -4.0) a (/ b z)) (/ 1.0 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 = (-1.0 * ((b + (9.0 * (x * y))) / c)) / -z;
double tmp;
if (t_1 <= -4e+85) {
tmp = t_2;
} else if (t_1 <= 5e+163) {
tmp = fma((t * -4.0), a, (b / z)) * (1.0 / 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(-1.0 * Float64(Float64(b + Float64(9.0 * Float64(x * y))) / c)) / Float64(-z)) tmp = 0.0 if (t_1 <= -4e+85) tmp = t_2; elseif (t_1 <= 5e+163) tmp = Float64(fma(Float64(t * -4.0), a, Float64(b / z)) * Float64(1.0 / 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[(-1.0 * N[(N[(b + N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / (-z)), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+85], t$95$2, If[LessEqual[t$95$1, 5e+163], N[(N[(N[(t * -4.0), $MachinePrecision] * a + N[(b / z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / 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{-1 \cdot \frac{b + 9 \cdot \left(x \cdot y\right)}{c}}{-z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+85}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot -4, a, \frac{b}{z}\right) \cdot \frac{1}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.0000000000000001e85 or 5e163 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.4%
Applied rewrites81.8%
Applied rewrites79.6%
Taylor expanded in z around 0
Applied rewrites60.1%
if -4.0000000000000001e85 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5e163Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.0%
Taylor expanded in x around 0
Applied rewrites64.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)) (t_2 (/ (+ b (* 9.0 (* x y))) (* z c))))
(if (<= t_1 -4e+85)
t_2
(if (<= t_1 5e+163) (* (fma (* t -4.0) a (/ b z)) (/ 1.0 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 = (b + (9.0 * (x * y))) / (z * c);
double tmp;
if (t_1 <= -4e+85) {
tmp = t_2;
} else if (t_1 <= 5e+163) {
tmp = fma((t * -4.0), a, (b / z)) * (1.0 / 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(b + Float64(9.0 * Float64(x * y))) / Float64(z * c)) tmp = 0.0 if (t_1 <= -4e+85) tmp = t_2; elseif (t_1 <= 5e+163) tmp = Float64(fma(Float64(t * -4.0), a, Float64(b / z)) * Float64(1.0 / 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[(b + N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+85], t$95$2, If[LessEqual[t$95$1, 5e+163], N[(N[(N[(t * -4.0), $MachinePrecision] * a + N[(b / z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / 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{b + 9 \cdot \left(x \cdot y\right)}{z \cdot c}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+85}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot -4, a, \frac{b}{z}\right) \cdot \frac{1}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.0000000000000001e85 or 5e163 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.4%
Taylor expanded in z around 0
Applied rewrites59.4%
if -4.0000000000000001e85 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5e163Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.0%
Taylor expanded in x around 0
Applied rewrites64.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)) (t_2 (/ (+ b (* 9.0 (* x y))) (* z c))))
(if (<= t_1 -4e+85)
t_2
(if (<= t_1 5e+163) (/ (fma -4.0 (* a t) (/ 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 = (b + (9.0 * (x * y))) / (z * c);
double tmp;
if (t_1 <= -4e+85) {
tmp = t_2;
} else if (t_1 <= 5e+163) {
tmp = fma(-4.0, (a * t), (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(b + Float64(9.0 * Float64(x * y))) / Float64(z * c)) tmp = 0.0 if (t_1 <= -4e+85) tmp = t_2; elseif (t_1 <= 5e+163) tmp = Float64(fma(-4.0, Float64(a * t), Float64(b / 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[(b + N[(9.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+85], t$95$2, If[LessEqual[t$95$1, 5e+163], N[(N[(-4.0 * N[(a * t), $MachinePrecision] + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $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{b + 9 \cdot \left(x \cdot y\right)}{z \cdot c}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+85}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+163}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, a \cdot t, \frac{b}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.0000000000000001e85 or 5e163 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.4%
Taylor expanded in z around 0
Applied rewrites59.4%
if -4.0000000000000001e85 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5e163Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.0%
Taylor expanded in x around 0
Applied rewrites64.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 -4e+85)
(/ (* 9.0 (* x (/ y z))) c)
(if (<= t_1 1e+171)
(/ (fma -4.0 (* a t) (/ b z)) c)
(/ (* -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 = (x * 9.0) * y;
double tmp;
if (t_1 <= -4e+85) {
tmp = (9.0 * (x * (y / z))) / c;
} else if (t_1 <= 1e+171) {
tmp = fma(-4.0, (a * t), (b / z)) / c;
} 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(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -4e+85) tmp = Float64(Float64(9.0 * Float64(x * Float64(y / z))) / c); elseif (t_1 <= 1e+171) tmp = Float64(fma(-4.0, Float64(a * t), Float64(b / z)) / c); else tmp = Float64(Float64(-9.0 * Float64(Float64(x * y) / c)) / Float64(-z)); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+85], N[(N[(9.0 * N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 1e+171], N[(N[(-4.0 * N[(a * t), $MachinePrecision] + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(-9.0 * N[(N[(x * y), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / (-z)), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+85}:\\
\;\;\;\;\frac{9 \cdot \left(x \cdot \frac{y}{z}\right)}{c}\\
\mathbf{elif}\;t\_1 \leq 10^{+171}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-4, a \cdot t, \frac{b}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-9 \cdot \frac{x \cdot y}{c}}{-z}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.0000000000000001e85Initial program 79.4%
Applied rewrites81.8%
Taylor expanded in x around inf
Applied rewrites34.0%
Applied rewrites34.9%
if -4.0000000000000001e85 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999954e170Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.0%
Taylor expanded in x around 0
Applied rewrites64.2%
if 9.99999999999999954e170 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.4%
Applied rewrites81.8%
Applied rewrites79.6%
Taylor expanded in x around inf
Applied rewrites34.8%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(if (<= t_1 -4e+85)
(/ (* 9.0 (* x (/ y z))) c)
(if (<= t_1 -2e-53)
(* (* -4.0 (* a t)) (/ 1.0 c))
(if (<= t_1 -2e-312)
(* (/ b c) (/ 1.0 z))
(if (<= t_1 1e+171)
(* -4.0 (/ (* a t) c))
(/ (* -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 = (x * 9.0) * y;
double tmp;
if (t_1 <= -4e+85) {
tmp = (9.0 * (x * (y / z))) / c;
} else if (t_1 <= -2e-53) {
tmp = (-4.0 * (a * t)) * (1.0 / c);
} else if (t_1 <= -2e-312) {
tmp = (b / c) * (1.0 / z);
} else if (t_1 <= 1e+171) {
tmp = -4.0 * ((a * t) / c);
} 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) :: tmp
t_1 = (x * 9.0d0) * y
if (t_1 <= (-4d+85)) then
tmp = (9.0d0 * (x * (y / z))) / c
else if (t_1 <= (-2d-53)) then
tmp = ((-4.0d0) * (a * t)) * (1.0d0 / c)
else if (t_1 <= (-2d-312)) then
tmp = (b / c) * (1.0d0 / z)
else if (t_1 <= 1d+171) then
tmp = (-4.0d0) * ((a * t) / c)
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 = (x * 9.0) * y;
double tmp;
if (t_1 <= -4e+85) {
tmp = (9.0 * (x * (y / z))) / c;
} else if (t_1 <= -2e-53) {
tmp = (-4.0 * (a * t)) * (1.0 / c);
} else if (t_1 <= -2e-312) {
tmp = (b / c) * (1.0 / z);
} else if (t_1 <= 1e+171) {
tmp = -4.0 * ((a * t) / c);
} 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 = (x * 9.0) * y tmp = 0 if t_1 <= -4e+85: tmp = (9.0 * (x * (y / z))) / c elif t_1 <= -2e-53: tmp = (-4.0 * (a * t)) * (1.0 / c) elif t_1 <= -2e-312: tmp = (b / c) * (1.0 / z) elif t_1 <= 1e+171: tmp = -4.0 * ((a * t) / c) 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(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -4e+85) tmp = Float64(Float64(9.0 * Float64(x * Float64(y / z))) / c); elseif (t_1 <= -2e-53) tmp = Float64(Float64(-4.0 * Float64(a * t)) * Float64(1.0 / c)); elseif (t_1 <= -2e-312) tmp = Float64(Float64(b / c) * Float64(1.0 / z)); elseif (t_1 <= 1e+171) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = Float64(Float64(-9.0 * Float64(Float64(x * y) / c)) / Float64(-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 = (x * 9.0) * y;
tmp = 0.0;
if (t_1 <= -4e+85)
tmp = (9.0 * (x * (y / z))) / c;
elseif (t_1 <= -2e-53)
tmp = (-4.0 * (a * t)) * (1.0 / c);
elseif (t_1 <= -2e-312)
tmp = (b / c) * (1.0 / z);
elseif (t_1 <= 1e+171)
tmp = -4.0 * ((a * t) / c);
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[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+85], N[(N[(9.0 * N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, -2e-53], N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -2e-312], N[(N[(b / c), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+171], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], N[(N[(-9.0 * N[(N[(x * y), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / (-z)), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+85}:\\
\;\;\;\;\frac{9 \cdot \left(x \cdot \frac{y}{z}\right)}{c}\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-53}:\\
\;\;\;\;\left(-4 \cdot \left(a \cdot t\right)\right) \cdot \frac{1}{c}\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-312}:\\
\;\;\;\;\frac{b}{c} \cdot \frac{1}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+171}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-9 \cdot \frac{x \cdot y}{c}}{-z}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.0000000000000001e85Initial program 79.4%
Applied rewrites81.8%
Taylor expanded in x around inf
Applied rewrites34.0%
Applied rewrites34.9%
if -4.0000000000000001e85 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000006e-53Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.0%
Taylor expanded in z around inf
Applied rewrites38.8%
if -2.00000000000000006e-53 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.0000000000019e-312Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites35.0%
Applied rewrites34.8%
if -2.0000000000019e-312 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999954e170Initial program 79.4%
Taylor expanded in z around inf
Applied rewrites38.9%
if 9.99999999999999954e170 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.4%
Applied rewrites81.8%
Applied rewrites79.6%
Taylor expanded in x around inf
Applied rewrites34.8%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (/ (* 9.0 (* x (/ y z))) c)))
(if (<= t_1 -4e+85)
t_2
(if (<= t_1 -2e-53)
(* (* -4.0 (* a t)) (/ 1.0 c))
(if (<= t_1 -2e-312)
(* (/ b c) (/ 1.0 z))
(if (<= t_1 1e+171) (* -4.0 (/ (* a t) c)) t_2))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (9.0 * (x * (y / z))) / c;
double tmp;
if (t_1 <= -4e+85) {
tmp = t_2;
} else if (t_1 <= -2e-53) {
tmp = (-4.0 * (a * t)) * (1.0 / c);
} else if (t_1 <= -2e-312) {
tmp = (b / c) * (1.0 / z);
} else if (t_1 <= 1e+171) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = (9.0d0 * (x * (y / z))) / c
if (t_1 <= (-4d+85)) then
tmp = t_2
else if (t_1 <= (-2d-53)) then
tmp = ((-4.0d0) * (a * t)) * (1.0d0 / c)
else if (t_1 <= (-2d-312)) then
tmp = (b / c) * (1.0d0 / z)
else if (t_1 <= 1d+171) then
tmp = (-4.0d0) * ((a * t) / c)
else
tmp = t_2
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (9.0 * (x * (y / z))) / c;
double tmp;
if (t_1 <= -4e+85) {
tmp = t_2;
} else if (t_1 <= -2e-53) {
tmp = (-4.0 * (a * t)) * (1.0 / c);
} else if (t_1 <= -2e-312) {
tmp = (b / c) * (1.0 / z);
} else if (t_1 <= 1e+171) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = (9.0 * (x * (y / z))) / c tmp = 0 if t_1 <= -4e+85: tmp = t_2 elif t_1 <= -2e-53: tmp = (-4.0 * (a * t)) * (1.0 / c) elif t_1 <= -2e-312: tmp = (b / c) * (1.0 / z) elif t_1 <= 1e+171: tmp = -4.0 * ((a * t) / c) else: tmp = t_2 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(9.0 * Float64(x * Float64(y / z))) / c) tmp = 0.0 if (t_1 <= -4e+85) tmp = t_2; elseif (t_1 <= -2e-53) tmp = Float64(Float64(-4.0 * Float64(a * t)) * Float64(1.0 / c)); elseif (t_1 <= -2e-312) tmp = Float64(Float64(b / c) * Float64(1.0 / z)); elseif (t_1 <= 1e+171) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = t_2; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (x * 9.0) * y;
t_2 = (9.0 * (x * (y / z))) / c;
tmp = 0.0;
if (t_1 <= -4e+85)
tmp = t_2;
elseif (t_1 <= -2e-53)
tmp = (-4.0 * (a * t)) * (1.0 / c);
elseif (t_1 <= -2e-312)
tmp = (b / c) * (1.0 / z);
elseif (t_1 <= 1e+171)
tmp = -4.0 * ((a * t) / c);
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(9.0 * N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+85], t$95$2, If[LessEqual[t$95$1, -2e-53], N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -2e-312], N[(N[(b / c), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+171], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \frac{9 \cdot \left(x \cdot \frac{y}{z}\right)}{c}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+85}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-53}:\\
\;\;\;\;\left(-4 \cdot \left(a \cdot t\right)\right) \cdot \frac{1}{c}\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-312}:\\
\;\;\;\;\frac{b}{c} \cdot \frac{1}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+171}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.0000000000000001e85 or 9.99999999999999954e170 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.4%
Applied rewrites81.8%
Taylor expanded in x around inf
Applied rewrites34.0%
Applied rewrites34.9%
if -4.0000000000000001e85 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000006e-53Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.0%
Taylor expanded in z around inf
Applied rewrites38.8%
if -2.00000000000000006e-53 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.0000000000019e-312Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites35.0%
Applied rewrites34.8%
if -2.0000000000019e-312 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999954e170Initial program 79.4%
Taylor expanded in z around inf
Applied rewrites38.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 (* 9.0 (/ (* x y) (* c z)))))
(if (<= t_1 -1e+20)
t_2
(if (<= t_1 -2e-53)
(* (* -4.0 (* a t)) (/ 1.0 c))
(if (<= t_1 -2e-312)
(* (/ b c) (/ 1.0 z))
(if (<= t_1 1e+171) (* -4.0 (/ (* a t) c)) t_2))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = 9.0 * ((x * y) / (c * z));
double tmp;
if (t_1 <= -1e+20) {
tmp = t_2;
} else if (t_1 <= -2e-53) {
tmp = (-4.0 * (a * t)) * (1.0 / c);
} else if (t_1 <= -2e-312) {
tmp = (b / c) * (1.0 / z);
} else if (t_1 <= 1e+171) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = 9.0d0 * ((x * y) / (c * z))
if (t_1 <= (-1d+20)) then
tmp = t_2
else if (t_1 <= (-2d-53)) then
tmp = ((-4.0d0) * (a * t)) * (1.0d0 / c)
else if (t_1 <= (-2d-312)) then
tmp = (b / c) * (1.0d0 / z)
else if (t_1 <= 1d+171) then
tmp = (-4.0d0) * ((a * t) / c)
else
tmp = t_2
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = 9.0 * ((x * y) / (c * z));
double tmp;
if (t_1 <= -1e+20) {
tmp = t_2;
} else if (t_1 <= -2e-53) {
tmp = (-4.0 * (a * t)) * (1.0 / c);
} else if (t_1 <= -2e-312) {
tmp = (b / c) * (1.0 / z);
} else if (t_1 <= 1e+171) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = 9.0 * ((x * y) / (c * z)) tmp = 0 if t_1 <= -1e+20: tmp = t_2 elif t_1 <= -2e-53: tmp = (-4.0 * (a * t)) * (1.0 / c) elif t_1 <= -2e-312: tmp = (b / c) * (1.0 / z) elif t_1 <= 1e+171: tmp = -4.0 * ((a * t) / c) else: tmp = t_2 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(9.0 * Float64(Float64(x * y) / Float64(c * z))) tmp = 0.0 if (t_1 <= -1e+20) tmp = t_2; elseif (t_1 <= -2e-53) tmp = Float64(Float64(-4.0 * Float64(a * t)) * Float64(1.0 / c)); elseif (t_1 <= -2e-312) tmp = Float64(Float64(b / c) * Float64(1.0 / z)); elseif (t_1 <= 1e+171) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = t_2; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (x * 9.0) * y;
t_2 = 9.0 * ((x * y) / (c * z));
tmp = 0.0;
if (t_1 <= -1e+20)
tmp = t_2;
elseif (t_1 <= -2e-53)
tmp = (-4.0 * (a * t)) * (1.0 / c);
elseif (t_1 <= -2e-312)
tmp = (b / c) * (1.0 / z);
elseif (t_1 <= 1e+171)
tmp = -4.0 * ((a * t) / c);
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(9.0 * N[(N[(x * y), $MachinePrecision] / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+20], t$95$2, If[LessEqual[t$95$1, -2e-53], N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -2e-312], N[(N[(b / c), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+171], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := 9 \cdot \frac{x \cdot y}{c \cdot z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+20}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-53}:\\
\;\;\;\;\left(-4 \cdot \left(a \cdot t\right)\right) \cdot \frac{1}{c}\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-312}:\\
\;\;\;\;\frac{b}{c} \cdot \frac{1}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+171}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -1e20 or 9.99999999999999954e170 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.4%
Taylor expanded in x around inf
Applied rewrites35.1%
if -1e20 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000006e-53Initial program 79.4%
Applied rewrites81.8%
Applied rewrites87.0%
Taylor expanded in z around inf
Applied rewrites38.8%
if -2.00000000000000006e-53 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.0000000000019e-312Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites35.0%
Applied rewrites34.8%
if -2.0000000000019e-312 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999954e170Initial program 79.4%
Taylor expanded in z around inf
Applied rewrites38.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 (* -4.0 (/ (* a t) c)))
(t_2 (* (* x 9.0) y))
(t_3 (* 9.0 (/ (* x y) (* c z)))))
(if (<= t_2 -1e+20)
t_3
(if (<= t_2 -2e-53)
t_1
(if (<= t_2 -2e-312)
(* (/ b c) (/ 1.0 z))
(if (<= t_2 1e+171) 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 = -4.0 * ((a * t) / c);
double t_2 = (x * 9.0) * y;
double t_3 = 9.0 * ((x * y) / (c * z));
double tmp;
if (t_2 <= -1e+20) {
tmp = t_3;
} else if (t_2 <= -2e-53) {
tmp = t_1;
} else if (t_2 <= -2e-312) {
tmp = (b / c) * (1.0 / z);
} else if (t_2 <= 1e+171) {
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 = (-4.0d0) * ((a * t) / c)
t_2 = (x * 9.0d0) * y
t_3 = 9.0d0 * ((x * y) / (c * z))
if (t_2 <= (-1d+20)) then
tmp = t_3
else if (t_2 <= (-2d-53)) then
tmp = t_1
else if (t_2 <= (-2d-312)) then
tmp = (b / c) * (1.0d0 / z)
else if (t_2 <= 1d+171) 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 = -4.0 * ((a * t) / c);
double t_2 = (x * 9.0) * y;
double t_3 = 9.0 * ((x * y) / (c * z));
double tmp;
if (t_2 <= -1e+20) {
tmp = t_3;
} else if (t_2 <= -2e-53) {
tmp = t_1;
} else if (t_2 <= -2e-312) {
tmp = (b / c) * (1.0 / z);
} else if (t_2 <= 1e+171) {
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 = -4.0 * ((a * t) / c) t_2 = (x * 9.0) * y t_3 = 9.0 * ((x * y) / (c * z)) tmp = 0 if t_2 <= -1e+20: tmp = t_3 elif t_2 <= -2e-53: tmp = t_1 elif t_2 <= -2e-312: tmp = (b / c) * (1.0 / z) elif t_2 <= 1e+171: 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(-4.0 * Float64(Float64(a * 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 <= -1e+20) tmp = t_3; elseif (t_2 <= -2e-53) tmp = t_1; elseif (t_2 <= -2e-312) tmp = Float64(Float64(b / c) * Float64(1.0 / z)); elseif (t_2 <= 1e+171) 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 = -4.0 * ((a * t) / c);
t_2 = (x * 9.0) * y;
t_3 = 9.0 * ((x * y) / (c * z));
tmp = 0.0;
if (t_2 <= -1e+20)
tmp = t_3;
elseif (t_2 <= -2e-53)
tmp = t_1;
elseif (t_2 <= -2e-312)
tmp = (b / c) * (1.0 / z);
elseif (t_2 <= 1e+171)
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[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $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, -1e+20], t$95$3, If[LessEqual[t$95$2, -2e-53], t$95$1, If[LessEqual[t$95$2, -2e-312], N[(N[(b / c), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+171], 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 := -4 \cdot \frac{a \cdot t}{c}\\
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 -1 \cdot 10^{+20}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-312}:\\
\;\;\;\;\frac{b}{c} \cdot \frac{1}{z}\\
\mathbf{elif}\;t\_2 \leq 10^{+171}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -1e20 or 9.99999999999999954e170 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 79.4%
Taylor expanded in x around inf
Applied rewrites35.1%
if -1e20 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000006e-53 or -2.0000000000019e-312 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 9.99999999999999954e170Initial program 79.4%
Taylor expanded in z around inf
Applied rewrites38.9%
if -2.00000000000000006e-53 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.0000000000019e-312Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites35.0%
Applied rewrites34.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 -1.85e+80) (/ (/ b c) z) (if (<= b 1.02e+83) (* -4.0 (/ (* a t) c)) (/ (* 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 <= -1.85e+80) {
tmp = (b / c) / z;
} else if (b <= 1.02e+83) {
tmp = -4.0 * ((a * t) / c);
} 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 <= (-1.85d+80)) then
tmp = (b / c) / z
else if (b <= 1.02d+83) then
tmp = (-4.0d0) * ((a * t) / c)
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 <= -1.85e+80) {
tmp = (b / c) / z;
} else if (b <= 1.02e+83) {
tmp = -4.0 * ((a * t) / c);
} 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 <= -1.85e+80: tmp = (b / c) / z elif b <= 1.02e+83: tmp = -4.0 * ((a * t) / c) 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 <= -1.85e+80) tmp = Float64(Float64(b / c) / z); elseif (b <= 1.02e+83) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); 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 <= -1.85e+80)
tmp = (b / c) / z;
elseif (b <= 1.02e+83)
tmp = -4.0 * ((a * t) / c);
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, -1.85e+80], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[b, 1.02e+83], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $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 -1.85 \cdot 10^{+80}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{elif}\;b \leq 1.02 \cdot 10^{+83}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot \frac{1}{c}}{z}\\
\end{array}
\end{array}
if b < -1.84999999999999998e80Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites35.0%
Applied rewrites34.8%
if -1.84999999999999998e80 < b < 1.0200000000000001e83Initial program 79.4%
Taylor expanded in z around inf
Applied rewrites38.9%
if 1.0200000000000001e83 < b Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites35.0%
Applied rewrites34.8%
Applied rewrites34.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 (/ (/ b c) z))) (if (<= b -1.85e+80) t_1 (if (<= b 1.02e+83) (* -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 <= -1.85e+80) {
tmp = t_1;
} else if (b <= 1.02e+83) {
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 <= (-1.85d+80)) then
tmp = t_1
else if (b <= 1.02d+83) 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 <= -1.85e+80) {
tmp = t_1;
} else if (b <= 1.02e+83) {
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 <= -1.85e+80: tmp = t_1 elif b <= 1.02e+83: 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 <= -1.85e+80) tmp = t_1; elseif (b <= 1.02e+83) 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 <= -1.85e+80)
tmp = t_1;
elseif (b <= 1.02e+83)
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, -1.85e+80], t$95$1, If[LessEqual[b, 1.02e+83], 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 -1.85 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 1.02 \cdot 10^{+83}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.84999999999999998e80 or 1.0200000000000001e83 < b Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites35.0%
Applied rewrites34.8%
if -1.84999999999999998e80 < b < 1.0200000000000001e83Initial program 79.4%
Taylor expanded in z around inf
Applied rewrites38.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 (<= c 7e-213) (/ 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 (c <= 7e-213) {
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 (c <= 7d-213) 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 (c <= 7e-213) {
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 c <= 7e-213: 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 (c <= 7e-213) tmp = Float64(b / Float64(c * z)); else tmp = Float64(Float64(b / 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 (c <= 7e-213)
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[c, 7e-213], N[(b / N[(c * z), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;c \leq 7 \cdot 10^{-213}:\\
\;\;\;\;\frac{b}{c \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\end{array}
\end{array}
if c < 7.00000000000000034e-213Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites35.0%
if 7.00000000000000034e-213 < c Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites35.0%
Applied rewrites34.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 (/ 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.4%
Taylor expanded in b around inf
Applied rewrites35.0%
herbie shell --seed 2025161
(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)))