
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))
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) - (i * a)))) + (j * ((c * t) - (i * y)));
}
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) - (i * a)))) + (j * ((c * t) - (i * y)))
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) - (i * a)))) + (j * ((c * t) - (i * y)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
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(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))); 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[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))
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) - (i * a)))) + (j * ((c * t) - (i * y)));
}
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) - (i * a)))) + (j * ((c * t) - (i * y)))
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) - (i * a)))) + (j * ((c * t) - (i * y)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
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(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))); 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[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\end{array}
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- a) x (* j c))))
(if (<= i -1.28e+123)
(fma (fma (- j) y (* b a)) i (* t_1 t))
(if (<= i 5e+152)
(fma (fma (- z) c (* i a)) b (fma t_1 t (* (fma (- j) i (* z x)) y)))
(* (* (fma a (/ b j) (- y)) j) i)))))
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, (j * c));
double tmp;
if (i <= -1.28e+123) {
tmp = fma(fma(-j, y, (b * a)), i, (t_1 * t));
} else if (i <= 5e+152) {
tmp = fma(fma(-z, c, (i * a)), b, fma(t_1, t, (fma(-j, i, (z * x)) * y)));
} else {
tmp = (fma(a, (b / j), -y) * j) * i;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-a), x, Float64(j * c)) tmp = 0.0 if (i <= -1.28e+123) tmp = fma(fma(Float64(-j), y, Float64(b * a)), i, Float64(t_1 * t)); elseif (i <= 5e+152) tmp = fma(fma(Float64(-z), c, Float64(i * a)), b, fma(t_1, t, Float64(fma(Float64(-j), i, Float64(z * x)) * y))); else tmp = Float64(Float64(fma(a, Float64(b / j), Float64(-y)) * j) * i); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -1.28e+123], N[(N[((-j) * y + N[(b * a), $MachinePrecision]), $MachinePrecision] * i + N[(t$95$1 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5e+152], N[(N[((-z) * c + N[(i * a), $MachinePrecision]), $MachinePrecision] * b + N[(t$95$1 * t + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * N[(b / j), $MachinePrecision] + (-y)), $MachinePrecision] * j), $MachinePrecision] * i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, x, j \cdot c\right)\\
\mathbf{if}\;i \leq -1.28 \cdot 10^{+123}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-j, y, b \cdot a\right), i, t\_1 \cdot t\right)\\
\mathbf{elif}\;i \leq 5 \cdot 10^{+152}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-z, c, i \cdot a\right), b, \mathsf{fma}\left(t\_1, t, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(a, \frac{b}{j}, -y\right) \cdot j\right) \cdot i\\
\end{array}
\end{array}
if i < -1.28000000000000005e123Initial program 45.2%
Taylor expanded in y around 0
Applied rewrites62.5%
Taylor expanded in z around 0
Applied rewrites93.6%
if -1.28000000000000005e123 < i < 5e152Initial program 78.6%
Taylor expanded in y around 0
Applied rewrites85.3%
if 5e152 < i Initial program 42.8%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
Taylor expanded in j around inf
Applied rewrites82.5%
Final simplification86.4%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(* j (- (* c t) (* i y))))))
(if (<= t_1 INFINITY)
t_1
(fma (fma (- j) y (* b a)) i (* (fma (- a) x (* j c)) t)))))
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) - (i * a)))) + (j * ((c * t) - (i * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(fma(-j, y, (b * a)), i, (fma(-a, x, (j * c)) * t));
}
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(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(fma(Float64(-j), y, Float64(b * a)), i, Float64(fma(Float64(-a), x, Float64(j * c)) * t)); 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[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[((-j) * y + N[(b * a), $MachinePrecision]), $MachinePrecision] * i + N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $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 - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-j, y, b \cdot a\right), i, \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) < +inf.0Initial program 90.1%
if +inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) Initial program 0.0%
Taylor expanded in y around 0
Applied rewrites50.8%
Taylor expanded in z around 0
Applied rewrites71.5%
Final simplification85.5%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) x (* j c)) t))
(t_2 (fma (fma (- z) c (* i a)) b t_1)))
(if (<= i -1.65e+49)
(fma (fma (- j) y (* b a)) i t_1)
(if (<= i -2e-47)
(fma (* i a) b (* (fma (- j) i (* z x)) y))
(if (<= i -7.8e-259)
t_2
(if (<= i 1.45e-82)
(fma (fma (- z) b (* j t)) c (* (fma (- a) t (* z y)) x))
(if (<= i 1.75e+134) t_2 (* (* (fma a (/ b j) (- y)) j) i))))))))
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, (j * c)) * t;
double t_2 = fma(fma(-z, c, (i * a)), b, t_1);
double tmp;
if (i <= -1.65e+49) {
tmp = fma(fma(-j, y, (b * a)), i, t_1);
} else if (i <= -2e-47) {
tmp = fma((i * a), b, (fma(-j, i, (z * x)) * y));
} else if (i <= -7.8e-259) {
tmp = t_2;
} else if (i <= 1.45e-82) {
tmp = fma(fma(-z, b, (j * t)), c, (fma(-a, t, (z * y)) * x));
} else if (i <= 1.75e+134) {
tmp = t_2;
} else {
tmp = (fma(a, (b / j), -y) * j) * i;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-a), x, Float64(j * c)) * t) t_2 = fma(fma(Float64(-z), c, Float64(i * a)), b, t_1) tmp = 0.0 if (i <= -1.65e+49) tmp = fma(fma(Float64(-j), y, Float64(b * a)), i, t_1); elseif (i <= -2e-47) tmp = fma(Float64(i * a), b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); elseif (i <= -7.8e-259) tmp = t_2; elseif (i <= 1.45e-82) tmp = fma(fma(Float64(-z), b, Float64(j * t)), c, Float64(fma(Float64(-a), t, Float64(z * y)) * x)); elseif (i <= 1.75e+134) tmp = t_2; else tmp = Float64(Float64(fma(a, Float64(b / j), Float64(-y)) * j) * i); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-z) * c + N[(i * a), $MachinePrecision]), $MachinePrecision] * b + t$95$1), $MachinePrecision]}, If[LessEqual[i, -1.65e+49], N[(N[((-j) * y + N[(b * a), $MachinePrecision]), $MachinePrecision] * i + t$95$1), $MachinePrecision], If[LessEqual[i, -2e-47], N[(N[(i * a), $MachinePrecision] * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, -7.8e-259], t$95$2, If[LessEqual[i, 1.45e-82], N[(N[((-z) * b + N[(j * t), $MachinePrecision]), $MachinePrecision] * c + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.75e+134], t$95$2, N[(N[(N[(a * N[(b / j), $MachinePrecision] + (-y)), $MachinePrecision] * j), $MachinePrecision] * i), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
t_2 := \mathsf{fma}\left(\mathsf{fma}\left(-z, c, i \cdot a\right), b, t\_1\right)\\
\mathbf{if}\;i \leq -1.65 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-j, y, b \cdot a\right), i, t\_1\right)\\
\mathbf{elif}\;i \leq -2 \cdot 10^{-47}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot a, b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\mathbf{elif}\;i \leq -7.8 \cdot 10^{-259}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;i \leq 1.45 \cdot 10^{-82}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-z, b, j \cdot t\right), c, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\mathbf{elif}\;i \leq 1.75 \cdot 10^{+134}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(a, \frac{b}{j}, -y\right) \cdot j\right) \cdot i\\
\end{array}
\end{array}
if i < -1.6499999999999999e49Initial program 51.2%
Taylor expanded in y around 0
Applied rewrites68.4%
Taylor expanded in z around 0
Applied rewrites90.1%
if -1.6499999999999999e49 < i < -1.9999999999999999e-47Initial program 76.5%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/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
Applied rewrites81.1%
Taylor expanded in z around 0
Applied rewrites86.2%
if -1.9999999999999999e-47 < i < -7.80000000000000031e-259 or 1.44999999999999989e-82 < i < 1.75000000000000001e134Initial program 75.1%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites79.4%
if -7.80000000000000031e-259 < i < 1.44999999999999989e-82Initial program 83.9%
Taylor expanded in i around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-rgt-inN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
cancel-sign-sub-invN/A
*-commutativeN/A
+-commutativeN/A
Applied rewrites80.9%
if 1.75000000000000001e134 < i Initial program 47.6%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6478.2
Applied rewrites78.2%
Taylor expanded in j around inf
Applied rewrites81.2%
Final simplification83.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (fma (- j) y (* b a)) i (* (fma (- a) x (* j c)) t))))
(if (<= i -1.65e+49)
t_1
(if (<= i -2e-47)
(fma (* i a) b (* (fma (- j) i (* z x)) y))
(if (<= i 4.6e-117)
(fma (fma (- z) b (* j t)) c (* (fma (- a) t (* z y)) x))
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(fma(-j, y, (b * a)), i, (fma(-a, x, (j * c)) * t));
double tmp;
if (i <= -1.65e+49) {
tmp = t_1;
} else if (i <= -2e-47) {
tmp = fma((i * a), b, (fma(-j, i, (z * x)) * y));
} else if (i <= 4.6e-117) {
tmp = fma(fma(-z, b, (j * t)), c, (fma(-a, t, (z * y)) * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(fma(Float64(-j), y, Float64(b * a)), i, Float64(fma(Float64(-a), x, Float64(j * c)) * t)) tmp = 0.0 if (i <= -1.65e+49) tmp = t_1; elseif (i <= -2e-47) tmp = fma(Float64(i * a), b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); elseif (i <= 4.6e-117) tmp = fma(fma(Float64(-z), b, Float64(j * t)), c, Float64(fma(Float64(-a), t, Float64(z * y)) * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-j) * y + N[(b * a), $MachinePrecision]), $MachinePrecision] * i + N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -1.65e+49], t$95$1, If[LessEqual[i, -2e-47], N[(N[(i * a), $MachinePrecision] * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 4.6e-117], N[(N[((-z) * b + N[(j * t), $MachinePrecision]), $MachinePrecision] * c + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(-j, y, b \cdot a\right), i, \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\right)\\
\mathbf{if}\;i \leq -1.65 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq -2 \cdot 10^{-47}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot a, b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\mathbf{elif}\;i \leq 4.6 \cdot 10^{-117}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-z, b, j \cdot t\right), c, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if i < -1.6499999999999999e49 or 4.59999999999999989e-117 < i Initial program 56.5%
Taylor expanded in y around 0
Applied rewrites70.8%
Taylor expanded in z around 0
Applied rewrites82.5%
if -1.6499999999999999e49 < i < -1.9999999999999999e-47Initial program 76.5%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/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
Applied rewrites81.1%
Taylor expanded in z around 0
Applied rewrites86.2%
if -1.9999999999999999e-47 < i < 4.59999999999999989e-117Initial program 81.5%
Taylor expanded in i around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-rgt-inN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
cancel-sign-sub-invN/A
*-commutativeN/A
+-commutativeN/A
Applied rewrites72.4%
Final simplification78.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- z) c (* i a))) (t_2 (* (fma (- a) x (* j c)) t)))
(if (<= t -4.8e+50)
(fma (fma (- j) y (* b a)) i t_2)
(if (<= t 1.86e-44)
(fma t_1 b (* (fma (- j) i (* z x)) y))
(fma t_1 b 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(-z, c, (i * a));
double t_2 = fma(-a, x, (j * c)) * t;
double tmp;
if (t <= -4.8e+50) {
tmp = fma(fma(-j, y, (b * a)), i, t_2);
} else if (t <= 1.86e-44) {
tmp = fma(t_1, b, (fma(-j, i, (z * x)) * y));
} else {
tmp = fma(t_1, b, t_2);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-z), c, Float64(i * a)) t_2 = Float64(fma(Float64(-a), x, Float64(j * c)) * t) tmp = 0.0 if (t <= -4.8e+50) tmp = fma(fma(Float64(-j), y, Float64(b * a)), i, t_2); elseif (t <= 1.86e-44) tmp = fma(t_1, b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); else tmp = fma(t_1, b, t_2); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-z) * c + N[(i * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -4.8e+50], N[(N[((-j) * y + N[(b * a), $MachinePrecision]), $MachinePrecision] * i + t$95$2), $MachinePrecision], If[LessEqual[t, 1.86e-44], N[(t$95$1 * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * b + t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-z, c, i \cdot a\right)\\
t_2 := \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{if}\;t \leq -4.8 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-j, y, b \cdot a\right), i, t\_2\right)\\
\mathbf{elif}\;t \leq 1.86 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, b, t\_2\right)\\
\end{array}
\end{array}
if t < -4.8000000000000004e50Initial program 57.4%
Taylor expanded in y around 0
Applied rewrites72.6%
Taylor expanded in z around 0
Applied rewrites72.7%
if -4.8000000000000004e50 < t < 1.86000000000000005e-44Initial program 82.5%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/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
Applied rewrites83.9%
if 1.86000000000000005e-44 < t Initial program 52.8%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites77.5%
Final simplification79.1%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= z -4.4e+86)
(* (fma (- b) c (* y x)) z)
(if (<= z 1.22e+162)
(fma (fma (- j) y (* b a)) i (* (fma (- a) x (* j c)) t))
(fma (* i a) b (* (fma (- j) i (* 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 <= -4.4e+86) {
tmp = fma(-b, c, (y * x)) * z;
} else if (z <= 1.22e+162) {
tmp = fma(fma(-j, y, (b * a)), i, (fma(-a, x, (j * c)) * t));
} else {
tmp = fma((i * a), b, (fma(-j, i, (z * x)) * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (z <= -4.4e+86) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); elseif (z <= 1.22e+162) tmp = fma(fma(Float64(-j), y, Float64(b * a)), i, Float64(fma(Float64(-a), x, Float64(j * c)) * t)); else tmp = fma(Float64(i * a), b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[z, -4.4e+86], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 1.22e+162], N[(N[((-j) * y + N[(b * a), $MachinePrecision]), $MachinePrecision] * i + N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(i * a), $MachinePrecision] * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{elif}\;z \leq 1.22 \cdot 10^{+162}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-j, y, b \cdot a\right), i, \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot a, b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\end{array}
\end{array}
if z < -4.40000000000000006e86Initial program 51.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-*.f6464.9
Applied rewrites64.9%
if -4.40000000000000006e86 < z < 1.22e162Initial program 74.1%
Taylor expanded in y around 0
Applied rewrites81.2%
Taylor expanded in z around 0
Applied rewrites75.4%
if 1.22e162 < z Initial program 52.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/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
Applied rewrites78.0%
Taylor expanded in z around 0
Applied rewrites81.9%
Final simplification74.3%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= c -2.65e+54)
(* (* (fma (- b) (/ z t) j) t) c)
(if (<= c 2.15e+84)
(fma (* i a) b (* (fma (- j) i (* z x)) y))
(* (fma (- z) b (* j t)) c))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (c <= -2.65e+54) {
tmp = (fma(-b, (z / t), j) * t) * c;
} else if (c <= 2.15e+84) {
tmp = fma((i * a), b, (fma(-j, i, (z * x)) * y));
} else {
tmp = fma(-z, b, (j * t)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (c <= -2.65e+54) tmp = Float64(Float64(fma(Float64(-b), Float64(z / t), j) * t) * c); elseif (c <= 2.15e+84) tmp = fma(Float64(i * a), b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); else tmp = Float64(fma(Float64(-z), b, Float64(j * t)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[c, -2.65e+54], N[(N[(N[((-b) * N[(z / t), $MachinePrecision] + j), $MachinePrecision] * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[c, 2.15e+84], N[(N[(i * a), $MachinePrecision] * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[((-z) * b + N[(j * t), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.65 \cdot 10^{+54}:\\
\;\;\;\;\left(\mathsf{fma}\left(-b, \frac{z}{t}, j\right) \cdot t\right) \cdot c\\
\mathbf{elif}\;c \leq 2.15 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot a, b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, b, j \cdot t\right) \cdot c\\
\end{array}
\end{array}
if c < -2.65000000000000009e54Initial program 62.1%
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
lower-*.f6471.8
Applied rewrites71.8%
Taylor expanded in t around inf
Applied rewrites73.5%
if -2.65000000000000009e54 < c < 2.1499999999999998e84Initial program 73.3%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/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
Applied rewrites70.9%
Taylor expanded in z around 0
Applied rewrites67.3%
if 2.1499999999999998e84 < c Initial program 54.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
lower-*.f6468.1
Applied rewrites68.1%
Final simplification68.7%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= b -0.18)
(* (* i b) a)
(if (<= b -3.2e-190)
(* (* (- j) y) i)
(if (<= b 2.2e-212)
(* (* j t) c)
(if (<= b 6.6e+36) (* (* (- t) x) a) (* (* b a) i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (b <= -0.18) {
tmp = (i * b) * a;
} else if (b <= -3.2e-190) {
tmp = (-j * y) * i;
} else if (b <= 2.2e-212) {
tmp = (j * t) * c;
} else if (b <= 6.6e+36) {
tmp = (-t * x) * a;
} else {
tmp = (b * a) * i;
}
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 (b <= (-0.18d0)) then
tmp = (i * b) * a
else if (b <= (-3.2d-190)) then
tmp = (-j * y) * i
else if (b <= 2.2d-212) then
tmp = (j * t) * c
else if (b <= 6.6d+36) then
tmp = (-t * x) * a
else
tmp = (b * a) * i
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 (b <= -0.18) {
tmp = (i * b) * a;
} else if (b <= -3.2e-190) {
tmp = (-j * y) * i;
} else if (b <= 2.2e-212) {
tmp = (j * t) * c;
} else if (b <= 6.6e+36) {
tmp = (-t * x) * a;
} else {
tmp = (b * a) * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if b <= -0.18: tmp = (i * b) * a elif b <= -3.2e-190: tmp = (-j * y) * i elif b <= 2.2e-212: tmp = (j * t) * c elif b <= 6.6e+36: tmp = (-t * x) * a else: tmp = (b * a) * i return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (b <= -0.18) tmp = Float64(Float64(i * b) * a); elseif (b <= -3.2e-190) tmp = Float64(Float64(Float64(-j) * y) * i); elseif (b <= 2.2e-212) tmp = Float64(Float64(j * t) * c); elseif (b <= 6.6e+36) tmp = Float64(Float64(Float64(-t) * x) * a); else tmp = Float64(Float64(b * a) * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (b <= -0.18) tmp = (i * b) * a; elseif (b <= -3.2e-190) tmp = (-j * y) * i; elseif (b <= 2.2e-212) tmp = (j * t) * c; elseif (b <= 6.6e+36) tmp = (-t * x) * a; else tmp = (b * a) * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[b, -0.18], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[b, -3.2e-190], N[(N[((-j) * y), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[b, 2.2e-212], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[b, 6.6e+36], N[(N[((-t) * x), $MachinePrecision] * a), $MachinePrecision], N[(N[(b * a), $MachinePrecision] * i), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.18:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{elif}\;b \leq -3.2 \cdot 10^{-190}:\\
\;\;\;\;\left(\left(-j\right) \cdot y\right) \cdot i\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{-212}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;b \leq 6.6 \cdot 10^{+36}:\\
\;\;\;\;\left(\left(-t\right) \cdot x\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot a\right) \cdot i\\
\end{array}
\end{array}
if b < -0.17999999999999999Initial program 70.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6449.6
Applied rewrites49.6%
Taylor expanded in x around 0
Applied rewrites45.0%
if -0.17999999999999999 < b < -3.2000000000000001e-190Initial program 64.3%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6452.3
Applied rewrites52.3%
Taylor expanded in y around inf
Applied rewrites39.8%
if -3.2000000000000001e-190 < b < 2.20000000000000003e-212Initial program 49.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6473.3
Applied rewrites73.3%
Taylor expanded in x around 0
Applied rewrites52.7%
if 2.20000000000000003e-212 < b < 6.5999999999999997e36Initial program 69.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
Taylor expanded in x around inf
Applied rewrites37.5%
if 6.5999999999999997e36 < b Initial program 77.3%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6458.7
Applied rewrites58.7%
Taylor expanded in y around 0
Applied rewrites46.8%
Final simplification43.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- z) c (* i a)) b)))
(if (<= b -0.00018)
t_1
(if (<= b -7.8e-120)
(* (fma (- j) i (* z x)) y)
(if (<= b 4.9e+83) (* (fma (- a) x (* j c)) 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(-z, c, (i * a)) * b;
double tmp;
if (b <= -0.00018) {
tmp = t_1;
} else if (b <= -7.8e-120) {
tmp = fma(-j, i, (z * x)) * y;
} else if (b <= 4.9e+83) {
tmp = fma(-a, x, (j * c)) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-z), c, Float64(i * a)) * b) tmp = 0.0 if (b <= -0.00018) tmp = t_1; elseif (b <= -7.8e-120) tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); elseif (b <= 4.9e+83) tmp = Float64(fma(Float64(-a), x, Float64(j * c)) * 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[((-z) * c + N[(i * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -0.00018], t$95$1, If[LessEqual[b, -7.8e-120], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[b, 4.9e+83], N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-z, c, i \cdot a\right) \cdot b\\
\mathbf{if}\;b \leq -0.00018:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -7.8 \cdot 10^{-120}:\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\mathbf{elif}\;b \leq 4.9 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.80000000000000011e-4 or 4.89999999999999979e83 < b Initial program 71.5%
Taylor expanded in b around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
lower-*.f64N/A
Applied rewrites66.8%
if -1.80000000000000011e-4 < b < -7.8000000000000003e-120Initial program 62.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6455.0
Applied rewrites55.0%
if -7.8000000000000003e-120 < b < 4.89999999999999979e83Initial program 65.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
Final simplification64.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) x (* j c)) t)))
(if (<= t -1.55e+98)
t_1
(if (<= t 1.42e-124)
(* (fma (- j) i (* z x)) y)
(if (<= t 2.9e-7) (* (fma (- b) c (* y x)) 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(-a, x, (j * c)) * t;
double tmp;
if (t <= -1.55e+98) {
tmp = t_1;
} else if (t <= 1.42e-124) {
tmp = fma(-j, i, (z * x)) * y;
} else if (t <= 2.9e-7) {
tmp = fma(-b, c, (y * x)) * z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-a), x, Float64(j * c)) * t) tmp = 0.0 if (t <= -1.55e+98) tmp = t_1; elseif (t <= 1.42e-124) tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); elseif (t <= 2.9e-7) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * 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[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.55e+98], t$95$1, If[LessEqual[t, 1.42e-124], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 2.9e-7], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{if}\;t \leq -1.55 \cdot 10^{+98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.42 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.5500000000000001e98 or 2.8999999999999998e-7 < t Initial program 51.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6465.6
Applied rewrites65.6%
if -1.5500000000000001e98 < t < 1.42000000000000004e-124Initial program 80.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6456.7
Applied rewrites56.7%
if 1.42000000000000004e-124 < t < 2.8999999999999998e-7Initial program 85.7%
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-*.f6451.5
Applied rewrites51.5%
Final simplification60.2%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= b -3.1e-118)
(* (* (fma a (/ b j) (- y)) j) i)
(if (<= b 4.9e+83)
(* (fma (- a) x (* j c)) t)
(* (fma (- z) c (* i a)) b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (b <= -3.1e-118) {
tmp = (fma(a, (b / j), -y) * j) * i;
} else if (b <= 4.9e+83) {
tmp = fma(-a, x, (j * c)) * t;
} else {
tmp = fma(-z, c, (i * a)) * b;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (b <= -3.1e-118) tmp = Float64(Float64(fma(a, Float64(b / j), Float64(-y)) * j) * i); elseif (b <= 4.9e+83) tmp = Float64(fma(Float64(-a), x, Float64(j * c)) * t); else tmp = Float64(fma(Float64(-z), c, Float64(i * a)) * b); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[b, -3.1e-118], N[(N[(N[(a * N[(b / j), $MachinePrecision] + (-y)), $MachinePrecision] * j), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[b, 4.9e+83], N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[((-z) * c + N[(i * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{-118}:\\
\;\;\;\;\left(\mathsf{fma}\left(a, \frac{b}{j}, -y\right) \cdot j\right) \cdot i\\
\mathbf{elif}\;b \leq 4.9 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, c, i \cdot a\right) \cdot b\\
\end{array}
\end{array}
if b < -3.1000000000000001e-118Initial program 68.8%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6453.9
Applied rewrites53.9%
Taylor expanded in j around inf
Applied rewrites57.2%
if -3.1000000000000001e-118 < b < 4.89999999999999979e83Initial program 64.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6462.6
Applied rewrites62.6%
if 4.89999999999999979e83 < b Initial program 73.6%
Taylor expanded in b around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
lower-*.f64N/A
Applied rewrites73.9%
Final simplification62.9%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= y -8.5e+72) (not (<= y 2.4e+51))) (* (fma (- j) i (* z x)) y) (* (fma (- x) t (* i b)) a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((y <= -8.5e+72) || !(y <= 2.4e+51)) {
tmp = fma(-j, i, (z * x)) * y;
} else {
tmp = fma(-x, t, (i * b)) * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((y <= -8.5e+72) || !(y <= 2.4e+51)) tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); else tmp = Float64(fma(Float64(-x), t, Float64(i * b)) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[y, -8.5e+72], N[Not[LessEqual[y, 2.4e+51]], $MachinePrecision]], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[((-x) * t + N[(i * b), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+72} \lor \neg \left(y \leq 2.4 \cdot 10^{+51}\right):\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-x, t, i \cdot b\right) \cdot a\\
\end{array}
\end{array}
if y < -8.5000000000000004e72 or 2.3999999999999999e51 < y Initial program 55.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6468.4
Applied rewrites68.4%
if -8.5000000000000004e72 < y < 2.3999999999999999e51Initial program 78.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6455.2
Applied rewrites55.2%
Final simplification61.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -7.5e-22) (not (<= z 6.5e+143))) (* (fma (- b) c (* y x)) z) (* (fma (- a) x (* j c)) t)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -7.5e-22) || !(z <= 6.5e+143)) {
tmp = fma(-b, c, (y * x)) * z;
} else {
tmp = fma(-a, x, (j * c)) * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((z <= -7.5e-22) || !(z <= 6.5e+143)) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); else tmp = Float64(fma(Float64(-a), x, Float64(j * c)) * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -7.5e-22], N[Not[LessEqual[z, 6.5e+143]], $MachinePrecision]], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-22} \lor \neg \left(z \leq 6.5 \cdot 10^{+143}\right):\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\end{array}
\end{array}
if z < -7.49999999999999978e-22 or 6.4999999999999997e143 < z Initial program 54.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-*.f6465.2
Applied rewrites65.2%
if -7.49999999999999978e-22 < z < 6.4999999999999997e143Initial program 76.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6448.4
Applied rewrites48.4%
Final simplification54.9%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= b -1.1e-139)
(* (* i b) a)
(if (<= b 2.2e-212)
(* (* j t) c)
(if (<= b 6.6e+36) (* (* (- t) x) a) (* (* b a) i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (b <= -1.1e-139) {
tmp = (i * b) * a;
} else if (b <= 2.2e-212) {
tmp = (j * t) * c;
} else if (b <= 6.6e+36) {
tmp = (-t * x) * a;
} else {
tmp = (b * a) * i;
}
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 (b <= (-1.1d-139)) then
tmp = (i * b) * a
else if (b <= 2.2d-212) then
tmp = (j * t) * c
else if (b <= 6.6d+36) then
tmp = (-t * x) * a
else
tmp = (b * a) * i
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 (b <= -1.1e-139) {
tmp = (i * b) * a;
} else if (b <= 2.2e-212) {
tmp = (j * t) * c;
} else if (b <= 6.6e+36) {
tmp = (-t * x) * a;
} else {
tmp = (b * a) * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if b <= -1.1e-139: tmp = (i * b) * a elif b <= 2.2e-212: tmp = (j * t) * c elif b <= 6.6e+36: tmp = (-t * x) * a else: tmp = (b * a) * i return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (b <= -1.1e-139) tmp = Float64(Float64(i * b) * a); elseif (b <= 2.2e-212) tmp = Float64(Float64(j * t) * c); elseif (b <= 6.6e+36) tmp = Float64(Float64(Float64(-t) * x) * a); else tmp = Float64(Float64(b * a) * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (b <= -1.1e-139) tmp = (i * b) * a; elseif (b <= 2.2e-212) tmp = (j * t) * c; elseif (b <= 6.6e+36) tmp = (-t * x) * a; else tmp = (b * a) * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[b, -1.1e-139], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[b, 2.2e-212], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[b, 6.6e+36], N[(N[((-t) * x), $MachinePrecision] * a), $MachinePrecision], N[(N[(b * a), $MachinePrecision] * i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{-139}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{-212}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;b \leq 6.6 \cdot 10^{+36}:\\
\;\;\;\;\left(\left(-t\right) \cdot x\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot a\right) \cdot i\\
\end{array}
\end{array}
if b < -1.10000000000000005e-139Initial program 67.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
Taylor expanded in x around 0
Applied rewrites38.0%
if -1.10000000000000005e-139 < b < 2.20000000000000003e-212Initial program 54.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6470.4
Applied rewrites70.4%
Taylor expanded in x around 0
Applied rewrites50.1%
if 2.20000000000000003e-212 < b < 6.5999999999999997e36Initial program 69.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
Taylor expanded in x around inf
Applied rewrites37.5%
if 6.5999999999999997e36 < b Initial program 77.3%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6458.7
Applied rewrites58.7%
Taylor expanded in y around 0
Applied rewrites46.8%
Final simplification41.9%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= b -2e-41) (* (* i b) a) (if (<= b 9.2e+85) (* (fma (- a) x (* j c)) t) (* (* b a) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (b <= -2e-41) {
tmp = (i * b) * a;
} else if (b <= 9.2e+85) {
tmp = fma(-a, x, (j * c)) * t;
} else {
tmp = (b * a) * i;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (b <= -2e-41) tmp = Float64(Float64(i * b) * a); elseif (b <= 9.2e+85) tmp = Float64(fma(Float64(-a), x, Float64(j * c)) * t); else tmp = Float64(Float64(b * a) * i); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[b, -2e-41], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[b, 9.2e+85], N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[(b * a), $MachinePrecision] * i), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-41}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{elif}\;b \leq 9.2 \cdot 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot a\right) \cdot i\\
\end{array}
\end{array}
if b < -2.00000000000000001e-41Initial program 69.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6449.6
Applied rewrites49.6%
Taylor expanded in x around 0
Applied rewrites44.1%
if -2.00000000000000001e-41 < b < 9.1999999999999996e85Initial program 64.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6458.9
Applied rewrites58.9%
if 9.1999999999999996e85 < b Initial program 75.2%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6458.9
Applied rewrites58.9%
Taylor expanded in y around 0
Applied rewrites51.0%
Final simplification53.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= b -1.1e-139) (not (<= b 3e+84))) (* (* i b) a) (* (* j t) c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((b <= -1.1e-139) || !(b <= 3e+84)) {
tmp = (i * b) * a;
} else {
tmp = (j * t) * c;
}
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 ((b <= (-1.1d-139)) .or. (.not. (b <= 3d+84))) then
tmp = (i * b) * a
else
tmp = (j * t) * c
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 ((b <= -1.1e-139) || !(b <= 3e+84)) {
tmp = (i * b) * a;
} else {
tmp = (j * t) * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (b <= -1.1e-139) or not (b <= 3e+84): tmp = (i * b) * a else: tmp = (j * t) * c return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((b <= -1.1e-139) || !(b <= 3e+84)) tmp = Float64(Float64(i * b) * a); else tmp = Float64(Float64(j * t) * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((b <= -1.1e-139) || ~((b <= 3e+84))) tmp = (i * b) * a; else tmp = (j * t) * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[b, -1.1e-139], N[Not[LessEqual[b, 3e+84]], $MachinePrecision]], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{-139} \lor \neg \left(b \leq 3 \cdot 10^{+84}\right):\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\end{array}
\end{array}
if b < -1.10000000000000005e-139 or 2.99999999999999996e84 < b Initial program 70.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6447.3
Applied rewrites47.3%
Taylor expanded in x around 0
Applied rewrites39.7%
if -1.10000000000000005e-139 < b < 2.99999999999999996e84Initial program 65.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6463.5
Applied rewrites63.5%
Taylor expanded in x around 0
Applied rewrites37.7%
Final simplification38.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= b -1.1e-139) (* (* i b) a) (if (<= b 2.95e+84) (* (* j t) c) (* (* b a) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (b <= -1.1e-139) {
tmp = (i * b) * a;
} else if (b <= 2.95e+84) {
tmp = (j * t) * c;
} else {
tmp = (b * a) * i;
}
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 (b <= (-1.1d-139)) then
tmp = (i * b) * a
else if (b <= 2.95d+84) then
tmp = (j * t) * c
else
tmp = (b * a) * i
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 (b <= -1.1e-139) {
tmp = (i * b) * a;
} else if (b <= 2.95e+84) {
tmp = (j * t) * c;
} else {
tmp = (b * a) * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if b <= -1.1e-139: tmp = (i * b) * a elif b <= 2.95e+84: tmp = (j * t) * c else: tmp = (b * a) * i return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (b <= -1.1e-139) tmp = Float64(Float64(i * b) * a); elseif (b <= 2.95e+84) tmp = Float64(Float64(j * t) * c); else tmp = Float64(Float64(b * a) * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (b <= -1.1e-139) tmp = (i * b) * a; elseif (b <= 2.95e+84) tmp = (j * t) * c; else tmp = (b * a) * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[b, -1.1e-139], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[b, 2.95e+84], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], N[(N[(b * a), $MachinePrecision] * i), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{-139}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{elif}\;b \leq 2.95 \cdot 10^{+84}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot a\right) \cdot i\\
\end{array}
\end{array}
if b < -1.10000000000000005e-139Initial program 67.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
Taylor expanded in x around 0
Applied rewrites38.0%
if -1.10000000000000005e-139 < b < 2.94999999999999992e84Initial program 65.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6463.5
Applied rewrites63.5%
Taylor expanded in x around 0
Applied rewrites37.7%
if 2.94999999999999992e84 < b Initial program 75.2%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6458.9
Applied rewrites58.9%
Taylor expanded in y around 0
Applied rewrites51.0%
Final simplification40.3%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= t -2.1e+110) (* (* c t) j) (if (<= t 3.15e-24) (* (* z y) x) (* (* j t) c))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (t <= -2.1e+110) {
tmp = (c * t) * j;
} else if (t <= 3.15e-24) {
tmp = (z * y) * x;
} else {
tmp = (j * t) * c;
}
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 (t <= (-2.1d+110)) then
tmp = (c * t) * j
else if (t <= 3.15d-24) then
tmp = (z * y) * x
else
tmp = (j * t) * c
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 (t <= -2.1e+110) {
tmp = (c * t) * j;
} else if (t <= 3.15e-24) {
tmp = (z * y) * x;
} else {
tmp = (j * t) * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if t <= -2.1e+110: tmp = (c * t) * j elif t <= 3.15e-24: tmp = (z * y) * x else: tmp = (j * t) * c return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (t <= -2.1e+110) tmp = Float64(Float64(c * t) * j); elseif (t <= 3.15e-24) tmp = Float64(Float64(z * y) * x); else tmp = Float64(Float64(j * t) * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (t <= -2.1e+110) tmp = (c * t) * j; elseif (t <= 3.15e-24) tmp = (z * y) * x; else tmp = (j * t) * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[t, -2.1e+110], N[(N[(c * t), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[t, 3.15e-24], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+110}:\\
\;\;\;\;\left(c \cdot t\right) \cdot j\\
\mathbf{elif}\;t \leq 3.15 \cdot 10^{-24}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\end{array}
\end{array}
if t < -2.10000000000000015e110Initial program 53.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6468.0
Applied rewrites68.0%
Taylor expanded in x around 0
Applied rewrites46.3%
Applied rewrites48.1%
if -2.10000000000000015e110 < t < 3.1499999999999999e-24Initial program 81.0%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/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
Applied rewrites79.4%
Taylor expanded in x around inf
Applied rewrites26.6%
if 3.1499999999999999e-24 < t Initial program 52.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6460.4
Applied rewrites60.4%
Taylor expanded in x around 0
Applied rewrites39.9%
Final simplification34.7%
(FPCore (x y z t a b c i j) :precision binary64 (* (* c t) j))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (c * t) * j;
}
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 = (c * t) * j
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 (c * t) * j;
}
def code(x, y, z, t, a, b, c, i, j): return (c * t) * j
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(c * t) * j) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (c * t) * j; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(c * t), $MachinePrecision] * j), $MachinePrecision]
\begin{array}{l}
\\
\left(c \cdot t\right) \cdot j
\end{array}
Initial program 67.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6443.4
Applied rewrites43.4%
Taylor expanded in x around 0
Applied rewrites25.0%
Applied rewrites25.2%
Final simplification25.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(/
(* j (- (pow (* c t) 2.0) (pow (* i y) 2.0)))
(+ (* c t) (* i y)))))
(t_2
(-
(* x (- (* z y) (* a t)))
(- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j)))))
(if (< t -8.120978919195912e-33)
t_2
(if (< t -4.712553818218485e-169)
t_1
(if (< t -7.633533346031584e-308)
t_2
(if (< t 1.0535888557455487e-139) 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 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (pow((c * t), 2.0) - pow((i * y), 2.0))) / ((c * t) + (i * y)));
double t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j));
double tmp;
if (t < -8.120978919195912e-33) {
tmp = t_2;
} else if (t < -4.712553818218485e-169) {
tmp = t_1;
} else if (t < -7.633533346031584e-308) {
tmp = t_2;
} else if (t < 1.0535888557455487e-139) {
tmp = 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 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (((c * t) ** 2.0d0) - ((i * y) ** 2.0d0))) / ((c * t) + (i * y)))
t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j))
if (t < (-8.120978919195912d-33)) then
tmp = t_2
else if (t < (-4.712553818218485d-169)) then
tmp = t_1
else if (t < (-7.633533346031584d-308)) then
tmp = t_2
else if (t < 1.0535888557455487d-139) then
tmp = 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 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (Math.pow((c * t), 2.0) - Math.pow((i * y), 2.0))) / ((c * t) + (i * y)));
double t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j));
double tmp;
if (t < -8.120978919195912e-33) {
tmp = t_2;
} else if (t < -4.712553818218485e-169) {
tmp = t_1;
} else if (t < -7.633533346031584e-308) {
tmp = t_2;
} else if (t < 1.0535888557455487e-139) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (math.pow((c * t), 2.0) - math.pow((i * y), 2.0))) / ((c * t) + (i * y))) t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j)) tmp = 0 if t < -8.120978919195912e-33: tmp = t_2 elif t < -4.712553818218485e-169: tmp = t_1 elif t < -7.633533346031584e-308: tmp = t_2 elif t < 1.0535888557455487e-139: tmp = t_1 else: tmp = t_2 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(i * a)))) + Float64(Float64(j * Float64((Float64(c * t) ^ 2.0) - (Float64(i * y) ^ 2.0))) / Float64(Float64(c * t) + Float64(i * y)))) t_2 = Float64(Float64(x * Float64(Float64(z * y) - Float64(a * t))) - Float64(Float64(b * Float64(Float64(z * c) - Float64(a * i))) - Float64(Float64(Float64(c * t) - Float64(y * i)) * j))) tmp = 0.0 if (t < -8.120978919195912e-33) tmp = t_2; elseif (t < -4.712553818218485e-169) tmp = t_1; elseif (t < -7.633533346031584e-308) tmp = t_2; elseif (t < 1.0535888557455487e-139) tmp = 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 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (((c * t) ^ 2.0) - ((i * y) ^ 2.0))) / ((c * t) + (i * y))); t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j)); tmp = 0.0; if (t < -8.120978919195912e-33) tmp = t_2; elseif (t < -4.712553818218485e-169) tmp = t_1; elseif (t < -7.633533346031584e-308) tmp = t_2; elseif (t < 1.0535888557455487e-139) tmp = 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[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(j * N[(N[Power[N[(c * t), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(i * y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(c * t), $MachinePrecision] + N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(N[(z * y), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(b * N[(N[(z * c), $MachinePrecision] - N[(a * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(c * t), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -8.120978919195912e-33], t$95$2, If[Less[t, -4.712553818218485e-169], t$95$1, If[Less[t, -7.633533346031584e-308], t$95$2, If[Less[t, 1.0535888557455487e-139], t$95$1, t$95$2]]]]]]
\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 - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\
t_2 := x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\
\mathbf{if}\;t < -8.120978919195912 \cdot 10^{-33}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < -4.712553818218485 \cdot 10^{-169}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t < -7.633533346031584 \cdot 10^{-308}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < 1.0535888557455487 \cdot 10^{-139}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2025016
(FPCore (x y z t a b c i j)
:name "Linear.Matrix:det33 from linear-1.19.1.3"
:precision binary64
:alt
(! :herbie-platform default (if (< t -1015122364899489/125000000000000000000000000000000000000000000000) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t -942510763643697/2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2) (pow (* i y) 2))) (+ (* c t) (* i y)))) (if (< t -238547917063487/3125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t 10535888557455487/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2) (pow (* i y) 2))) (+ (* c t) (* i y)))) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))