
(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 20 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)))) (t_2 (* j (- (* c a) (* y i)))))
(if (<= (+ (- t_1 (* b (- (* c z) (* t i)))) t_2) INFINITY)
(+ (- t_1 (fma (* c z) b (* (* (- t) i) b))) t_2)
(* (* (fma (- t) (/ x c) j) c) a))))
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));
double t_2 = j * ((c * a) - (y * i));
double tmp;
if (((t_1 - (b * ((c * z) - (t * i)))) + t_2) <= ((double) INFINITY)) {
tmp = (t_1 - fma((c * z), b, ((-t * i) * b))) + t_2;
} else {
tmp = (fma(-t, (x / c), j) * c) * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(x * Float64(Float64(y * z) - Float64(t * a))) t_2 = Float64(j * Float64(Float64(c * a) - Float64(y * i))) tmp = 0.0 if (Float64(Float64(t_1 - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + t_2) <= Inf) tmp = Float64(Float64(t_1 - fma(Float64(c * z), b, Float64(Float64(Float64(-t) * i) * b))) + t_2); else tmp = Float64(Float64(fma(Float64(-t), Float64(x / c), j) * c) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], Infinity], N[(N[(t$95$1 - N[(N[(c * z), $MachinePrecision] * b + N[(N[((-t) * i), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], N[(N[(N[((-t) * N[(x / c), $MachinePrecision] + j), $MachinePrecision] * c), $MachinePrecision] * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(y \cdot z - t \cdot a\right)\\
t_2 := j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{if}\;\left(t\_1 - b \cdot \left(c \cdot z - t \cdot i\right)\right) + t\_2 \leq \infty:\\
\;\;\;\;\left(t\_1 - \mathsf{fma}\left(c \cdot z, b, \left(\left(-t\right) \cdot i\right) \cdot b\right)\right) + t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-t, \frac{x}{c}, j\right) \cdot c\right) \cdot a\\
\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 93.9%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6493.9
Applied rewrites93.9%
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 a 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-*.f6445.1
Applied rewrites45.1%
Taylor expanded in x around inf
Applied rewrites20.4%
Taylor expanded in c around inf
Applied rewrites54.0%
(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 (- t) (/ x c) j) c) a))))
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(-t, (x / c), j) * c) * a;
}
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(Float64(fma(Float64(-t), Float64(x / c), j) * c) * a); 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[(N[((-t) * N[(x / c), $MachinePrecision] + j), $MachinePrecision] * c), $MachinePrecision] * a), $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}:\\
\;\;\;\;\left(\mathsf{fma}\left(-t, \frac{x}{c}, j\right) \cdot c\right) \cdot a\\
\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 93.9%
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 a 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-*.f6445.1
Applied rewrites45.1%
Taylor expanded in x around inf
Applied rewrites20.4%
Taylor expanded in c around inf
Applied rewrites54.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (* j a) c (* (fma (- a) t (* z y)) x)))
(t_2 (* (fma (- z) b (* j a)) c)))
(if (<= c -2.4e+95)
t_2
(if (<= c -4.4e-74)
t_1
(if (<= c 7e-102)
(* (fma (- j) i (* z x)) y)
(if (<= c 1.8e+161) 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((j * a), c, (fma(-a, t, (z * y)) * x));
double t_2 = fma(-z, b, (j * a)) * c;
double tmp;
if (c <= -2.4e+95) {
tmp = t_2;
} else if (c <= -4.4e-74) {
tmp = t_1;
} else if (c <= 7e-102) {
tmp = fma(-j, i, (z * x)) * y;
} else if (c <= 1.8e+161) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(j * a), c, Float64(fma(Float64(-a), t, Float64(z * y)) * x)) t_2 = Float64(fma(Float64(-z), b, Float64(j * a)) * c) tmp = 0.0 if (c <= -2.4e+95) tmp = t_2; elseif (c <= -4.4e-74) tmp = t_1; elseif (c <= 7e-102) tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); elseif (c <= 1.8e+161) 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[(j * a), $MachinePrecision] * c + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-z) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[c, -2.4e+95], t$95$2, If[LessEqual[c, -4.4e-74], t$95$1, If[LessEqual[c, 7e-102], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[c, 1.8e+161], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(j \cdot a, c, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
t_2 := \mathsf{fma}\left(-z, b, j \cdot a\right) \cdot c\\
\mathbf{if}\;c \leq -2.4 \cdot 10^{+95}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;c \leq -4.4 \cdot 10^{-74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq 7 \cdot 10^{-102}:\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\mathbf{elif}\;c \leq 1.8 \cdot 10^{+161}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if c < -2.4e95 or 1.79999999999999992e161 < c Initial program 55.2%
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-*.f6477.9
Applied rewrites77.9%
if -2.4e95 < c < -4.40000000000000021e-74 or 6.99999999999999973e-102 < c < 1.79999999999999992e161Initial program 82.2%
Taylor expanded in i around 0
Applied rewrites75.4%
Taylor expanded in z around 0
Applied rewrites67.0%
if -4.40000000000000021e-74 < c < 6.99999999999999973e-102Initial program 81.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-*.f6459.0
Applied rewrites59.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) t (* z y)) x)))
(if (or (<= c -1000.0) (not (<= c 1.4e-155)))
(fma (fma (- z) b (* j a)) c t_1)
(fma (fma (- y) j (* b t)) i 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, t, (z * y)) * x;
double tmp;
if ((c <= -1000.0) || !(c <= 1.4e-155)) {
tmp = fma(fma(-z, b, (j * a)), c, t_1);
} else {
tmp = fma(fma(-y, j, (b * t)), i, t_1);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-a), t, Float64(z * y)) * x) tmp = 0.0 if ((c <= -1000.0) || !(c <= 1.4e-155)) tmp = fma(fma(Float64(-z), b, Float64(j * a)), c, t_1); else tmp = fma(fma(Float64(-y), j, Float64(b * t)), i, t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[Or[LessEqual[c, -1000.0], N[Not[LessEqual[c, 1.4e-155]], $MachinePrecision]], N[(N[((-z) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c + t$95$1), $MachinePrecision], N[(N[((-y) * j + N[(b * t), $MachinePrecision]), $MachinePrecision] * i + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{if}\;c \leq -1000 \lor \neg \left(c \leq 1.4 \cdot 10^{-155}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-z, b, j \cdot a\right), c, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-y, j, b \cdot t\right), i, t\_1\right)\\
\end{array}
\end{array}
if c < -1e3 or 1.4e-155 < c Initial program 68.7%
Taylor expanded in i around 0
Applied rewrites72.6%
if -1e3 < c < 1.4e-155Initial program 82.3%
Taylor expanded in c around 0
Applied rewrites82.1%
Final simplification76.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= c -5400.0) (not (<= c 1.05e+161))) (* (fma (- z) b (* j a)) c) (fma (fma (- y) j (* b t)) i (* (fma (- a) t (* z y)) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((c <= -5400.0) || !(c <= 1.05e+161)) {
tmp = fma(-z, b, (j * a)) * c;
} else {
tmp = fma(fma(-y, j, (b * t)), i, (fma(-a, t, (z * y)) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((c <= -5400.0) || !(c <= 1.05e+161)) tmp = Float64(fma(Float64(-z), b, Float64(j * a)) * c); else tmp = fma(fma(Float64(-y), j, Float64(b * t)), i, Float64(fma(Float64(-a), t, Float64(z * y)) * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[c, -5400.0], N[Not[LessEqual[c, 1.05e+161]], $MachinePrecision]], N[(N[((-z) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(N[((-y) * j + N[(b * t), $MachinePrecision]), $MachinePrecision] * i + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -5400 \lor \neg \left(c \leq 1.05 \cdot 10^{+161}\right):\\
\;\;\;\;\mathsf{fma}\left(-z, b, j \cdot a\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-y, j, b \cdot t\right), i, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\end{array}
\end{array}
if c < -5400 or 1.05e161 < c Initial program 63.3%
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-*.f6473.2
Applied rewrites73.2%
if -5400 < c < 1.05e161Initial program 80.6%
Taylor expanded in c around 0
Applied rewrites75.0%
Final simplification74.3%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= a -2.2e+52)
(* (* (- j (/ (* x t) c)) c) a)
(if (<= a 2.45e+39)
(fma (fma (- i) j (* z x)) y (* (* i t) b))
(if (<= a 1.5e+175)
(fma (* j a) c (* (fma (- a) t (* z y)) x))
(* (* (fma (- t) (/ x c) j) c) a)))))
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.2e+52) {
tmp = ((j - ((x * t) / c)) * c) * a;
} else if (a <= 2.45e+39) {
tmp = fma(fma(-i, j, (z * x)), y, ((i * t) * b));
} else if (a <= 1.5e+175) {
tmp = fma((j * a), c, (fma(-a, t, (z * y)) * x));
} else {
tmp = (fma(-t, (x / c), j) * c) * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (a <= -2.2e+52) tmp = Float64(Float64(Float64(j - Float64(Float64(x * t) / c)) * c) * a); elseif (a <= 2.45e+39) tmp = fma(fma(Float64(-i), j, Float64(z * x)), y, Float64(Float64(i * t) * b)); elseif (a <= 1.5e+175) tmp = fma(Float64(j * a), c, Float64(fma(Float64(-a), t, Float64(z * y)) * x)); else tmp = Float64(Float64(fma(Float64(-t), Float64(x / c), j) * c) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[a, -2.2e+52], N[(N[(N[(j - N[(N[(x * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[a, 2.45e+39], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y + N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.5e+175], N[(N[(j * a), $MachinePrecision] * c + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-t) * N[(x / c), $MachinePrecision] + j), $MachinePrecision] * c), $MachinePrecision] * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.2 \cdot 10^{+52}:\\
\;\;\;\;\left(\left(j - \frac{x \cdot t}{c}\right) \cdot c\right) \cdot a\\
\mathbf{elif}\;a \leq 2.45 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, j, z \cdot x\right), y, \left(i \cdot t\right) \cdot b\right)\\
\mathbf{elif}\;a \leq 1.5 \cdot 10^{+175}:\\
\;\;\;\;\mathsf{fma}\left(j \cdot a, c, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-t, \frac{x}{c}, j\right) \cdot c\right) \cdot a\\
\end{array}
\end{array}
if a < -2.2e52Initial program 66.1%
Taylor expanded in a 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-*.f6482.3
Applied rewrites82.3%
Taylor expanded in c around inf
Applied rewrites84.3%
if -2.2e52 < a < 2.44999999999999994e39Initial program 83.2%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6483.3
Applied rewrites83.3%
Taylor expanded in c around 0
Applied rewrites69.4%
Taylor expanded in a around 0
Applied rewrites66.0%
if 2.44999999999999994e39 < a < 1.5000000000000001e175Initial program 60.2%
Taylor expanded in i around 0
Applied rewrites70.0%
Taylor expanded in z around 0
Applied rewrites73.4%
if 1.5000000000000001e175 < a Initial program 63.3%
Taylor expanded in a 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-*.f6473.6
Applied rewrites73.6%
Taylor expanded in x around inf
Applied rewrites33.6%
Taylor expanded in c around inf
Applied rewrites73.7%
Final simplification71.6%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- b) c (* y x)) z)))
(if (<= z -1.06e+96)
t_1
(if (<= z 1.7e-121)
(* (fma (- a) x (* i b)) t)
(if (<= z 5.8e+31)
(* (- i) (* j y))
(if (<= z 7.8e+170) (* (* j c) a) 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.06e+96) {
tmp = t_1;
} else if (z <= 1.7e-121) {
tmp = fma(-a, x, (i * b)) * t;
} else if (z <= 5.8e+31) {
tmp = -i * (j * y);
} else if (z <= 7.8e+170) {
tmp = (j * c) * a;
} 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 <= -1.06e+96) tmp = t_1; elseif (z <= 1.7e-121) tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); elseif (z <= 5.8e+31) tmp = Float64(Float64(-i) * Float64(j * y)); elseif (z <= 7.8e+170) tmp = Float64(Float64(j * c) * a); 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, -1.06e+96], t$95$1, If[LessEqual[z, 1.7e-121], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 5.8e+31], N[((-i) * N[(j * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e+170], N[(N[(j * c), $MachinePrecision] * a), $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 -1.06 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+31}:\\
\;\;\;\;\left(-i\right) \cdot \left(j \cdot y\right)\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+170}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.06e96 or 7.8000000000000005e170 < z Initial program 68.1%
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-*.f6468.3
Applied rewrites68.3%
if -1.06e96 < z < 1.70000000000000001e-121Initial program 81.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-*.f6444.4
Applied rewrites44.4%
if 1.70000000000000001e-121 < z < 5.8000000000000001e31Initial program 79.1%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6479.1
Applied rewrites79.1%
Taylor expanded in c around 0
Applied rewrites68.5%
Taylor expanded in j around inf
Applied rewrites47.4%
if 5.8000000000000001e31 < z < 7.8000000000000005e170Initial program 47.8%
Taylor expanded in a 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-*.f6462.7
Applied rewrites62.7%
Taylor expanded in x around 0
Applied rewrites53.5%
Final simplification53.0%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -1.8e-5) (not (<= a 7.5e+26))) (* (* (- j (/ (* x t) c)) c) a) (* (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 ((a <= -1.8e-5) || !(a <= 7.5e+26)) {
tmp = ((j - ((x * t) / c)) * c) * a;
} else {
tmp = fma(-j, i, (z * x)) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -1.8e-5) || !(a <= 7.5e+26)) tmp = Float64(Float64(Float64(j - Float64(Float64(x * t) / c)) * c) * a); else tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -1.8e-5], N[Not[LessEqual[a, 7.5e+26]], $MachinePrecision]], N[(N[(N[(j - N[(N[(x * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * a), $MachinePrecision], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.8 \cdot 10^{-5} \lor \neg \left(a \leq 7.5 \cdot 10^{+26}\right):\\
\;\;\;\;\left(\left(j - \frac{x \cdot t}{c}\right) \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if a < -1.80000000000000005e-5 or 7.49999999999999941e26 < a Initial program 65.7%
Taylor expanded in a 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-*.f6471.4
Applied rewrites71.4%
Taylor expanded in c around inf
Applied rewrites72.2%
if -1.80000000000000005e-5 < a < 7.49999999999999941e26Initial program 82.7%
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-*.f6452.4
Applied rewrites52.4%
Final simplification62.4%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= a -1.8e-5)
(* (* (- j (/ (* x t) c)) c) a)
(if (<= a 7.2e+26)
(* (fma (- j) i (* z x)) y)
(* (* (fma (- t) (/ x c) j) c) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (a <= -1.8e-5) {
tmp = ((j - ((x * t) / c)) * c) * a;
} else if (a <= 7.2e+26) {
tmp = fma(-j, i, (z * x)) * y;
} else {
tmp = (fma(-t, (x / c), j) * c) * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (a <= -1.8e-5) tmp = Float64(Float64(Float64(j - Float64(Float64(x * t) / c)) * c) * a); elseif (a <= 7.2e+26) tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); else tmp = Float64(Float64(fma(Float64(-t), Float64(x / c), j) * c) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[a, -1.8e-5], N[(N[(N[(j - N[(N[(x * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[a, 7.2e+26], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[((-t) * N[(x / c), $MachinePrecision] + j), $MachinePrecision] * c), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.8 \cdot 10^{-5}:\\
\;\;\;\;\left(\left(j - \frac{x \cdot t}{c}\right) \cdot c\right) \cdot a\\
\mathbf{elif}\;a \leq 7.2 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-t, \frac{x}{c}, j\right) \cdot c\right) \cdot a\\
\end{array}
\end{array}
if a < -1.80000000000000005e-5Initial program 68.5%
Taylor expanded in a 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-*.f6479.4
Applied rewrites79.4%
Taylor expanded in c around inf
Applied rewrites81.1%
if -1.80000000000000005e-5 < a < 7.20000000000000048e26Initial program 82.7%
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-*.f6452.4
Applied rewrites52.4%
if 7.20000000000000048e26 < a Initial program 63.5%
Taylor expanded in a 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-*.f6465.4
Applied rewrites65.4%
Taylor expanded in x around inf
Applied rewrites30.2%
Taylor expanded in c around inf
Applied rewrites65.9%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= c -9.3e-70)
(* (* j c) a)
(if (<= c -6e-169)
(* (* y x) z)
(if (<= c 2.3e-265)
(* (- i) (* j y))
(if (<= c 8.5e+67) (* (* z y) x) (* (* (- c) z) b))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (c <= -9.3e-70) {
tmp = (j * c) * a;
} else if (c <= -6e-169) {
tmp = (y * x) * z;
} else if (c <= 2.3e-265) {
tmp = -i * (j * y);
} else if (c <= 8.5e+67) {
tmp = (z * y) * x;
} else {
tmp = (-c * z) * b;
}
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 (c <= (-9.3d-70)) then
tmp = (j * c) * a
else if (c <= (-6d-169)) then
tmp = (y * x) * z
else if (c <= 2.3d-265) then
tmp = -i * (j * y)
else if (c <= 8.5d+67) then
tmp = (z * y) * x
else
tmp = (-c * z) * b
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 (c <= -9.3e-70) {
tmp = (j * c) * a;
} else if (c <= -6e-169) {
tmp = (y * x) * z;
} else if (c <= 2.3e-265) {
tmp = -i * (j * y);
} else if (c <= 8.5e+67) {
tmp = (z * y) * x;
} else {
tmp = (-c * z) * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if c <= -9.3e-70: tmp = (j * c) * a elif c <= -6e-169: tmp = (y * x) * z elif c <= 2.3e-265: tmp = -i * (j * y) elif c <= 8.5e+67: tmp = (z * y) * x else: tmp = (-c * z) * b return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (c <= -9.3e-70) tmp = Float64(Float64(j * c) * a); elseif (c <= -6e-169) tmp = Float64(Float64(y * x) * z); elseif (c <= 2.3e-265) tmp = Float64(Float64(-i) * Float64(j * y)); elseif (c <= 8.5e+67) tmp = Float64(Float64(z * y) * x); else tmp = Float64(Float64(Float64(-c) * z) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (c <= -9.3e-70) tmp = (j * c) * a; elseif (c <= -6e-169) tmp = (y * x) * z; elseif (c <= 2.3e-265) tmp = -i * (j * y); elseif (c <= 8.5e+67) tmp = (z * y) * x; else tmp = (-c * z) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[c, -9.3e-70], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[c, -6e-169], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[c, 2.3e-265], N[((-i) * N[(j * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 8.5e+67], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -9.3 \cdot 10^{-70}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{elif}\;c \leq -6 \cdot 10^{-169}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{elif}\;c \leq 2.3 \cdot 10^{-265}:\\
\;\;\;\;\left(-i\right) \cdot \left(j \cdot y\right)\\
\mathbf{elif}\;c \leq 8.5 \cdot 10^{+67}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b\\
\end{array}
\end{array}
if c < -9.3e-70Initial program 71.4%
Taylor expanded in a 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-*.f6451.0
Applied rewrites51.0%
Taylor expanded in x around 0
Applied rewrites43.4%
if -9.3e-70 < c < -5.9999999999999998e-169Initial program 77.8%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6477.8
Applied rewrites77.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
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6455.0
Applied rewrites55.0%
Taylor expanded in x around inf
Applied rewrites54.9%
if -5.9999999999999998e-169 < c < 2.2999999999999999e-265Initial program 85.3%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6485.3
Applied rewrites85.3%
Taylor expanded in c around 0
Applied rewrites82.4%
Taylor expanded in j around inf
Applied rewrites48.3%
if 2.2999999999999999e-265 < c < 8.50000000000000038e67Initial program 83.5%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6483.5
Applied rewrites83.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
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6441.9
Applied rewrites41.9%
Taylor expanded in x around inf
Applied rewrites34.7%
if 8.50000000000000038e67 < c Initial program 53.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/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-*.f6456.7
Applied rewrites56.7%
Taylor expanded in z around inf
Applied rewrites52.2%
Final simplification44.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) x (* i b)) t)))
(if (<= t -1.8e+40)
t_1
(if (<= t 9e-266)
(* (* j c) a)
(if (<= t 1.02e-150) (* (* (- b) z) c) 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, (i * b)) * t;
double tmp;
if (t <= -1.8e+40) {
tmp = t_1;
} else if (t <= 9e-266) {
tmp = (j * c) * a;
} else if (t <= 1.02e-150) {
tmp = (-b * z) * c;
} 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(i * b)) * t) tmp = 0.0 if (t <= -1.8e+40) tmp = t_1; elseif (t <= 9e-266) tmp = Float64(Float64(j * c) * a); elseif (t <= 1.02e-150) tmp = Float64(Float64(Float64(-b) * z) * c); 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[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.8e+40], t$95$1, If[LessEqual[t, 9e-266], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t, 1.02e-150], N[(N[((-b) * z), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\mathbf{if}\;t \leq -1.8 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-266}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{-150}:\\
\;\;\;\;\left(\left(-b\right) \cdot z\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.79999999999999998e40 or 1.0199999999999999e-150 < t Initial program 69.9%
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-*.f6454.9
Applied rewrites54.9%
if -1.79999999999999998e40 < t < 9.0000000000000006e-266Initial program 77.7%
Taylor expanded in a 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-*.f6441.1
Applied rewrites41.1%
Taylor expanded in x around 0
Applied rewrites37.8%
if 9.0000000000000006e-266 < t < 1.0199999999999999e-150Initial program 84.9%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6484.9
Applied rewrites84.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
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6449.7
Applied rewrites49.7%
Taylor expanded in x around 0
Applied rewrites49.1%
Final simplification48.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= c -1.12e+23) (not (<= c 7.8e-6))) (* (fma (- z) b (* j a)) c) (* (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 ((c <= -1.12e+23) || !(c <= 7.8e-6)) {
tmp = fma(-z, b, (j * a)) * c;
} else {
tmp = fma(-j, i, (z * x)) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((c <= -1.12e+23) || !(c <= 7.8e-6)) tmp = Float64(fma(Float64(-z), b, Float64(j * a)) * c); else tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[c, -1.12e+23], N[Not[LessEqual[c, 7.8e-6]], $MachinePrecision]], N[(N[((-z) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.12 \cdot 10^{+23} \lor \neg \left(c \leq 7.8 \cdot 10^{-6}\right):\\
\;\;\;\;\mathsf{fma}\left(-z, b, j \cdot a\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if c < -1.12e23 or 7.7999999999999999e-6 < c Initial program 65.5%
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-*.f6468.4
Applied rewrites68.4%
if -1.12e23 < c < 7.7999999999999999e-6Initial program 82.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-*.f6455.9
Applied rewrites55.9%
Final simplification62.1%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -1.8e-5) (not (<= a 7.5e+26))) (* (fma (- x) t (* j c)) a) (* (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 ((a <= -1.8e-5) || !(a <= 7.5e+26)) {
tmp = fma(-x, t, (j * c)) * a;
} else {
tmp = fma(-j, i, (z * x)) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -1.8e-5) || !(a <= 7.5e+26)) tmp = Float64(fma(Float64(-x), t, Float64(j * c)) * a); else tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -1.8e-5], N[Not[LessEqual[a, 7.5e+26]], $MachinePrecision]], N[(N[((-x) * t + N[(j * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.8 \cdot 10^{-5} \lor \neg \left(a \leq 7.5 \cdot 10^{+26}\right):\\
\;\;\;\;\mathsf{fma}\left(-x, t, j \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if a < -1.80000000000000005e-5 or 7.49999999999999941e26 < a Initial program 65.7%
Taylor expanded in a 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-*.f6471.4
Applied rewrites71.4%
if -1.80000000000000005e-5 < a < 7.49999999999999941e26Initial program 82.7%
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-*.f6452.4
Applied rewrites52.4%
Final simplification62.1%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= t -8e+161) (not (<= t 3.1e-72))) (* (fma (- a) x (* i b)) t) (* (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 ((t <= -8e+161) || !(t <= 3.1e-72)) {
tmp = fma(-a, x, (i * b)) * t;
} else {
tmp = fma(-j, i, (z * x)) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((t <= -8e+161) || !(t <= 3.1e-72)) tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); else tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[t, -8e+161], N[Not[LessEqual[t, 3.1e-72]], $MachinePrecision]], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+161} \lor \neg \left(t \leq 3.1 \cdot 10^{-72}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if t < -8.0000000000000003e161 or 3.0999999999999998e-72 < t Initial program 71.4%
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-*.f6463.6
Applied rewrites63.6%
if -8.0000000000000003e161 < t < 3.0999999999999998e-72Initial program 75.8%
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-*.f6447.8
Applied rewrites47.8%
Final simplification54.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* y x) z)))
(if (<= x -5.2e+156)
t_1
(if (<= x 1.55e-75)
(* (* j c) a)
(if (<= x 4.1e+251) t_1 (* (* (- t) x) a))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (y * x) * z;
double tmp;
if (x <= -5.2e+156) {
tmp = t_1;
} else if (x <= 1.55e-75) {
tmp = (j * c) * a;
} else if (x <= 4.1e+251) {
tmp = t_1;
} else {
tmp = (-t * x) * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, 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 = (y * x) * z
if (x <= (-5.2d+156)) then
tmp = t_1
else if (x <= 1.55d-75) then
tmp = (j * c) * a
else if (x <= 4.1d+251) then
tmp = t_1
else
tmp = (-t * x) * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (y * x) * z;
double tmp;
if (x <= -5.2e+156) {
tmp = t_1;
} else if (x <= 1.55e-75) {
tmp = (j * c) * a;
} else if (x <= 4.1e+251) {
tmp = t_1;
} else {
tmp = (-t * x) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (y * x) * z tmp = 0 if x <= -5.2e+156: tmp = t_1 elif x <= 1.55e-75: tmp = (j * c) * a elif x <= 4.1e+251: tmp = t_1 else: tmp = (-t * x) * a return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(y * x) * z) tmp = 0.0 if (x <= -5.2e+156) tmp = t_1; elseif (x <= 1.55e-75) tmp = Float64(Float64(j * c) * a); elseif (x <= 4.1e+251) tmp = t_1; else tmp = Float64(Float64(Float64(-t) * x) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (y * x) * z; tmp = 0.0; if (x <= -5.2e+156) tmp = t_1; elseif (x <= 1.55e-75) tmp = (j * c) * a; elseif (x <= 4.1e+251) tmp = t_1; else tmp = (-t * x) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -5.2e+156], t$95$1, If[LessEqual[x, 1.55e-75], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[x, 4.1e+251], t$95$1, N[(N[((-t) * x), $MachinePrecision] * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y \cdot x\right) \cdot z\\
\mathbf{if}\;x \leq -5.2 \cdot 10^{+156}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-75}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+251}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-t\right) \cdot x\right) \cdot a\\
\end{array}
\end{array}
if x < -5.20000000000000037e156 or 1.55000000000000003e-75 < x < 4.1000000000000001e251Initial program 77.4%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6477.4
Applied rewrites77.4%
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
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6452.2
Applied rewrites52.2%
Taylor expanded in x around inf
Applied rewrites45.6%
if -5.20000000000000037e156 < x < 1.55000000000000003e-75Initial program 72.4%
Taylor expanded in a 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-*.f6444.2
Applied rewrites44.2%
Taylor expanded in x around 0
Applied rewrites34.6%
if 4.1000000000000001e251 < x Initial program 71.4%
Taylor expanded in a 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-*.f6465.4
Applied rewrites65.4%
Taylor expanded in x around inf
Applied rewrites58.3%
Final simplification39.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* t b) i)))
(if (<= b -1e+103)
t_1
(if (<= b 5.5e-55)
(* (* j c) a)
(if (<= b 1.2e+132) (* (* 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 = (t * b) * i;
double tmp;
if (b <= -1e+103) {
tmp = t_1;
} else if (b <= 5.5e-55) {
tmp = (j * c) * a;
} else if (b <= 1.2e+132) {
tmp = (z * y) * x;
} 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 * b) * i
if (b <= (-1d+103)) then
tmp = t_1
else if (b <= 5.5d-55) then
tmp = (j * c) * a
else if (b <= 1.2d+132) then
tmp = (z * y) * x
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 * b) * i;
double tmp;
if (b <= -1e+103) {
tmp = t_1;
} else if (b <= 5.5e-55) {
tmp = (j * c) * a;
} else if (b <= 1.2e+132) {
tmp = (z * y) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (t * b) * i tmp = 0 if b <= -1e+103: tmp = t_1 elif b <= 5.5e-55: tmp = (j * c) * a elif b <= 1.2e+132: tmp = (z * y) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(t * b) * i) tmp = 0.0 if (b <= -1e+103) tmp = t_1; elseif (b <= 5.5e-55) tmp = Float64(Float64(j * c) * a); elseif (b <= 1.2e+132) tmp = Float64(Float64(z * y) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (t * b) * i; tmp = 0.0; if (b <= -1e+103) tmp = t_1; elseif (b <= 5.5e-55) tmp = (j * c) * a; elseif (b <= 1.2e+132) tmp = (z * y) * x; 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 * b), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[b, -1e+103], t$95$1, If[LessEqual[b, 5.5e-55], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[b, 1.2e+132], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t \cdot b\right) \cdot i\\
\mathbf{if}\;b \leq -1 \cdot 10^{+103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 5.5 \cdot 10^{-55}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{+132}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1e103 or 1.2000000000000001e132 < b Initial program 71.9%
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.6
Applied rewrites47.6%
Taylor expanded in x around 0
Applied rewrites44.2%
if -1e103 < b < 5.4999999999999999e-55Initial program 73.5%
Taylor expanded in a 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-*.f6453.6
Applied rewrites53.6%
Taylor expanded in x around 0
Applied rewrites37.3%
if 5.4999999999999999e-55 < b < 1.2000000000000001e132Initial program 80.1%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6480.1
Applied rewrites80.1%
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
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6449.1
Applied rewrites49.1%
Taylor expanded in x around inf
Applied rewrites39.4%
Final simplification39.5%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= c -9.3e-70) (* (* j c) a) (if (<= c 2.35e+48) (* (* y x) z) (* (* (- c) z) b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (c <= -9.3e-70) {
tmp = (j * c) * a;
} else if (c <= 2.35e+48) {
tmp = (y * x) * z;
} else {
tmp = (-c * z) * b;
}
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 (c <= (-9.3d-70)) then
tmp = (j * c) * a
else if (c <= 2.35d+48) then
tmp = (y * x) * z
else
tmp = (-c * z) * b
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 (c <= -9.3e-70) {
tmp = (j * c) * a;
} else if (c <= 2.35e+48) {
tmp = (y * x) * z;
} else {
tmp = (-c * z) * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if c <= -9.3e-70: tmp = (j * c) * a elif c <= 2.35e+48: tmp = (y * x) * z else: tmp = (-c * z) * b return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (c <= -9.3e-70) tmp = Float64(Float64(j * c) * a); elseif (c <= 2.35e+48) tmp = Float64(Float64(y * x) * z); else tmp = Float64(Float64(Float64(-c) * z) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (c <= -9.3e-70) tmp = (j * c) * a; elseif (c <= 2.35e+48) tmp = (y * x) * z; else tmp = (-c * z) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[c, -9.3e-70], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[c, 2.35e+48], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -9.3 \cdot 10^{-70}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{elif}\;c \leq 2.35 \cdot 10^{+48}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b\\
\end{array}
\end{array}
if c < -9.3e-70Initial program 71.4%
Taylor expanded in a 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-*.f6451.0
Applied rewrites51.0%
Taylor expanded in x around 0
Applied rewrites43.4%
if -9.3e-70 < c < 2.35000000000000006e48Initial program 83.2%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6483.3
Applied rewrites83.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
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6437.4
Applied rewrites37.4%
Taylor expanded in x around inf
Applied rewrites33.2%
if 2.35000000000000006e48 < c Initial program 55.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/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-*.f6456.4
Applied rewrites56.4%
Taylor expanded in z around inf
Applied rewrites52.1%
Final simplification40.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= b -1e+103) (not (<= b 3.2e+72))) (* (* t b) i) (* (* j c) a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((b <= -1e+103) || !(b <= 3.2e+72)) {
tmp = (t * b) * i;
} else {
tmp = (j * c) * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, 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 <= (-1d+103)) .or. (.not. (b <= 3.2d+72))) then
tmp = (t * b) * i
else
tmp = (j * c) * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((b <= -1e+103) || !(b <= 3.2e+72)) {
tmp = (t * b) * i;
} else {
tmp = (j * c) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (b <= -1e+103) or not (b <= 3.2e+72): tmp = (t * b) * i else: tmp = (j * c) * a return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((b <= -1e+103) || !(b <= 3.2e+72)) tmp = Float64(Float64(t * b) * i); else tmp = Float64(Float64(j * c) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((b <= -1e+103) || ~((b <= 3.2e+72))) tmp = (t * b) * i; else tmp = (j * c) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[b, -1e+103], N[Not[LessEqual[b, 3.2e+72]], $MachinePrecision]], N[(N[(t * b), $MachinePrecision] * i), $MachinePrecision], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+103} \lor \neg \left(b \leq 3.2 \cdot 10^{+72}\right):\\
\;\;\;\;\left(t \cdot b\right) \cdot i\\
\mathbf{else}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\end{array}
\end{array}
if b < -1e103 or 3.2000000000000001e72 < b Initial program 72.7%
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 rewrites41.3%
if -1e103 < b < 3.2000000000000001e72Initial program 74.7%
Taylor expanded in a 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-*.f6450.7
Applied rewrites50.7%
Taylor expanded in x around 0
Applied rewrites34.6%
Final simplification36.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= x -5.2e+156) (* (* y x) z) (if (<= x 1.55e-75) (* (* j c) a) (* (* z y) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -5.2e+156) {
tmp = (y * x) * z;
} else if (x <= 1.55e-75) {
tmp = (j * c) * a;
} else {
tmp = (z * y) * 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 (x <= (-5.2d+156)) then
tmp = (y * x) * z
else if (x <= 1.55d-75) then
tmp = (j * c) * a
else
tmp = (z * y) * 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 (x <= -5.2e+156) {
tmp = (y * x) * z;
} else if (x <= 1.55e-75) {
tmp = (j * c) * a;
} else {
tmp = (z * y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if x <= -5.2e+156: tmp = (y * x) * z elif x <= 1.55e-75: tmp = (j * c) * a else: tmp = (z * y) * x return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -5.2e+156) tmp = Float64(Float64(y * x) * z); elseif (x <= 1.55e-75) tmp = Float64(Float64(j * c) * a); else tmp = Float64(Float64(z * y) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (x <= -5.2e+156) tmp = (y * x) * z; elseif (x <= 1.55e-75) tmp = (j * c) * a; else tmp = (z * y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -5.2e+156], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, 1.55e-75], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+156}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-75}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if x < -5.20000000000000037e156Initial program 77.4%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6477.4
Applied rewrites77.4%
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
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6452.8
Applied rewrites52.8%
Taylor expanded in x around inf
Applied rewrites49.6%
if -5.20000000000000037e156 < x < 1.55000000000000003e-75Initial program 72.4%
Taylor expanded in a 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-*.f6444.2
Applied rewrites44.2%
Taylor expanded in x around 0
Applied rewrites34.6%
if 1.55000000000000003e-75 < x Initial program 76.2%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6476.2
Applied rewrites76.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
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6448.3
Applied rewrites48.3%
Taylor expanded in x around inf
Applied rewrites40.2%
Final simplification38.0%
(FPCore (x y z t a b c i j) :precision binary64 (* (* t b) i))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (t * b) * 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 = (t * b) * 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 (t * b) * i;
}
def code(x, y, z, t, a, b, c, i, j): return (t * b) * i
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(t * b) * i) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (t * b) * i; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(t * b), $MachinePrecision] * i), $MachinePrecision]
\begin{array}{l}
\\
\left(t \cdot b\right) \cdot i
\end{array}
Initial program 74.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-*.f6436.9
Applied rewrites36.9%
Taylor expanded in x around 0
Applied rewrites20.0%
(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 2025008
(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)))))