
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\end{array}
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i))))
(* j (- (* c a) (* y i))))))
(if (<= t_1 2e+305)
t_1
(*
(fma
c
b
(-
(fma
y
x
(/ (fma (fma (- i) y (* c a)) j (* (fma (- a) x (* i b)) t)) z))))
(- z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
double tmp;
if (t_1 <= 2e+305) {
tmp = t_1;
} else {
tmp = fma(c, b, -fma(y, x, (fma(fma(-i, y, (c * a)), j, (fma(-a, x, (i * b)) * t)) / z))) * -z;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) tmp = 0.0 if (t_1 <= 2e+305) tmp = t_1; else tmp = Float64(fma(c, b, Float64(-fma(y, x, Float64(fma(fma(Float64(-i), y, Float64(c * a)), j, Float64(fma(Float64(-a), x, Float64(i * b)) * t)) / z)))) * Float64(-z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+305], t$95$1, N[(N[(c * b + (-N[(y * x + N[(N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision] * (-z)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, b, -\mathsf{fma}\left(y, x, \frac{\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, \mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\right)}{z}\right)\right) \cdot \left(-z\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < 1.9999999999999999e305Initial program 93.8%
if 1.9999999999999999e305 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) Initial program 44.8%
Taylor expanded in z around -inf
Applied rewrites71.9%
Final simplification84.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i))))
(* j (- (* c a) (* y i))))))
(if (<= t_1 INFINITY) t_1 (* (fma (- i) j (* z x)) y))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(-i, j, (z * x)) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(fma(Float64(-i), j, Float64(z * x)) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < +inf.0Initial program 91.0%
if +inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) Initial program 0.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6453.2
Applied rewrites53.2%
Final simplification83.2%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= z -102000.0)
(fma (fma (- i) y (* c a)) j (* (fma (- b) c (* y x)) z))
(if (<= z 6.4e-33)
(+
(fma (fma (- z) b (* j a)) c (* (fma (- a) t (* z y)) x))
(* (fma (- y) j (* b t)) i))
(fma (- b) (fma (- i) t (* c z)) (* (fma (- i) j (* z x)) y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (z <= -102000.0) {
tmp = fma(fma(-i, y, (c * a)), j, (fma(-b, c, (y * x)) * z));
} else if (z <= 6.4e-33) {
tmp = fma(fma(-z, b, (j * a)), c, (fma(-a, t, (z * y)) * x)) + (fma(-y, j, (b * t)) * i);
} else {
tmp = fma(-b, fma(-i, t, (c * z)), (fma(-i, j, (z * x)) * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (z <= -102000.0) tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, Float64(fma(Float64(-b), c, Float64(y * x)) * z)); elseif (z <= 6.4e-33) tmp = Float64(fma(fma(Float64(-z), b, Float64(j * a)), c, Float64(fma(Float64(-a), t, Float64(z * y)) * x)) + Float64(fma(Float64(-y), j, Float64(b * t)) * i)); else tmp = fma(Float64(-b), fma(Float64(-i), t, Float64(c * z)), Float64(fma(Float64(-i), j, Float64(z * x)) * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[z, -102000.0], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.4e-33], N[(N[(N[((-z) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] + N[(N[((-y) * j + N[(b * t), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision], N[((-b) * N[((-i) * t + N[(c * z), $MachinePrecision]), $MachinePrecision] + N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -102000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-z, b, j \cdot a\right), c, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right) + \mathsf{fma}\left(-y, j, b \cdot t\right) \cdot i\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-b, \mathsf{fma}\left(-i, t, c \cdot z\right), \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\right)\\
\end{array}
\end{array}
if z < -102000Initial program 52.3%
Taylor expanded in t around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.4%
if -102000 < z < 6.39999999999999954e-33Initial program 84.5%
Taylor expanded in c around 0
Applied rewrites85.3%
if 6.39999999999999954e-33 < z Initial program 67.3%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites77.8%
Final simplification80.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- b) c (* y x)) z)))
(if (<= z -5.5e+108)
t_1
(if (<= z 2.55e-175)
(+ (* (* i t) b) (* j (- (* c a) (* y i))))
(if (<= z 1.6e+88) (* (* z t) (/ (fma (- x) a (* i b)) z)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-b, c, (y * x)) * z;
double tmp;
if (z <= -5.5e+108) {
tmp = t_1;
} else if (z <= 2.55e-175) {
tmp = ((i * t) * b) + (j * ((c * a) - (y * i)));
} else if (z <= 1.6e+88) {
tmp = (z * t) * (fma(-x, a, (i * b)) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -5.5e+108) tmp = t_1; elseif (z <= 2.55e-175) tmp = Float64(Float64(Float64(i * t) * b) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))); elseif (z <= 1.6e+88) tmp = Float64(Float64(z * t) * Float64(fma(Float64(-x), a, Float64(i * b)) / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -5.5e+108], t$95$1, If[LessEqual[z, 2.55e-175], N[(N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+88], N[(N[(z * t), $MachinePrecision] * N[(N[((-x) * a + N[(i * b), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{-175}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+88}:\\
\;\;\;\;\left(z \cdot t\right) \cdot \frac{\mathsf{fma}\left(-x, a, i \cdot b\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.4999999999999998e108 or 1.5999999999999999e88 < z Initial program 57.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6476.8
Applied rewrites76.8%
if -5.4999999999999998e108 < z < 2.55000000000000027e-175Initial program 83.3%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6463.1
Applied rewrites63.1%
if 2.55000000000000027e-175 < z < 1.5999999999999999e88Initial program 73.3%
Taylor expanded in z around -inf
Applied rewrites73.6%
Taylor expanded in t around inf
Applied rewrites56.5%
Final simplification66.3%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -2.1e+119) (not (<= a 1.5e+46))) (fma (fma (- x) t (* j c)) a (* (fma (- j) y (* t b)) i)) (fma (- b) (fma (- i) t (* c z)) (* (fma (- i) j (* z x)) y))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -2.1e+119) || !(a <= 1.5e+46)) {
tmp = fma(fma(-x, t, (j * c)), a, (fma(-j, y, (t * b)) * i));
} else {
tmp = fma(-b, fma(-i, t, (c * z)), (fma(-i, j, (z * x)) * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -2.1e+119) || !(a <= 1.5e+46)) tmp = fma(fma(Float64(-x), t, Float64(j * c)), a, Float64(fma(Float64(-j), y, Float64(t * b)) * i)); else tmp = fma(Float64(-b), fma(Float64(-i), t, Float64(c * z)), Float64(fma(Float64(-i), j, Float64(z * x)) * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -2.1e+119], N[Not[LessEqual[a, 1.5e+46]], $MachinePrecision]], N[(N[((-x) * t + N[(j * c), $MachinePrecision]), $MachinePrecision] * a + N[(N[((-j) * y + N[(t * b), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision], N[((-b) * N[((-i) * t + N[(c * z), $MachinePrecision]), $MachinePrecision] + N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.1 \cdot 10^{+119} \lor \neg \left(a \leq 1.5 \cdot 10^{+46}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-x, t, j \cdot c\right), a, \mathsf{fma}\left(-j, y, t \cdot b\right) \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-b, \mathsf{fma}\left(-i, t, c \cdot z\right), \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\right)\\
\end{array}
\end{array}
if a < -2.09999999999999983e119 or 1.50000000000000012e46 < a Initial program 62.6%
Taylor expanded in c around 0
Applied rewrites62.1%
Taylor expanded in z around 0
Applied rewrites79.5%
if -2.09999999999999983e119 < a < 1.50000000000000012e46Initial program 78.1%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites77.0%
Final simplification78.0%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -1.1e+133) (not (<= z 1.6e+88))) (* (fma (- b) c (* y x)) z) (fma (fma (- x) t (* j c)) a (* (fma (- j) y (* t b)) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -1.1e+133) || !(z <= 1.6e+88)) {
tmp = fma(-b, c, (y * x)) * z;
} else {
tmp = fma(fma(-x, t, (j * c)), a, (fma(-j, y, (t * b)) * i));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((z <= -1.1e+133) || !(z <= 1.6e+88)) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); else tmp = fma(fma(Float64(-x), t, Float64(j * c)), a, Float64(fma(Float64(-j), y, Float64(t * b)) * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -1.1e+133], N[Not[LessEqual[z, 1.6e+88]], $MachinePrecision]], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[((-x) * t + N[(j * c), $MachinePrecision]), $MachinePrecision] * a + N[(N[((-j) * y + N[(t * b), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+133} \lor \neg \left(z \leq 1.6 \cdot 10^{+88}\right):\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-x, t, j \cdot c\right), a, \mathsf{fma}\left(-j, y, t \cdot b\right) \cdot i\right)\\
\end{array}
\end{array}
if z < -1.1e133 or 1.5999999999999999e88 < z Initial program 54.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6478.1
Applied rewrites78.1%
if -1.1e133 < z < 1.5999999999999999e88Initial program 80.2%
Taylor expanded in c around 0
Applied rewrites77.0%
Taylor expanded in z around 0
Applied rewrites74.0%
Final simplification75.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- b) c (* y x)) z)))
(if (<= z -1.1e+133)
t_1
(if (<= z 1.56e+88)
(fma (fma (- x) t (* j c)) a (* (fma (- j) y (* t b)) i))
(fma (fma (- i) y (* c a)) j t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-b, c, (y * x)) * z;
double tmp;
if (z <= -1.1e+133) {
tmp = t_1;
} else if (z <= 1.56e+88) {
tmp = fma(fma(-x, t, (j * c)), a, (fma(-j, y, (t * b)) * i));
} else {
tmp = fma(fma(-i, y, (c * a)), j, t_1);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -1.1e+133) tmp = t_1; elseif (z <= 1.56e+88) tmp = fma(fma(Float64(-x), t, Float64(j * c)), a, Float64(fma(Float64(-j), y, Float64(t * b)) * i)); else tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.1e+133], t$95$1, If[LessEqual[z, 1.56e+88], N[(N[((-x) * t + N[(j * c), $MachinePrecision]), $MachinePrecision] * a + N[(N[((-j) * y + N[(t * b), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+133}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.56 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-x, t, j \cdot c\right), a, \mathsf{fma}\left(-j, y, t \cdot b\right) \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, t\_1\right)\\
\end{array}
\end{array}
if z < -1.1e133Initial program 30.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6479.6
Applied rewrites79.6%
if -1.1e133 < z < 1.56000000000000008e88Initial program 80.2%
Taylor expanded in c around 0
Applied rewrites77.0%
Taylor expanded in z around 0
Applied rewrites74.0%
if 1.56000000000000008e88 < z Initial program 68.8%
Taylor expanded in t around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.4%
Final simplification76.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* x y) z)) (t_2 (* (* (- b) c) z)))
(if (<= x -2.95e+141)
(* (* (- x) a) t)
(if (<= x -1.4e+27)
t_1
(if (<= x -3.7e-124)
t_2
(if (<= x 1.55e-254)
(* (* i y) (- j))
(if (<= x 4.5e-120) t_2 (if (<= x 9.6e+76) (* (* t i) b) t_1))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (x * y) * z;
double t_2 = (-b * c) * z;
double tmp;
if (x <= -2.95e+141) {
tmp = (-x * a) * t;
} else if (x <= -1.4e+27) {
tmp = t_1;
} else if (x <= -3.7e-124) {
tmp = t_2;
} else if (x <= 1.55e-254) {
tmp = (i * y) * -j;
} else if (x <= 4.5e-120) {
tmp = t_2;
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} 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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * y) * z
t_2 = (-b * c) * z
if (x <= (-2.95d+141)) then
tmp = (-x * a) * t
else if (x <= (-1.4d+27)) then
tmp = t_1
else if (x <= (-3.7d-124)) then
tmp = t_2
else if (x <= 1.55d-254) then
tmp = (i * y) * -j
else if (x <= 4.5d-120) then
tmp = t_2
else if (x <= 9.6d+76) then
tmp = (t * i) * b
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 i, double j) {
double t_1 = (x * y) * z;
double t_2 = (-b * c) * z;
double tmp;
if (x <= -2.95e+141) {
tmp = (-x * a) * t;
} else if (x <= -1.4e+27) {
tmp = t_1;
} else if (x <= -3.7e-124) {
tmp = t_2;
} else if (x <= 1.55e-254) {
tmp = (i * y) * -j;
} else if (x <= 4.5e-120) {
tmp = t_2;
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (x * y) * z t_2 = (-b * c) * z tmp = 0 if x <= -2.95e+141: tmp = (-x * a) * t elif x <= -1.4e+27: tmp = t_1 elif x <= -3.7e-124: tmp = t_2 elif x <= 1.55e-254: tmp = (i * y) * -j elif x <= 4.5e-120: tmp = t_2 elif x <= 9.6e+76: tmp = (t * i) * b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(x * y) * z) t_2 = Float64(Float64(Float64(-b) * c) * z) tmp = 0.0 if (x <= -2.95e+141) tmp = Float64(Float64(Float64(-x) * a) * t); elseif (x <= -1.4e+27) tmp = t_1; elseif (x <= -3.7e-124) tmp = t_2; elseif (x <= 1.55e-254) tmp = Float64(Float64(i * y) * Float64(-j)); elseif (x <= 4.5e-120) tmp = t_2; elseif (x <= 9.6e+76) tmp = Float64(Float64(t * i) * b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (x * y) * z; t_2 = (-b * c) * z; tmp = 0.0; if (x <= -2.95e+141) tmp = (-x * a) * t; elseif (x <= -1.4e+27) tmp = t_1; elseif (x <= -3.7e-124) tmp = t_2; elseif (x <= 1.55e-254) tmp = (i * y) * -j; elseif (x <= 4.5e-120) tmp = t_2; elseif (x <= 9.6e+76) tmp = (t * i) * b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-b) * c), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -2.95e+141], N[(N[((-x) * a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[x, -1.4e+27], t$95$1, If[LessEqual[x, -3.7e-124], t$95$2, If[LessEqual[x, 1.55e-254], N[(N[(i * y), $MachinePrecision] * (-j)), $MachinePrecision], If[LessEqual[x, 4.5e-120], t$95$2, If[LessEqual[x, 9.6e+76], N[(N[(t * i), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y\right) \cdot z\\
t_2 := \left(\left(-b\right) \cdot c\right) \cdot z\\
\mathbf{if}\;x \leq -2.95 \cdot 10^{+141}:\\
\;\;\;\;\left(\left(-x\right) \cdot a\right) \cdot t\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-124}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-254}:\\
\;\;\;\;\left(i \cdot y\right) \cdot \left(-j\right)\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-120}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+76}:\\
\;\;\;\;\left(t \cdot i\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.95000000000000014e141Initial program 66.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6460.3
Applied rewrites60.3%
Taylor expanded in x around inf
Applied rewrites64.0%
if -2.95000000000000014e141 < x < -1.4e27 or 9.5999999999999999e76 < x Initial program 70.7%
Taylor expanded in z around -inf
Applied rewrites68.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6458.9
Applied rewrites58.9%
Taylor expanded in x around inf
Applied rewrites54.4%
if -1.4e27 < x < -3.6999999999999999e-124 or 1.54999999999999994e-254 < x < 4.5e-120Initial program 77.0%
Taylor expanded in z around -inf
Applied rewrites78.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6449.5
Applied rewrites49.5%
Taylor expanded in x around 0
Applied rewrites42.8%
if -3.6999999999999999e-124 < x < 1.54999999999999994e-254Initial program 69.7%
Taylor expanded in c around 0
Applied rewrites65.9%
Taylor expanded in j around -inf
Applied rewrites54.2%
Taylor expanded in y around inf
Applied rewrites39.3%
if 4.5e-120 < x < 9.5999999999999999e76Initial program 73.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
Taylor expanded in x around 0
Applied rewrites52.1%
Final simplification48.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- b) c (* y x)) z)))
(if (<= z -5.5e+108)
t_1
(if (<= z 2.55e-175)
(+ (* (* i t) b) (* j (- (* c a) (* y i))))
(if (<= z 1.56e+88) (* (fma (- a) x (* i b)) t) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-b, c, (y * x)) * z;
double tmp;
if (z <= -5.5e+108) {
tmp = t_1;
} else if (z <= 2.55e-175) {
tmp = ((i * t) * b) + (j * ((c * a) - (y * i)));
} else if (z <= 1.56e+88) {
tmp = fma(-a, x, (i * b)) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -5.5e+108) tmp = t_1; elseif (z <= 2.55e-175) tmp = Float64(Float64(Float64(i * t) * b) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))); elseif (z <= 1.56e+88) tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -5.5e+108], t$95$1, If[LessEqual[z, 2.55e-175], N[(N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.56e+88], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{-175}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{elif}\;z \leq 1.56 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.4999999999999998e108 or 1.56000000000000008e88 < z Initial program 57.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6476.8
Applied rewrites76.8%
if -5.4999999999999998e108 < z < 2.55000000000000027e-175Initial program 83.3%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6463.1
Applied rewrites63.1%
if 2.55000000000000027e-175 < z < 1.56000000000000008e88Initial program 73.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6455.0
Applied rewrites55.0%
Final simplification66.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) x (* i b)) t)) (t_2 (* (fma (- b) c (* y x)) z)))
(if (<= z -2.25e+44)
t_2
(if (<= z -4.2e-240)
t_1
(if (<= z 5.8e-176)
(* (fma (- i) y (* c a)) j)
(if (<= z 1.56e+88) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-a, x, (i * b)) * t;
double t_2 = fma(-b, c, (y * x)) * z;
double tmp;
if (z <= -2.25e+44) {
tmp = t_2;
} else if (z <= -4.2e-240) {
tmp = t_1;
} else if (z <= 5.8e-176) {
tmp = fma(-i, y, (c * a)) * j;
} else if (z <= 1.56e+88) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-a), x, Float64(i * b)) * t) t_2 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -2.25e+44) tmp = t_2; elseif (z <= -4.2e-240) tmp = t_1; elseif (z <= 5.8e-176) tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); elseif (z <= 1.56e+88) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -2.25e+44], t$95$2, If[LessEqual[z, -4.2e-240], t$95$1, If[LessEqual[z, 5.8e-176], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[z, 1.56e+88], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
t_2 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -2.25 \cdot 10^{+44}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-240}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-176}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{elif}\;z \leq 1.56 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -2.25e44 or 1.56000000000000008e88 < z Initial program 59.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6474.1
Applied rewrites74.1%
if -2.25e44 < z < -4.19999999999999987e-240 or 5.80000000000000012e-176 < z < 1.56000000000000008e88Initial program 75.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6452.3
Applied rewrites52.3%
if -4.19999999999999987e-240 < z < 5.80000000000000012e-176Initial program 94.9%
Taylor expanded in c around 0
Applied rewrites85.7%
Taylor expanded in c around inf
Applied rewrites79.0%
Taylor expanded in j around inf
Applied rewrites58.9%
Final simplification61.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* x y) z)))
(if (<= x -2.95e+141)
(* (* (- x) a) t)
(if (<= x -1.4e+27)
t_1
(if (<= x -3.7e-124)
(* (- b) (* c z))
(if (<= x 2.05e-115)
(* (* i y) (- j))
(if (<= x 9.6e+76) (* (* t i) b) t_1)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (x * y) * z;
double tmp;
if (x <= -2.95e+141) {
tmp = (-x * a) * t;
} else if (x <= -1.4e+27) {
tmp = t_1;
} else if (x <= -3.7e-124) {
tmp = -b * (c * z);
} else if (x <= 2.05e-115) {
tmp = (i * y) * -j;
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} 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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) * z
if (x <= (-2.95d+141)) then
tmp = (-x * a) * t
else if (x <= (-1.4d+27)) then
tmp = t_1
else if (x <= (-3.7d-124)) then
tmp = -b * (c * z)
else if (x <= 2.05d-115) then
tmp = (i * y) * -j
else if (x <= 9.6d+76) then
tmp = (t * i) * b
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 i, double j) {
double t_1 = (x * y) * z;
double tmp;
if (x <= -2.95e+141) {
tmp = (-x * a) * t;
} else if (x <= -1.4e+27) {
tmp = t_1;
} else if (x <= -3.7e-124) {
tmp = -b * (c * z);
} else if (x <= 2.05e-115) {
tmp = (i * y) * -j;
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (x * y) * z tmp = 0 if x <= -2.95e+141: tmp = (-x * a) * t elif x <= -1.4e+27: tmp = t_1 elif x <= -3.7e-124: tmp = -b * (c * z) elif x <= 2.05e-115: tmp = (i * y) * -j elif x <= 9.6e+76: tmp = (t * i) * b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(x * y) * z) tmp = 0.0 if (x <= -2.95e+141) tmp = Float64(Float64(Float64(-x) * a) * t); elseif (x <= -1.4e+27) tmp = t_1; elseif (x <= -3.7e-124) tmp = Float64(Float64(-b) * Float64(c * z)); elseif (x <= 2.05e-115) tmp = Float64(Float64(i * y) * Float64(-j)); elseif (x <= 9.6e+76) tmp = Float64(Float64(t * i) * b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (x * y) * z; tmp = 0.0; if (x <= -2.95e+141) tmp = (-x * a) * t; elseif (x <= -1.4e+27) tmp = t_1; elseif (x <= -3.7e-124) tmp = -b * (c * z); elseif (x <= 2.05e-115) tmp = (i * y) * -j; elseif (x <= 9.6e+76) tmp = (t * i) * b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -2.95e+141], N[(N[((-x) * a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[x, -1.4e+27], t$95$1, If[LessEqual[x, -3.7e-124], N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.05e-115], N[(N[(i * y), $MachinePrecision] * (-j)), $MachinePrecision], If[LessEqual[x, 9.6e+76], N[(N[(t * i), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y\right) \cdot z\\
\mathbf{if}\;x \leq -2.95 \cdot 10^{+141}:\\
\;\;\;\;\left(\left(-x\right) \cdot a\right) \cdot t\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-124}:\\
\;\;\;\;\left(-b\right) \cdot \left(c \cdot z\right)\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-115}:\\
\;\;\;\;\left(i \cdot y\right) \cdot \left(-j\right)\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+76}:\\
\;\;\;\;\left(t \cdot i\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.95000000000000014e141Initial program 66.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6460.3
Applied rewrites60.3%
Taylor expanded in x around inf
Applied rewrites64.0%
if -2.95000000000000014e141 < x < -1.4e27 or 9.5999999999999999e76 < x Initial program 70.7%
Taylor expanded in z around -inf
Applied rewrites68.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6458.9
Applied rewrites58.9%
Taylor expanded in x around inf
Applied rewrites54.4%
if -1.4e27 < x < -3.6999999999999999e-124Initial program 86.7%
Taylor expanded in z around -inf
Applied rewrites89.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6457.7
Applied rewrites57.7%
Taylor expanded in x around 0
Applied rewrites42.2%
if -3.6999999999999999e-124 < x < 2.0499999999999998e-115Initial program 68.1%
Taylor expanded in c around 0
Applied rewrites65.6%
Taylor expanded in j around -inf
Applied rewrites52.5%
Taylor expanded in y around inf
Applied rewrites33.8%
if 2.0499999999999998e-115 < x < 9.5999999999999999e76Initial program 73.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
Taylor expanded in x around 0
Applied rewrites52.1%
Final simplification46.6%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) j (* z x)) y)))
(if (<= y -28000.0)
t_1
(if (<= y -1.8e-92)
(+ (* (* (- z) b) c) (* (* j c) a))
(if (<= y 1.5e+77) (* (fma (- a) x (* i b)) t) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-i, j, (z * x)) * y;
double tmp;
if (y <= -28000.0) {
tmp = t_1;
} else if (y <= -1.8e-92) {
tmp = ((-z * b) * c) + ((j * c) * a);
} else if (y <= 1.5e+77) {
tmp = fma(-a, x, (i * b)) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-i), j, Float64(z * x)) * y) tmp = 0.0 if (y <= -28000.0) tmp = t_1; elseif (y <= -1.8e-92) tmp = Float64(Float64(Float64(Float64(-z) * b) * c) + Float64(Float64(j * c) * a)); elseif (y <= 1.5e+77) tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -28000.0], t$95$1, If[LessEqual[y, -1.8e-92], N[(N[(N[((-z) * b), $MachinePrecision] * c), $MachinePrecision] + N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.5e+77], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{if}\;y \leq -28000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-92}:\\
\;\;\;\;\left(\left(-z\right) \cdot b\right) \cdot c + \left(j \cdot c\right) \cdot a\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -28000 or 1.4999999999999999e77 < y Initial program 59.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6469.3
Applied rewrites69.3%
if -28000 < y < -1.80000000000000008e-92Initial program 91.5%
Taylor expanded in c around inf
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6466.5
Applied rewrites66.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6454.5
Applied rewrites54.5%
if -1.80000000000000008e-92 < y < 1.4999999999999999e77Initial program 80.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6457.1
Applied rewrites57.1%
Final simplification62.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) j (* z x)) y)))
(if (<= y -2.1e+56)
t_1
(if (<= y -1.8e-92)
(* (fma (- z) b (* j a)) c)
(if (<= y 1.5e+77) (* (fma (- a) x (* i b)) t) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-i, j, (z * x)) * y;
double tmp;
if (y <= -2.1e+56) {
tmp = t_1;
} else if (y <= -1.8e-92) {
tmp = fma(-z, b, (j * a)) * c;
} else if (y <= 1.5e+77) {
tmp = fma(-a, x, (i * b)) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-i), j, Float64(z * x)) * y) tmp = 0.0 if (y <= -2.1e+56) tmp = t_1; elseif (y <= -1.8e-92) tmp = Float64(fma(Float64(-z), b, Float64(j * a)) * c); elseif (y <= 1.5e+77) tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -2.1e+56], t$95$1, If[LessEqual[y, -1.8e-92], N[(N[((-z) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[y, 1.5e+77], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{if}\;y \leq -2.1 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-92}:\\
\;\;\;\;\mathsf{fma}\left(-z, b, j \cdot a\right) \cdot c\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.10000000000000017e56 or 1.4999999999999999e77 < y Initial program 59.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6471.9
Applied rewrites71.9%
if -2.10000000000000017e56 < y < -1.80000000000000008e-92Initial program 82.9%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6449.0
Applied rewrites49.0%
if -1.80000000000000008e-92 < y < 1.4999999999999999e77Initial program 80.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6457.1
Applied rewrites57.1%
Final simplification61.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) j (* z x)) y)))
(if (<= y -6e+58)
t_1
(if (<= y -1.55e-35)
(* (fma (- b) c (* y x)) z)
(if (<= y 1.5e+77) (* (fma (- a) x (* i b)) t) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-i, j, (z * x)) * y;
double tmp;
if (y <= -6e+58) {
tmp = t_1;
} else if (y <= -1.55e-35) {
tmp = fma(-b, c, (y * x)) * z;
} else if (y <= 1.5e+77) {
tmp = fma(-a, x, (i * b)) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-i), j, Float64(z * x)) * y) tmp = 0.0 if (y <= -6e+58) tmp = t_1; elseif (y <= -1.55e-35) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); elseif (y <= 1.5e+77) tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -6e+58], t$95$1, If[LessEqual[y, -1.55e-35], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[y, 1.5e+77], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{if}\;y \leq -6 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.55 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.0000000000000005e58 or 1.4999999999999999e77 < y Initial program 59.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6471.6
Applied rewrites71.6%
if -6.0000000000000005e58 < y < -1.55000000000000006e-35Initial program 69.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
if -1.55000000000000006e-35 < y < 1.4999999999999999e77Initial program 81.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6455.1
Applied rewrites55.1%
Final simplification61.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* x y) z)))
(if (<= x -2.95e+141)
(* (* (- x) a) t)
(if (<= x -6.5e+29)
t_1
(if (<= x 1.1e-119)
(* (fma (- i) y (* c a)) j)
(if (<= x 9.6e+76) (* (* t i) b) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (x * y) * z;
double tmp;
if (x <= -2.95e+141) {
tmp = (-x * a) * t;
} else if (x <= -6.5e+29) {
tmp = t_1;
} else if (x <= 1.1e-119) {
tmp = fma(-i, y, (c * a)) * j;
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(x * y) * z) tmp = 0.0 if (x <= -2.95e+141) tmp = Float64(Float64(Float64(-x) * a) * t); elseif (x <= -6.5e+29) tmp = t_1; elseif (x <= 1.1e-119) tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); elseif (x <= 9.6e+76) tmp = Float64(Float64(t * i) * b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -2.95e+141], N[(N[((-x) * a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[x, -6.5e+29], t$95$1, If[LessEqual[x, 1.1e-119], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[x, 9.6e+76], N[(N[(t * i), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y\right) \cdot z\\
\mathbf{if}\;x \leq -2.95 \cdot 10^{+141}:\\
\;\;\;\;\left(\left(-x\right) \cdot a\right) \cdot t\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-119}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+76}:\\
\;\;\;\;\left(t \cdot i\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.95000000000000014e141Initial program 66.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6460.3
Applied rewrites60.3%
Taylor expanded in x around inf
Applied rewrites64.0%
if -2.95000000000000014e141 < x < -6.49999999999999971e29 or 9.5999999999999999e76 < x Initial program 71.8%
Taylor expanded in z around -inf
Applied rewrites67.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6458.3
Applied rewrites58.3%
Taylor expanded in x around inf
Applied rewrites53.7%
if -6.49999999999999971e29 < x < 1.1e-119Initial program 73.2%
Taylor expanded in c around 0
Applied rewrites70.0%
Taylor expanded in c around inf
Applied rewrites66.9%
Taylor expanded in j around inf
Applied rewrites48.8%
if 1.1e-119 < x < 9.5999999999999999e76Initial program 73.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
Taylor expanded in x around 0
Applied rewrites52.1%
Final simplification52.2%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -0.00072)
(* (* (- x) t) a)
(if (<= x -3.7e-124)
(* (- b) (* c z))
(if (<= x 2.05e-115)
(* (* i y) (- j))
(if (<= x 9.6e+76) (* (* t i) b) (* (* x y) z))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -0.00072) {
tmp = (-x * t) * a;
} else if (x <= -3.7e-124) {
tmp = -b * (c * z);
} else if (x <= 2.05e-115) {
tmp = (i * y) * -j;
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} else {
tmp = (x * y) * z;
}
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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if (x <= (-0.00072d0)) then
tmp = (-x * t) * a
else if (x <= (-3.7d-124)) then
tmp = -b * (c * z)
else if (x <= 2.05d-115) then
tmp = (i * y) * -j
else if (x <= 9.6d+76) then
tmp = (t * i) * b
else
tmp = (x * y) * z
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 i, double j) {
double tmp;
if (x <= -0.00072) {
tmp = (-x * t) * a;
} else if (x <= -3.7e-124) {
tmp = -b * (c * z);
} else if (x <= 2.05e-115) {
tmp = (i * y) * -j;
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} else {
tmp = (x * y) * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if x <= -0.00072: tmp = (-x * t) * a elif x <= -3.7e-124: tmp = -b * (c * z) elif x <= 2.05e-115: tmp = (i * y) * -j elif x <= 9.6e+76: tmp = (t * i) * b else: tmp = (x * y) * z return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -0.00072) tmp = Float64(Float64(Float64(-x) * t) * a); elseif (x <= -3.7e-124) tmp = Float64(Float64(-b) * Float64(c * z)); elseif (x <= 2.05e-115) tmp = Float64(Float64(i * y) * Float64(-j)); elseif (x <= 9.6e+76) tmp = Float64(Float64(t * i) * b); else tmp = Float64(Float64(x * y) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (x <= -0.00072) tmp = (-x * t) * a; elseif (x <= -3.7e-124) tmp = -b * (c * z); elseif (x <= 2.05e-115) tmp = (i * y) * -j; elseif (x <= 9.6e+76) tmp = (t * i) * b; else tmp = (x * y) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -0.00072], N[(N[((-x) * t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[x, -3.7e-124], N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.05e-115], N[(N[(i * y), $MachinePrecision] * (-j)), $MachinePrecision], If[LessEqual[x, 9.6e+76], N[(N[(t * i), $MachinePrecision] * b), $MachinePrecision], N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00072:\\
\;\;\;\;\left(\left(-x\right) \cdot t\right) \cdot a\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-124}:\\
\;\;\;\;\left(-b\right) \cdot \left(c \cdot z\right)\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-115}:\\
\;\;\;\;\left(i \cdot y\right) \cdot \left(-j\right)\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+76}:\\
\;\;\;\;\left(t \cdot i\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot z\\
\end{array}
\end{array}
if x < -7.20000000000000045e-4Initial program 71.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6447.7
Applied rewrites47.7%
Taylor expanded in x around inf
Applied rewrites42.5%
if -7.20000000000000045e-4 < x < -3.6999999999999999e-124Initial program 86.5%
Taylor expanded in z around -inf
Applied rewrites93.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6466.4
Applied rewrites66.4%
Taylor expanded in x around 0
Applied rewrites49.7%
if -3.6999999999999999e-124 < x < 2.0499999999999998e-115Initial program 68.1%
Taylor expanded in c around 0
Applied rewrites65.6%
Taylor expanded in j around -inf
Applied rewrites52.5%
Taylor expanded in y around inf
Applied rewrites33.8%
if 2.0499999999999998e-115 < x < 9.5999999999999999e76Initial program 73.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
Taylor expanded in x around 0
Applied rewrites52.1%
if 9.5999999999999999e76 < x Initial program 70.7%
Taylor expanded in z around -inf
Applied rewrites70.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6458.4
Applied rewrites58.4%
Taylor expanded in x around inf
Applied rewrites53.9%
Final simplification44.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* x y) z)))
(if (<= x -2.55e+141)
(* (* (- x) t) a)
(if (<= x -1.12e-54)
t_1
(if (<= x -1.55e-224)
(* (* c j) a)
(if (<= x 9.6e+76) (* (* t i) b) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (x * y) * z;
double tmp;
if (x <= -2.55e+141) {
tmp = (-x * t) * a;
} else if (x <= -1.12e-54) {
tmp = t_1;
} else if (x <= -1.55e-224) {
tmp = (c * j) * a;
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} 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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) * z
if (x <= (-2.55d+141)) then
tmp = (-x * t) * a
else if (x <= (-1.12d-54)) then
tmp = t_1
else if (x <= (-1.55d-224)) then
tmp = (c * j) * a
else if (x <= 9.6d+76) then
tmp = (t * i) * b
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 i, double j) {
double t_1 = (x * y) * z;
double tmp;
if (x <= -2.55e+141) {
tmp = (-x * t) * a;
} else if (x <= -1.12e-54) {
tmp = t_1;
} else if (x <= -1.55e-224) {
tmp = (c * j) * a;
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (x * y) * z tmp = 0 if x <= -2.55e+141: tmp = (-x * t) * a elif x <= -1.12e-54: tmp = t_1 elif x <= -1.55e-224: tmp = (c * j) * a elif x <= 9.6e+76: tmp = (t * i) * b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(x * y) * z) tmp = 0.0 if (x <= -2.55e+141) tmp = Float64(Float64(Float64(-x) * t) * a); elseif (x <= -1.12e-54) tmp = t_1; elseif (x <= -1.55e-224) tmp = Float64(Float64(c * j) * a); elseif (x <= 9.6e+76) tmp = Float64(Float64(t * i) * b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (x * y) * z; tmp = 0.0; if (x <= -2.55e+141) tmp = (-x * t) * a; elseif (x <= -1.12e-54) tmp = t_1; elseif (x <= -1.55e-224) tmp = (c * j) * a; elseif (x <= 9.6e+76) tmp = (t * i) * b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -2.55e+141], N[(N[((-x) * t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[x, -1.12e-54], t$95$1, If[LessEqual[x, -1.55e-224], N[(N[(c * j), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[x, 9.6e+76], N[(N[(t * i), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y\right) \cdot z\\
\mathbf{if}\;x \leq -2.55 \cdot 10^{+141}:\\
\;\;\;\;\left(\left(-x\right) \cdot t\right) \cdot a\\
\mathbf{elif}\;x \leq -1.12 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-224}:\\
\;\;\;\;\left(c \cdot j\right) \cdot a\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+76}:\\
\;\;\;\;\left(t \cdot i\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.5499999999999999e141Initial program 66.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6460.3
Applied rewrites60.3%
Taylor expanded in x around inf
Applied rewrites53.4%
if -2.5499999999999999e141 < x < -1.11999999999999994e-54 or 9.5999999999999999e76 < x Initial program 76.3%
Taylor expanded in z around -inf
Applied rewrites72.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6458.1
Applied rewrites58.1%
Taylor expanded in x around inf
Applied rewrites45.2%
if -1.11999999999999994e-54 < x < -1.55000000000000004e-224Initial program 78.5%
Taylor expanded in c around 0
Applied rewrites67.9%
Taylor expanded in j around -inf
Applied rewrites59.8%
Taylor expanded in y around 0
Applied rewrites30.9%
if -1.55000000000000004e-224 < x < 9.5999999999999999e76Initial program 67.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6439.4
Applied rewrites39.4%
Taylor expanded in x around 0
Applied rewrites34.9%
Final simplification40.0%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= t -1.9e-70) (not (<= t 3.6e-102))) (* (fma (- a) x (* i b)) t) (* (fma (- i) y (* c a)) j)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((t <= -1.9e-70) || !(t <= 3.6e-102)) {
tmp = fma(-a, x, (i * b)) * t;
} else {
tmp = fma(-i, y, (c * a)) * j;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((t <= -1.9e-70) || !(t <= 3.6e-102)) tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); else tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[t, -1.9e-70], N[Not[LessEqual[t, 3.6e-102]], $MachinePrecision]], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{-70} \lor \neg \left(t \leq 3.6 \cdot 10^{-102}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\end{array}
\end{array}
if t < -1.8999999999999999e-70 or 3.6e-102 < t Initial program 67.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6457.7
Applied rewrites57.7%
if -1.8999999999999999e-70 < t < 3.6e-102Initial program 80.3%
Taylor expanded in c around 0
Applied rewrites75.6%
Taylor expanded in c around inf
Applied rewrites78.8%
Taylor expanded in j around inf
Applied rewrites48.6%
Final simplification54.3%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -0.00072)
(* (* (- x) t) a)
(if (<= x 4.7e-120)
(* (- b) (* c z))
(if (<= x 9.6e+76) (* (* t i) b) (* (* x y) z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -0.00072) {
tmp = (-x * t) * a;
} else if (x <= 4.7e-120) {
tmp = -b * (c * z);
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} else {
tmp = (x * y) * z;
}
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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if (x <= (-0.00072d0)) then
tmp = (-x * t) * a
else if (x <= 4.7d-120) then
tmp = -b * (c * z)
else if (x <= 9.6d+76) then
tmp = (t * i) * b
else
tmp = (x * y) * z
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 i, double j) {
double tmp;
if (x <= -0.00072) {
tmp = (-x * t) * a;
} else if (x <= 4.7e-120) {
tmp = -b * (c * z);
} else if (x <= 9.6e+76) {
tmp = (t * i) * b;
} else {
tmp = (x * y) * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if x <= -0.00072: tmp = (-x * t) * a elif x <= 4.7e-120: tmp = -b * (c * z) elif x <= 9.6e+76: tmp = (t * i) * b else: tmp = (x * y) * z return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -0.00072) tmp = Float64(Float64(Float64(-x) * t) * a); elseif (x <= 4.7e-120) tmp = Float64(Float64(-b) * Float64(c * z)); elseif (x <= 9.6e+76) tmp = Float64(Float64(t * i) * b); else tmp = Float64(Float64(x * y) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (x <= -0.00072) tmp = (-x * t) * a; elseif (x <= 4.7e-120) tmp = -b * (c * z); elseif (x <= 9.6e+76) tmp = (t * i) * b; else tmp = (x * y) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -0.00072], N[(N[((-x) * t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[x, 4.7e-120], N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.6e+76], N[(N[(t * i), $MachinePrecision] * b), $MachinePrecision], N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00072:\\
\;\;\;\;\left(\left(-x\right) \cdot t\right) \cdot a\\
\mathbf{elif}\;x \leq 4.7 \cdot 10^{-120}:\\
\;\;\;\;\left(-b\right) \cdot \left(c \cdot z\right)\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+76}:\\
\;\;\;\;\left(t \cdot i\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot z\\
\end{array}
\end{array}
if x < -7.20000000000000045e-4Initial program 71.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6447.7
Applied rewrites47.7%
Taylor expanded in x around inf
Applied rewrites42.5%
if -7.20000000000000045e-4 < x < 4.70000000000000016e-120Initial program 72.9%
Taylor expanded in z around -inf
Applied rewrites75.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6438.9
Applied rewrites38.9%
Taylor expanded in x around 0
Applied rewrites30.4%
if 4.70000000000000016e-120 < x < 9.5999999999999999e76Initial program 73.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
Taylor expanded in x around 0
Applied rewrites52.1%
if 9.5999999999999999e76 < x Initial program 70.7%
Taylor expanded in z around -inf
Applied rewrites70.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6458.4
Applied rewrites58.4%
Taylor expanded in x around inf
Applied rewrites53.9%
Final simplification40.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* t i) b)))
(if (<= i -2.6e+59)
t_1
(if (<= i -9.8e-277)
(* (* c j) a)
(if (<= i 1.95e-57) (* (* z x) y) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (t * i) * b;
double tmp;
if (i <= -2.6e+59) {
tmp = t_1;
} else if (i <= -9.8e-277) {
tmp = (c * j) * a;
} else if (i <= 1.95e-57) {
tmp = (z * x) * y;
} 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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = (t * i) * b
if (i <= (-2.6d+59)) then
tmp = t_1
else if (i <= (-9.8d-277)) then
tmp = (c * j) * a
else if (i <= 1.95d-57) then
tmp = (z * x) * y
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 i, double j) {
double t_1 = (t * i) * b;
double tmp;
if (i <= -2.6e+59) {
tmp = t_1;
} else if (i <= -9.8e-277) {
tmp = (c * j) * a;
} else if (i <= 1.95e-57) {
tmp = (z * x) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (t * i) * b tmp = 0 if i <= -2.6e+59: tmp = t_1 elif i <= -9.8e-277: tmp = (c * j) * a elif i <= 1.95e-57: tmp = (z * x) * y else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(t * i) * b) tmp = 0.0 if (i <= -2.6e+59) tmp = t_1; elseif (i <= -9.8e-277) tmp = Float64(Float64(c * j) * a); elseif (i <= 1.95e-57) tmp = Float64(Float64(z * x) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (t * i) * b; tmp = 0.0; if (i <= -2.6e+59) tmp = t_1; elseif (i <= -9.8e-277) tmp = (c * j) * a; elseif (i <= 1.95e-57) tmp = (z * x) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(t * i), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[i, -2.6e+59], t$95$1, If[LessEqual[i, -9.8e-277], N[(N[(c * j), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[i, 1.95e-57], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t \cdot i\right) \cdot b\\
\mathbf{if}\;i \leq -2.6 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq -9.8 \cdot 10^{-277}:\\
\;\;\;\;\left(c \cdot j\right) \cdot a\\
\mathbf{elif}\;i \leq 1.95 \cdot 10^{-57}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if i < -2.59999999999999999e59 or 1.95000000000000003e-57 < i Initial program 62.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6447.5
Applied rewrites47.5%
Taylor expanded in x around 0
Applied rewrites38.3%
if -2.59999999999999999e59 < i < -9.8e-277Initial program 80.6%
Taylor expanded in c around 0
Applied rewrites69.9%
Taylor expanded in j around -inf
Applied rewrites45.1%
Taylor expanded in y around 0
Applied rewrites32.3%
if -9.8e-277 < i < 1.95000000000000003e-57Initial program 85.7%
Taylor expanded in z around -inf
Applied rewrites76.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6458.6
Applied rewrites58.6%
Taylor expanded in x around inf
Applied rewrites35.2%
Applied rewrites38.8%
Final simplification36.7%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= i -1.2e+61) (not (<= i 1.95e-57))) (* (* t i) b) (* (* z x) y)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((i <= -1.2e+61) || !(i <= 1.95e-57)) {
tmp = (t * i) * b;
} else {
tmp = (z * x) * y;
}
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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((i <= (-1.2d+61)) .or. (.not. (i <= 1.95d-57))) then
tmp = (t * i) * b
else
tmp = (z * x) * y
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 i, double j) {
double tmp;
if ((i <= -1.2e+61) || !(i <= 1.95e-57)) {
tmp = (t * i) * b;
} else {
tmp = (z * x) * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (i <= -1.2e+61) or not (i <= 1.95e-57): tmp = (t * i) * b else: tmp = (z * x) * y return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((i <= -1.2e+61) || !(i <= 1.95e-57)) tmp = Float64(Float64(t * i) * b); else tmp = Float64(Float64(z * x) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((i <= -1.2e+61) || ~((i <= 1.95e-57))) tmp = (t * i) * b; else tmp = (z * x) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[i, -1.2e+61], N[Not[LessEqual[i, 1.95e-57]], $MachinePrecision]], N[(N[(t * i), $MachinePrecision] * b), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.2 \cdot 10^{+61} \lor \neg \left(i \leq 1.95 \cdot 10^{-57}\right):\\
\;\;\;\;\left(t \cdot i\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if i < -1.1999999999999999e61 or 1.95000000000000003e-57 < i Initial program 62.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6447.5
Applied rewrites47.5%
Taylor expanded in x around 0
Applied rewrites38.3%
if -1.1999999999999999e61 < i < 1.95000000000000003e-57Initial program 82.8%
Taylor expanded in z around -inf
Applied rewrites80.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6451.1
Applied rewrites51.1%
Taylor expanded in x around inf
Applied rewrites29.9%
Applied rewrites30.0%
Final simplification34.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= i -9e+62) (not (<= i 1.95e-57))) (* (* t i) b) (* (* y z) x)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((i <= -9e+62) || !(i <= 1.95e-57)) {
tmp = (t * i) * b;
} else {
tmp = (y * z) * x;
}
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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((i <= (-9d+62)) .or. (.not. (i <= 1.95d-57))) then
tmp = (t * i) * b
else
tmp = (y * z) * x
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 i, double j) {
double tmp;
if ((i <= -9e+62) || !(i <= 1.95e-57)) {
tmp = (t * i) * b;
} else {
tmp = (y * z) * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (i <= -9e+62) or not (i <= 1.95e-57): tmp = (t * i) * b else: tmp = (y * z) * x return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((i <= -9e+62) || !(i <= 1.95e-57)) tmp = Float64(Float64(t * i) * b); else tmp = Float64(Float64(y * z) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((i <= -9e+62) || ~((i <= 1.95e-57))) tmp = (t * i) * b; else tmp = (y * z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[i, -9e+62], N[Not[LessEqual[i, 1.95e-57]], $MachinePrecision]], N[(N[(t * i), $MachinePrecision] * b), $MachinePrecision], N[(N[(y * z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -9 \cdot 10^{+62} \lor \neg \left(i \leq 1.95 \cdot 10^{-57}\right):\\
\;\;\;\;\left(t \cdot i\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot z\right) \cdot x\\
\end{array}
\end{array}
if i < -8.99999999999999997e62 or 1.95000000000000003e-57 < i Initial program 62.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6446.7
Applied rewrites46.7%
Taylor expanded in x around 0
Applied rewrites38.1%
if -8.99999999999999997e62 < i < 1.95000000000000003e-57Initial program 82.3%
Taylor expanded in z around -inf
Applied rewrites79.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6451.2
Applied rewrites51.2%
Taylor expanded in x around inf
Applied rewrites30.2%
Final simplification34.2%
(FPCore (x y z t a b c i j) :precision binary64 (* (* t i) b))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (t * i) * b;
}
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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
code = (t * i) * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (t * i) * b;
}
def code(x, y, z, t, a, b, c, i, j): return (t * i) * b
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(t * i) * b) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (t * i) * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(t * i), $MachinePrecision] * b), $MachinePrecision]
\begin{array}{l}
\\
\left(t \cdot i\right) \cdot b
\end{array}
Initial program 72.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6440.5
Applied rewrites40.5%
Taylor expanded in x around 0
Applied rewrites23.1%
Final simplification23.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* j (- (* c a) (* y i))))
(t_2
(+
(-
(* x (- (* y z) (* t a)))
(/
(* b (- (pow (* c z) 2.0) (pow (* t i) 2.0)))
(+ (* c z) (* t i))))
t_1)))
(if (< x -1.469694296777705e-64)
t_2
(if (< x 3.2113527362226803e-147)
(- (* (- (* b i) (* x a)) t) (- (* z (* c b)) t_1))
t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = j * ((c * a) - (y * i));
double t_2 = ((x * ((y * z) - (t * a))) - ((b * (pow((c * z), 2.0) - pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1;
double tmp;
if (x < -1.469694296777705e-64) {
tmp = t_2;
} else if (x < 3.2113527362226803e-147) {
tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1);
} else {
tmp = t_2;
}
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, i, j)
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), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = j * ((c * a) - (y * i))
t_2 = ((x * ((y * z) - (t * a))) - ((b * (((c * z) ** 2.0d0) - ((t * i) ** 2.0d0))) / ((c * z) + (t * i)))) + t_1
if (x < (-1.469694296777705d-64)) then
tmp = t_2
else if (x < 3.2113527362226803d-147) then
tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1)
else
tmp = t_2
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 i, double j) {
double t_1 = j * ((c * a) - (y * i));
double t_2 = ((x * ((y * z) - (t * a))) - ((b * (Math.pow((c * z), 2.0) - Math.pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1;
double tmp;
if (x < -1.469694296777705e-64) {
tmp = t_2;
} else if (x < 3.2113527362226803e-147) {
tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = j * ((c * a) - (y * i)) t_2 = ((x * ((y * z) - (t * a))) - ((b * (math.pow((c * z), 2.0) - math.pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1 tmp = 0 if x < -1.469694296777705e-64: tmp = t_2 elif x < 3.2113527362226803e-147: tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(j * Float64(Float64(c * a) - Float64(y * i))) t_2 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(Float64(b * Float64((Float64(c * z) ^ 2.0) - (Float64(t * i) ^ 2.0))) / Float64(Float64(c * z) + Float64(t * i)))) + t_1) tmp = 0.0 if (x < -1.469694296777705e-64) tmp = t_2; elseif (x < 3.2113527362226803e-147) tmp = Float64(Float64(Float64(Float64(b * i) - Float64(x * a)) * t) - Float64(Float64(z * Float64(c * b)) - t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = j * ((c * a) - (y * i)); t_2 = ((x * ((y * z) - (t * a))) - ((b * (((c * z) ^ 2.0) - ((t * i) ^ 2.0))) / ((c * z) + (t * i)))) + t_1; tmp = 0.0; if (x < -1.469694296777705e-64) tmp = t_2; elseif (x < 3.2113527362226803e-147) tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(b * N[(N[Power[N[(c * z), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(t * i), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(c * z), $MachinePrecision] + N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[Less[x, -1.469694296777705e-64], t$95$2, If[Less[x, 3.2113527362226803e-147], N[(N[(N[(N[(b * i), $MachinePrecision] - N[(x * a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] - N[(N[(z * N[(c * b), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := j \cdot \left(c \cdot a - y \cdot i\right)\\
t_2 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + t\_1\\
\mathbf{if}\;x < -1.469694296777705 \cdot 10^{-64}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x < 3.2113527362226803 \cdot 10^{-147}:\\
\;\;\;\;\left(b \cdot i - x \cdot a\right) \cdot t - \left(z \cdot \left(c \cdot b\right) - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024359
(FPCore (x y z t a b c i j)
:name "Data.Colour.Matrix:determinant from colour-2.3.3, A"
:precision binary64
:alt
(! :herbie-platform default (if (< x -293938859355541/2000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))) (if (< x 32113527362226803/10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) (* j (- (* c a) (* y i))))) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))