
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (fma (* t a) -4.0 (* (fma (/ y z) 9.0 (/ b (* z x))) x)) c)))
(if (<= z -1.4e+82)
t_1
(if (<= z 5.2e+44)
(/ (+ (- (* (* x 9.0) y) (* (* 4.0 z) (* a t))) b) (* z c))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((t * a), -4.0, (fma((y / z), 9.0, (b / (z * x))) * x)) / c;
double tmp;
if (z <= -1.4e+82) {
tmp = t_1;
} else if (z <= 5.2e+44) {
tmp = ((((x * 9.0) * y) - ((4.0 * z) * (a * t))) + b) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(fma(Float64(t * a), -4.0, Float64(fma(Float64(y / z), 9.0, Float64(b / Float64(z * x))) * x)) / c) tmp = 0.0 if (z <= -1.4e+82) tmp = t_1; elseif (z <= 5.2e+44) tmp = Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(4.0 * z) * Float64(a * t))) + b) / Float64(z * c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(t * a), $MachinePrecision] * -4.0 + N[(N[(N[(y / z), $MachinePrecision] * 9.0 + N[(b / N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[z, -1.4e+82], t$95$1, If[LessEqual[z, 5.2e+44], N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(4.0 * z), $MachinePrecision] * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(t \cdot a, -4, \mathsf{fma}\left(\frac{y}{z}, 9, \frac{b}{z \cdot x}\right) \cdot x\right)}{c}\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+44}:\\
\;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(4 \cdot z\right) \cdot \left(a \cdot t\right)\right) + b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.4e82 or 5.1999999999999998e44 < z Initial program 58.0%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites66.9%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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.0
Applied rewrites87.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6487.8
Applied rewrites87.8%
if -1.4e82 < z < 5.1999999999999998e44Initial program 93.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6490.8
Applied rewrites90.8%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y))
(t_2 (/ (+ (- t_1 (* (* (* z 4.0) t) a)) b) (* z c))))
(if (<= t_2 -1e-117)
(/ (+ (- t_1 (* (* 4.0 z) (* a t))) b) (* z c))
(if (<= t_2 INFINITY)
(/ (fma (* t a) -4.0 (/ (fma (* y x) 9.0 b) z)) c)
(* (fma (* x (/ y (* (* t z) c))) 9.0 (* (/ a c) -4.0)) t)))))
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 = ((t_1 - (((z * 4.0) * t) * a)) + b) / (z * c);
double tmp;
if (t_2 <= -1e-117) {
tmp = ((t_1 - ((4.0 * z) * (a * t))) + b) / (z * c);
} else if (t_2 <= ((double) INFINITY)) {
tmp = fma((t * a), -4.0, (fma((y * x), 9.0, b) / z)) / c;
} else {
tmp = fma((x * (y / ((t * z) * c))), 9.0, ((a / c) * -4.0)) * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(Float64(t_1 - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) tmp = 0.0 if (t_2 <= -1e-117) tmp = Float64(Float64(Float64(t_1 - Float64(Float64(4.0 * z) * Float64(a * t))) + b) / Float64(z * c)); elseif (t_2 <= Inf) tmp = Float64(fma(Float64(t * a), -4.0, Float64(fma(Float64(y * x), 9.0, b) / z)) / c); else tmp = Float64(fma(Float64(x * Float64(y / Float64(Float64(t * z) * c))), 9.0, Float64(Float64(a / c) * -4.0)) * t); end return tmp end
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[(t$95$1 - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-117], N[(N[(N[(t$95$1 - N[(N[(4.0 * z), $MachinePrecision] * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(N[(t * a), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(x * N[(y / N[(N[(t * z), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 9.0 + N[(N[(a / c), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \frac{\left(t\_1 - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-117}:\\
\;\;\;\;\frac{\left(t\_1 - \left(4 \cdot z\right) \cdot \left(a \cdot t\right)\right) + b}{z \cdot c}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(t \cdot a, -4, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot \frac{y}{\left(t \cdot z\right) \cdot c}, 9, \frac{a}{c} \cdot -4\right) \cdot t\\
\end{array}
\end{array}
if (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) < -1.00000000000000003e-117Initial program 89.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6489.4
Applied rewrites89.4%
if -1.00000000000000003e-117 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) < +inf.0Initial program 83.8%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites86.0%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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-*.f6489.9
Applied rewrites89.9%
if +inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) Initial program 0.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites51.2%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6466.5
Applied rewrites66.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y))
(t_2 (/ (+ (- t_1 (* (* (* z 4.0) t) a)) b) (* z c))))
(if (<= t_2 -1e-117)
(/ (+ (- t_1 (* (* 4.0 z) (* a t))) b) (* z c))
(if (<= t_2 INFINITY)
(/ (fma (* t a) -4.0 (/ (fma (* y x) 9.0 b) z)) c)
(* (* (/ a c) -4.0) t)))))
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 = ((t_1 - (((z * 4.0) * t) * a)) + b) / (z * c);
double tmp;
if (t_2 <= -1e-117) {
tmp = ((t_1 - ((4.0 * z) * (a * t))) + b) / (z * c);
} else if (t_2 <= ((double) INFINITY)) {
tmp = fma((t * a), -4.0, (fma((y * x), 9.0, b) / z)) / c;
} else {
tmp = ((a / c) * -4.0) * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(Float64(t_1 - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) tmp = 0.0 if (t_2 <= -1e-117) tmp = Float64(Float64(Float64(t_1 - Float64(Float64(4.0 * z) * Float64(a * t))) + b) / Float64(z * c)); elseif (t_2 <= Inf) tmp = Float64(fma(Float64(t * a), -4.0, Float64(fma(Float64(y * x), 9.0, b) / z)) / c); else tmp = Float64(Float64(Float64(a / c) * -4.0) * t); end return tmp end
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[(t$95$1 - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-117], N[(N[(N[(t$95$1 - N[(N[(4.0 * z), $MachinePrecision] * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(N[(t * a), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(a / c), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \frac{\left(t\_1 - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-117}:\\
\;\;\;\;\frac{\left(t\_1 - \left(4 \cdot z\right) \cdot \left(a \cdot t\right)\right) + b}{z \cdot c}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(t \cdot a, -4, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{a}{c} \cdot -4\right) \cdot t\\
\end{array}
\end{array}
if (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) < -1.00000000000000003e-117Initial program 89.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6489.4
Applied rewrites89.4%
if -1.00000000000000003e-117 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) < +inf.0Initial program 83.8%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites86.0%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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-*.f6489.9
Applied rewrites89.9%
if +inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) Initial program 0.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites51.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6462.1
Applied rewrites62.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(if (<= t_1 -5e+272)
(/ (* (* y (/ x c)) 9.0) z)
(if (<= t_1 1e+303)
(/ (fma (* t a) -4.0 (/ (fma (* y x) 9.0 b) z)) c)
(/ (fma (* t a) -4.0 (* (* (/ y z) 9.0) x)) 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+272) {
tmp = ((y * (x / c)) * 9.0) / z;
} else if (t_1 <= 1e+303) {
tmp = fma((t * a), -4.0, (fma((y * x), 9.0, b) / z)) / c;
} else {
tmp = fma((t * a), -4.0, (((y / z) * 9.0) * x)) / c;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -5e+272) tmp = Float64(Float64(Float64(y * Float64(x / c)) * 9.0) / z); elseif (t_1 <= 1e+303) tmp = Float64(fma(Float64(t * a), -4.0, Float64(fma(Float64(y * x), 9.0, b) / z)) / c); else tmp = Float64(fma(Float64(t * a), -4.0, Float64(Float64(Float64(y / z) * 9.0) * x)) / c); end return tmp end
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+272], N[(N[(N[(y * N[(x / c), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 1e+303], N[(N[(N[(t * a), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(t * a), $MachinePrecision] * -4.0 + N[(N[(N[(y / z), $MachinePrecision] * 9.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+272}:\\
\;\;\;\;\frac{\left(y \cdot \frac{x}{c}\right) \cdot 9}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+303}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t \cdot a, -4, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t \cdot a, -4, \left(\frac{y}{z} \cdot 9\right) \cdot x\right)}{c}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.99999999999999973e272Initial program 64.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6464.1
Applied rewrites64.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6455.8
Applied rewrites55.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6464.9
Applied rewrites64.9%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6481.8
Applied rewrites81.8%
if -4.99999999999999973e272 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1e303Initial program 82.0%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites81.4%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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-*.f6489.9
Applied rewrites89.9%
if 1e303 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 59.5%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites60.3%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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-*.f6460.5
Applied rewrites60.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6480.5
Applied rewrites80.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6481.8
Applied rewrites81.8%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (fma (* t a) -4.0 (* (* (/ y z) 9.0) x)) c)))
(if (<= z -0.0135)
t_1
(if (<= z 1.12e+43) (/ (/ (fma (* x y) 9.0 b) c) z) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((t * a), -4.0, (((y / z) * 9.0) * x)) / c;
double tmp;
if (z <= -0.0135) {
tmp = t_1;
} else if (z <= 1.12e+43) {
tmp = (fma((x * y), 9.0, b) / c) / z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(fma(Float64(t * a), -4.0, Float64(Float64(Float64(y / z) * 9.0) * x)) / c) tmp = 0.0 if (z <= -0.0135) tmp = t_1; elseif (z <= 1.12e+43) tmp = Float64(Float64(fma(Float64(x * y), 9.0, b) / c) / z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(t * a), $MachinePrecision] * -4.0 + N[(N[(N[(y / z), $MachinePrecision] * 9.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[z, -0.0135], t$95$1, If[LessEqual[z, 1.12e+43], N[(N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(t \cdot a, -4, \left(\frac{y}{z} \cdot 9\right) \cdot x\right)}{c}\\
\mathbf{if}\;z \leq -0.0135:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+43}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.0134999999999999998 or 1.12e43 < z Initial program 62.1%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites70.2%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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-*.f6488.0
Applied rewrites88.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6487.9
Applied rewrites87.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6475.5
Applied rewrites75.5%
if -0.0134999999999999998 < z < 1.12e43Initial program 94.3%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6491.3
Applied rewrites91.3%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6490.0
Applied rewrites90.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6477.1
Applied rewrites77.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (fma (* t a) -4.0 (/ b z)) c)))
(if (<= z -2.1)
t_1
(if (<= z 4.2e+99) (/ (/ (fma (* x y) 9.0 b) c) z) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((t * a), -4.0, (b / z)) / c;
double tmp;
if (z <= -2.1) {
tmp = t_1;
} else if (z <= 4.2e+99) {
tmp = (fma((x * y), 9.0, b) / c) / z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(fma(Float64(t * a), -4.0, Float64(b / z)) / c) tmp = 0.0 if (z <= -2.1) tmp = t_1; elseif (z <= 4.2e+99) tmp = Float64(Float64(fma(Float64(x * y), 9.0, b) / c) / z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(t * a), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[z, -2.1], t$95$1, If[LessEqual[z, 4.2e+99], N[(N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(t \cdot a, -4, \frac{b}{z}\right)}{c}\\
\mathbf{if}\;z \leq -2.1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+99}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.10000000000000009 or 4.2000000000000002e99 < z Initial program 60.6%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites69.1%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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.8
Applied rewrites87.8%
Taylor expanded in x around 0
Applied rewrites72.6%
if -2.10000000000000009 < z < 4.2000000000000002e99Initial program 92.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6490.5
Applied rewrites90.5%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6488.3
Applied rewrites88.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6474.9
Applied rewrites74.9%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* (/ t c) -4.0) a)))
(if (<= a -7.8e-69)
t_1
(if (<= a 5.2e+185) (/ (/ (fma (* x y) 9.0 b) c) z) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((t / c) * -4.0) * a;
double tmp;
if (a <= -7.8e-69) {
tmp = t_1;
} else if (a <= 5.2e+185) {
tmp = (fma((x * y), 9.0, b) / c) / z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(t / c) * -4.0) * a) tmp = 0.0 if (a <= -7.8e-69) tmp = t_1; elseif (a <= 5.2e+185) tmp = Float64(Float64(fma(Float64(x * y), 9.0, b) / c) / z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -7.8e-69], t$95$1, If[LessEqual[a, 5.2e+185], N[(N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{t}{c} \cdot -4\right) \cdot a\\
\mathbf{if}\;a \leq -7.8 \cdot 10^{-69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+185}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -7.79999999999999961e-69 or 5.20000000000000001e185 < a Initial program 79.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites83.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6455.0
Applied rewrites55.0%
if -7.79999999999999961e-69 < a < 5.20000000000000001e185Initial program 79.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.3
Applied rewrites82.3%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6476.5
Applied rewrites76.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6468.0
Applied rewrites68.0%
(FPCore (x y z t a b c) :precision binary64 (if (<= z -1.25e+67) (* (* (/ t c) -4.0) a) (if (<= z 4.2e+99) (/ (fma (* 9.0 x) y b) (* z c)) (* (* (/ a c) -4.0) t))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -1.25e+67) {
tmp = ((t / c) * -4.0) * a;
} else if (z <= 4.2e+99) {
tmp = fma((9.0 * x), y, b) / (z * c);
} else {
tmp = ((a / c) * -4.0) * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -1.25e+67) tmp = Float64(Float64(Float64(t / c) * -4.0) * a); elseif (z <= 4.2e+99) tmp = Float64(fma(Float64(9.0 * x), y, b) / Float64(z * c)); else tmp = Float64(Float64(Float64(a / c) * -4.0) * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -1.25e+67], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[z, 4.2e+99], N[(N[(N[(9.0 * x), $MachinePrecision] * y + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a / c), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+67}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+99}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{a}{c} \cdot -4\right) \cdot t\\
\end{array}
\end{array}
if z < -1.24999999999999994e67Initial program 57.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6456.8
Applied rewrites56.8%
if -1.24999999999999994e67 < z < 4.2000000000000002e99Initial program 92.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6473.9
Applied rewrites73.9%
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6473.9
Applied rewrites73.9%
if 4.2000000000000002e99 < z Initial program 55.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6459.4
Applied rewrites59.4%
(FPCore (x y z t a b c)
:precision binary64
(if (<= a -3.5e-137)
(* (* (/ a c) -4.0) t)
(if (<= a 3.7e-168)
(/ (/ b z) c)
(if (<= a 2.7e+142) (/ (* (* x (/ y c)) 9.0) z) (* (* (/ t c) -4.0) a)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (a <= -3.5e-137) {
tmp = ((a / c) * -4.0) * t;
} else if (a <= 3.7e-168) {
tmp = (b / z) / c;
} else if (a <= 2.7e+142) {
tmp = ((x * (y / c)) * 9.0) / z;
} else {
tmp = ((t / c) * -4.0) * a;
}
return tmp;
}
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 <= (-3.5d-137)) then
tmp = ((a / c) * (-4.0d0)) * t
else if (a <= 3.7d-168) then
tmp = (b / z) / c
else if (a <= 2.7d+142) then
tmp = ((x * (y / c)) * 9.0d0) / z
else
tmp = ((t / c) * (-4.0d0)) * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (a <= -3.5e-137) {
tmp = ((a / c) * -4.0) * t;
} else if (a <= 3.7e-168) {
tmp = (b / z) / c;
} else if (a <= 2.7e+142) {
tmp = ((x * (y / c)) * 9.0) / z;
} else {
tmp = ((t / c) * -4.0) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if a <= -3.5e-137: tmp = ((a / c) * -4.0) * t elif a <= 3.7e-168: tmp = (b / z) / c elif a <= 2.7e+142: tmp = ((x * (y / c)) * 9.0) / z else: tmp = ((t / c) * -4.0) * a return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (a <= -3.5e-137) tmp = Float64(Float64(Float64(a / c) * -4.0) * t); elseif (a <= 3.7e-168) tmp = Float64(Float64(b / z) / c); elseif (a <= 2.7e+142) tmp = Float64(Float64(Float64(x * Float64(y / c)) * 9.0) / z); else tmp = Float64(Float64(Float64(t / c) * -4.0) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (a <= -3.5e-137) tmp = ((a / c) * -4.0) * t; elseif (a <= 3.7e-168) tmp = (b / z) / c; elseif (a <= 2.7e+142) tmp = ((x * (y / c)) * 9.0) / z; else tmp = ((t / c) * -4.0) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[a, -3.5e-137], N[(N[(N[(a / c), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[a, 3.7e-168], N[(N[(b / z), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[a, 2.7e+142], N[(N[(N[(x * N[(y / c), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.5 \cdot 10^{-137}:\\
\;\;\;\;\left(\frac{a}{c} \cdot -4\right) \cdot t\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{-168}:\\
\;\;\;\;\frac{\frac{b}{z}}{c}\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{+142}:\\
\;\;\;\;\frac{\left(x \cdot \frac{y}{c}\right) \cdot 9}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\end{array}
\end{array}
if a < -3.5000000000000001e-137Initial program 79.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6448.9
Applied rewrites48.9%
if -3.5000000000000001e-137 < a < 3.69999999999999997e-168Initial program 78.9%
Taylor expanded in b around inf
Applied rewrites46.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6445.7
associate-+l-45.7
associate-*l*45.7
*-commutative45.7
*-commutative45.7
associate-+l-45.7
Applied rewrites45.7%
if 3.69999999999999997e-168 < a < 2.69999999999999983e142Initial program 80.3%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6480.4
Applied rewrites80.4%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6476.3
Applied rewrites76.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6435.3
Applied rewrites35.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6437.0
Applied rewrites37.0%
if 2.69999999999999983e142 < a Initial program 78.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites81.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6463.4
Applied rewrites63.4%
(FPCore (x y z t a b c)
:precision binary64
(if (<= a -3.5e-137)
(* (* (/ a c) -4.0) t)
(if (<= a 7.4e-269)
(/ (/ b z) c)
(if (<= a 18000000000000.0)
(/ (* (* y 9.0) x) (* z c))
(* (* (/ t c) -4.0) a)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (a <= -3.5e-137) {
tmp = ((a / c) * -4.0) * t;
} else if (a <= 7.4e-269) {
tmp = (b / z) / c;
} else if (a <= 18000000000000.0) {
tmp = ((y * 9.0) * x) / (z * c);
} else {
tmp = ((t / c) * -4.0) * a;
}
return tmp;
}
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 <= (-3.5d-137)) then
tmp = ((a / c) * (-4.0d0)) * t
else if (a <= 7.4d-269) then
tmp = (b / z) / c
else if (a <= 18000000000000.0d0) then
tmp = ((y * 9.0d0) * x) / (z * c)
else
tmp = ((t / c) * (-4.0d0)) * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (a <= -3.5e-137) {
tmp = ((a / c) * -4.0) * t;
} else if (a <= 7.4e-269) {
tmp = (b / z) / c;
} else if (a <= 18000000000000.0) {
tmp = ((y * 9.0) * x) / (z * c);
} else {
tmp = ((t / c) * -4.0) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if a <= -3.5e-137: tmp = ((a / c) * -4.0) * t elif a <= 7.4e-269: tmp = (b / z) / c elif a <= 18000000000000.0: tmp = ((y * 9.0) * x) / (z * c) else: tmp = ((t / c) * -4.0) * a return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (a <= -3.5e-137) tmp = Float64(Float64(Float64(a / c) * -4.0) * t); elseif (a <= 7.4e-269) tmp = Float64(Float64(b / z) / c); elseif (a <= 18000000000000.0) tmp = Float64(Float64(Float64(y * 9.0) * x) / Float64(z * c)); else tmp = Float64(Float64(Float64(t / c) * -4.0) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (a <= -3.5e-137) tmp = ((a / c) * -4.0) * t; elseif (a <= 7.4e-269) tmp = (b / z) / c; elseif (a <= 18000000000000.0) tmp = ((y * 9.0) * x) / (z * c); else tmp = ((t / c) * -4.0) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[a, -3.5e-137], N[(N[(N[(a / c), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[a, 7.4e-269], N[(N[(b / z), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[a, 18000000000000.0], N[(N[(N[(y * 9.0), $MachinePrecision] * x), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.5 \cdot 10^{-137}:\\
\;\;\;\;\left(\frac{a}{c} \cdot -4\right) \cdot t\\
\mathbf{elif}\;a \leq 7.4 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{b}{z}}{c}\\
\mathbf{elif}\;a \leq 18000000000000:\\
\;\;\;\;\frac{\left(y \cdot 9\right) \cdot x}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\end{array}
\end{array}
if a < -3.5000000000000001e-137Initial program 79.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6448.9
Applied rewrites48.9%
if -3.5000000000000001e-137 < a < 7.39999999999999955e-269Initial program 79.9%
Taylor expanded in b around inf
Applied rewrites47.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6446.4
associate-+l-46.4
associate-*l*46.4
*-commutative46.4
*-commutative46.4
associate-+l-46.4
Applied rewrites46.4%
if 7.39999999999999955e-269 < a < 1.8e13Initial program 79.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6440.0
Applied rewrites40.0%
if 1.8e13 < a Initial program 79.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites83.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6455.6
Applied rewrites55.6%
(FPCore (x y z t a b c) :precision binary64 (if (<= a -3.5e-137) (* (* (/ a c) -4.0) t) (if (<= a 16500000000000.0) (/ (/ b c) z) (* (* (/ t c) -4.0) a))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (a <= -3.5e-137) {
tmp = ((a / c) * -4.0) * t;
} else if (a <= 16500000000000.0) {
tmp = (b / c) / z;
} else {
tmp = ((t / c) * -4.0) * a;
}
return tmp;
}
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 <= (-3.5d-137)) then
tmp = ((a / c) * (-4.0d0)) * t
else if (a <= 16500000000000.0d0) then
tmp = (b / c) / z
else
tmp = ((t / c) * (-4.0d0)) * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (a <= -3.5e-137) {
tmp = ((a / c) * -4.0) * t;
} else if (a <= 16500000000000.0) {
tmp = (b / c) / z;
} else {
tmp = ((t / c) * -4.0) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if a <= -3.5e-137: tmp = ((a / c) * -4.0) * t elif a <= 16500000000000.0: tmp = (b / c) / z else: tmp = ((t / c) * -4.0) * a return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (a <= -3.5e-137) tmp = Float64(Float64(Float64(a / c) * -4.0) * t); elseif (a <= 16500000000000.0) tmp = Float64(Float64(b / c) / z); else tmp = Float64(Float64(Float64(t / c) * -4.0) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (a <= -3.5e-137) tmp = ((a / c) * -4.0) * t; elseif (a <= 16500000000000.0) tmp = (b / c) / z; else tmp = ((t / c) * -4.0) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[a, -3.5e-137], N[(N[(N[(a / c), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[a, 16500000000000.0], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(t / c), $MachinePrecision] * -4.0), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.5 \cdot 10^{-137}:\\
\;\;\;\;\left(\frac{a}{c} \cdot -4\right) \cdot t\\
\mathbf{elif}\;a \leq 16500000000000:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{t}{c} \cdot -4\right) \cdot a\\
\end{array}
\end{array}
if a < -3.5000000000000001e-137Initial program 79.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6448.9
Applied rewrites48.9%
if -3.5000000000000001e-137 < a < 1.65e13Initial program 79.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.8
Applied rewrites84.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6477.0
Applied rewrites77.0%
Taylor expanded in b around inf
lift-/.f6442.9
Applied rewrites42.9%
if 1.65e13 < a Initial program 79.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites83.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6455.5
Applied rewrites55.5%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* (* (/ a c) -4.0) t))) (if (<= a -3.5e-137) t_1 (if (<= a 16500000000000.0) (/ (/ b c) z) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((a / c) * -4.0) * t;
double tmp;
if (a <= -3.5e-137) {
tmp = t_1;
} else if (a <= 16500000000000.0) {
tmp = (b / c) / z;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = ((a / c) * (-4.0d0)) * t
if (a <= (-3.5d-137)) then
tmp = t_1
else if (a <= 16500000000000.0d0) then
tmp = (b / c) / z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((a / c) * -4.0) * t;
double tmp;
if (a <= -3.5e-137) {
tmp = t_1;
} else if (a <= 16500000000000.0) {
tmp = (b / c) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = ((a / c) * -4.0) * t tmp = 0 if a <= -3.5e-137: tmp = t_1 elif a <= 16500000000000.0: tmp = (b / c) / z else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(a / c) * -4.0) * t) tmp = 0.0 if (a <= -3.5e-137) tmp = t_1; elseif (a <= 16500000000000.0) tmp = Float64(Float64(b / c) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = ((a / c) * -4.0) * t; tmp = 0.0; if (a <= -3.5e-137) tmp = t_1; elseif (a <= 16500000000000.0) tmp = (b / c) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(a / c), $MachinePrecision] * -4.0), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[a, -3.5e-137], t$95$1, If[LessEqual[a, 16500000000000.0], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{a}{c} \cdot -4\right) \cdot t\\
\mathbf{if}\;a \leq -3.5 \cdot 10^{-137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 16500000000000:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.5000000000000001e-137 or 1.65e13 < a Initial program 79.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f6452.1
Applied rewrites52.1%
if -3.5000000000000001e-137 < a < 1.65e13Initial program 79.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.8
Applied rewrites84.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6477.0
Applied rewrites77.0%
Taylor expanded in b around inf
lift-/.f6442.9
Applied rewrites42.9%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* -4.0 (/ (* a t) c)))) (if (<= a -3.5e-137) t_1 (if (<= a 16500000000000.0) (/ (/ b c) z) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (a <= -3.5e-137) {
tmp = t_1;
} else if (a <= 16500000000000.0) {
tmp = (b / c) / z;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = (-4.0d0) * ((a * t) / c)
if (a <= (-3.5d-137)) then
tmp = t_1
else if (a <= 16500000000000.0d0) then
tmp = (b / c) / z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (a <= -3.5e-137) {
tmp = t_1;
} else if (a <= 16500000000000.0) {
tmp = (b / c) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = -4.0 * ((a * t) / c) tmp = 0 if a <= -3.5e-137: tmp = t_1 elif a <= 16500000000000.0: tmp = (b / c) / z else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(Float64(a * t) / c)) tmp = 0.0 if (a <= -3.5e-137) tmp = t_1; elseif (a <= 16500000000000.0) tmp = Float64(Float64(b / c) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = -4.0 * ((a * t) / c); tmp = 0.0; if (a <= -3.5e-137) tmp = t_1; elseif (a <= 16500000000000.0) tmp = (b / c) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.5e-137], t$95$1, If[LessEqual[a, 16500000000000.0], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -4 \cdot \frac{a \cdot t}{c}\\
\mathbf{if}\;a \leq -3.5 \cdot 10^{-137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 16500000000000:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.5000000000000001e-137 or 1.65e13 < a Initial program 79.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6448.0
Applied rewrites48.0%
if -3.5000000000000001e-137 < a < 1.65e13Initial program 79.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.8
Applied rewrites84.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6477.0
Applied rewrites77.0%
Taylor expanded in b around inf
lift-/.f6442.9
Applied rewrites42.9%
(FPCore (x y z t a b c) :precision binary64 (/ (/ b c) z))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (b / c) / z;
}
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
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (b / c) / z;
}
def code(x, y, z, t, a, b, c): return (b / c) / z
function code(x, y, z, t, a, b, c) return Float64(Float64(b / c) / z) end
function tmp = code(x, y, z, t, a, b, c) tmp = (b / c) / z; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{b}{c}}{z}
\end{array}
Initial program 79.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6480.0
Applied rewrites80.0%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6475.2
Applied rewrites75.2%
Taylor expanded in b around inf
lift-/.f6434.2
Applied rewrites34.2%
(FPCore (x y z t a b c) :precision binary64 (/ b (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return 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 = b / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (z * c);
}
def code(x, y, z, t, a, b, c): return b / (z * c)
function code(x, y, z, t, a, b, c) return Float64(b / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = b / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{z \cdot c}
\end{array}
Initial program 79.2%
Taylor expanded in b around inf
Applied rewrites34.9%
herbie shell --seed 2025119
(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)))