
(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}
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))) (* b (- (* c z) (* t i))))
(* j (- (* c a) (* y i))))))
(if (<= t_1 INFINITY) t_1 (fma (* j c) a (* z (fma (- b) c (* x y)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma((j * c), a, (z * fma(-b, c, (x * y))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(Float64(j * c), a, Float64(z * fma(Float64(-b), c, Float64(x * y)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(j * c), $MachinePrecision] * a + N[(z * N[((-b) * c + N[(x * y), $MachinePrecision]), $MachinePrecision]), $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 - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(j \cdot c, a, z \cdot \mathsf{fma}\left(-b, c, x \cdot y\right)\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < +inf.0Initial program 91.1%
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 i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites32.8%
Taylor expanded in z around inf
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-outN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6446.7
Applied rewrites46.7%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -2.1e+176)
(* (fma (- a) t (* z y)) x)
(if (<= x 2.8e+47)
(fma (fma (- i) y (* c a)) j (* (- b) (fma (- i) t (* c z))))
(fma (* j c) a (* z (fma (- b) c (* 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 (x <= -2.1e+176) {
tmp = fma(-a, t, (z * y)) * x;
} else if (x <= 2.8e+47) {
tmp = fma(fma(-i, y, (c * a)), j, (-b * fma(-i, t, (c * z))));
} else {
tmp = fma((j * c), a, (z * fma(-b, c, (x * y))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -2.1e+176) tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); elseif (x <= 2.8e+47) tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, Float64(Float64(-b) * fma(Float64(-i), t, Float64(c * z)))); else tmp = fma(Float64(j * c), a, Float64(z * fma(Float64(-b), c, Float64(x * y)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -2.1e+176], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 2.8e+47], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[((-b) * N[((-i) * t + N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(j * c), $MachinePrecision] * a + N[(z * N[((-b) * c + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+176}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, \left(-b\right) \cdot \mathsf{fma}\left(-i, t, c \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(j \cdot c, a, z \cdot \mathsf{fma}\left(-b, c, x \cdot y\right)\right)\\
\end{array}
\end{array}
if x < -2.0999999999999999e176Initial program 73.9%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/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-*.f6472.2
Applied rewrites72.2%
if -2.0999999999999999e176 < x < 2.79999999999999988e47Initial program 74.2%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites68.8%
if 2.79999999999999988e47 < x Initial program 73.8%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites75.7%
Taylor expanded in z around inf
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-outN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6451.1
Applied rewrites51.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma j a (* (- b) z)) c)))
(if (<= c -1.45e-43)
t_1
(if (<= c 6.2e-293)
(* i (fma (- j) y (* b t)))
(if (<= c 4.5e-199)
(* (fma (- a) t (* z y)) x)
(if (<= c 1.85e-30) (* t (fma (- a) x (* b 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(j, a, (-b * z)) * c;
double tmp;
if (c <= -1.45e-43) {
tmp = t_1;
} else if (c <= 6.2e-293) {
tmp = i * fma(-j, y, (b * t));
} else if (c <= 4.5e-199) {
tmp = fma(-a, t, (z * y)) * x;
} else if (c <= 1.85e-30) {
tmp = t * fma(-a, x, (b * i));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(j, a, Float64(Float64(-b) * z)) * c) tmp = 0.0 if (c <= -1.45e-43) tmp = t_1; elseif (c <= 6.2e-293) tmp = Float64(i * fma(Float64(-j), y, Float64(b * t))); elseif (c <= 4.5e-199) tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); elseif (c <= 1.85e-30) tmp = Float64(t * fma(Float64(-a), x, Float64(b * i))); 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 * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[c, -1.45e-43], t$95$1, If[LessEqual[c, 6.2e-293], N[(i * N[((-j) * y + N[(b * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 4.5e-199], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[c, 1.85e-30], N[(t * N[((-a) * x + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{if}\;c \leq -1.45 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq 6.2 \cdot 10^{-293}:\\
\;\;\;\;i \cdot \mathsf{fma}\left(-j, y, b \cdot t\right)\\
\mathbf{elif}\;c \leq 4.5 \cdot 10^{-199}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{elif}\;c \leq 1.85 \cdot 10^{-30}:\\
\;\;\;\;t \cdot \mathsf{fma}\left(-a, x, b \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -1.4500000000000001e-43 or 1.8500000000000002e-30 < c Initial program 68.4%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6457.0
Applied rewrites57.0%
if -1.4500000000000001e-43 < c < 6.19999999999999965e-293Initial program 81.4%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites83.6%
Taylor expanded in i around inf
mul-1-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6446.8
Applied rewrites46.8%
if 6.19999999999999965e-293 < c < 4.49999999999999998e-199Initial program 81.5%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/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-*.f6446.3
Applied rewrites46.3%
if 4.49999999999999998e-199 < c < 1.8500000000000002e-30Initial program 80.6%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites81.9%
Taylor expanded in t around inf
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
fp-cancel-sign-sub-invN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6446.1
Applied rewrites46.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (* j c) a (* t (fma (- a) x (* b i))))))
(if (<= t -1.2e-42)
t_1
(if (<= t 0.0037) (fma (* j c) a (* z (fma (- b) c (* x y)))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma((j * c), a, (t * fma(-a, x, (b * i))));
double tmp;
if (t <= -1.2e-42) {
tmp = t_1;
} else if (t <= 0.0037) {
tmp = fma((j * c), a, (z * fma(-b, c, (x * y))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(j * c), a, Float64(t * fma(Float64(-a), x, Float64(b * i)))) tmp = 0.0 if (t <= -1.2e-42) tmp = t_1; elseif (t <= 0.0037) tmp = fma(Float64(j * c), a, Float64(z * fma(Float64(-b), c, Float64(x * y)))); 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 * c), $MachinePrecision] * a + N[(t * N[((-a) * x + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.2e-42], t$95$1, If[LessEqual[t, 0.0037], N[(N[(j * c), $MachinePrecision] * a + N[(z * N[((-b) * c + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(j \cdot c, a, t \cdot \mathsf{fma}\left(-a, x, b \cdot i\right)\right)\\
\mathbf{if}\;t \leq -1.2 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.0037:\\
\;\;\;\;\mathsf{fma}\left(j \cdot c, a, z \cdot \mathsf{fma}\left(-b, c, x \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.20000000000000001e-42 or 0.0037000000000000002 < t Initial program 68.3%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites69.2%
Taylor expanded in t around inf
fp-cancel-sign-sub-invN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
fp-cancel-sign-sub-invN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6465.9
Applied rewrites65.9%
if -1.20000000000000001e-42 < t < 0.0037000000000000002Initial program 80.9%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites80.9%
Taylor expanded in z around inf
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-outN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6461.3
Applied rewrites61.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) j (* z x)) y)))
(if (<= y -1.02e+121)
t_1
(if (<= y 1.16e-50)
(fma (* j c) a (* t (fma (- a) x (* b i))))
(if (<= y 1e+19) (* (fma j a (* (- 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(-i, j, (z * x)) * y;
double tmp;
if (y <= -1.02e+121) {
tmp = t_1;
} else if (y <= 1.16e-50) {
tmp = fma((j * c), a, (t * fma(-a, x, (b * i))));
} else if (y <= 1e+19) {
tmp = fma(j, a, (-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(-i), j, Float64(z * x)) * y) tmp = 0.0 if (y <= -1.02e+121) tmp = t_1; elseif (y <= 1.16e-50) tmp = fma(Float64(j * c), a, Float64(t * fma(Float64(-a), x, Float64(b * i)))); elseif (y <= 1e+19) tmp = Float64(fma(j, a, 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[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -1.02e+121], t$95$1, If[LessEqual[y, 1.16e-50], N[(N[(j * c), $MachinePrecision] * a + N[(t * N[((-a) * x + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+19], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{if}\;y \leq -1.02 \cdot 10^{+121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(j \cdot c, a, t \cdot \mathsf{fma}\left(-a, x, b \cdot i\right)\right)\\
\mathbf{elif}\;y \leq 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.02000000000000005e121 or 1e19 < y Initial program 64.6%
Taylor expanded in y 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.1
Applied rewrites62.1%
if -1.02000000000000005e121 < y < 1.15999999999999989e-50Initial program 79.9%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites80.3%
Taylor expanded in t around inf
fp-cancel-sign-sub-invN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
fp-cancel-sign-sub-invN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6459.9
Applied rewrites59.9%
if 1.15999999999999989e-50 < y < 1e19Initial program 79.9%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6439.8
Applied rewrites39.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* i (* b t))))
(if (<= x -3.7e+181)
(* (- a) (* t x))
(if (<= x -6.6e+126)
(* x (* y z))
(if (<= x -5.7e-233)
t_1
(if (<= x 2.8e-91)
(* a (* c j))
(if (<= x 2.3e+47) t_1 (* (* x z) y))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = i * (b * t);
double tmp;
if (x <= -3.7e+181) {
tmp = -a * (t * x);
} else if (x <= -6.6e+126) {
tmp = x * (y * z);
} else if (x <= -5.7e-233) {
tmp = t_1;
} else if (x <= 2.8e-91) {
tmp = a * (c * j);
} else if (x <= 2.3e+47) {
tmp = t_1;
} else {
tmp = (x * z) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = i * (b * t)
if (x <= (-3.7d+181)) then
tmp = -a * (t * x)
else if (x <= (-6.6d+126)) then
tmp = x * (y * z)
else if (x <= (-5.7d-233)) then
tmp = t_1
else if (x <= 2.8d-91) then
tmp = a * (c * j)
else if (x <= 2.3d+47) then
tmp = t_1
else
tmp = (x * z) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = i * (b * t);
double tmp;
if (x <= -3.7e+181) {
tmp = -a * (t * x);
} else if (x <= -6.6e+126) {
tmp = x * (y * z);
} else if (x <= -5.7e-233) {
tmp = t_1;
} else if (x <= 2.8e-91) {
tmp = a * (c * j);
} else if (x <= 2.3e+47) {
tmp = t_1;
} else {
tmp = (x * z) * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = i * (b * t) tmp = 0 if x <= -3.7e+181: tmp = -a * (t * x) elif x <= -6.6e+126: tmp = x * (y * z) elif x <= -5.7e-233: tmp = t_1 elif x <= 2.8e-91: tmp = a * (c * j) elif x <= 2.3e+47: tmp = t_1 else: tmp = (x * z) * y return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(i * Float64(b * t)) tmp = 0.0 if (x <= -3.7e+181) tmp = Float64(Float64(-a) * Float64(t * x)); elseif (x <= -6.6e+126) tmp = Float64(x * Float64(y * z)); elseif (x <= -5.7e-233) tmp = t_1; elseif (x <= 2.8e-91) tmp = Float64(a * Float64(c * j)); elseif (x <= 2.3e+47) tmp = t_1; else tmp = Float64(Float64(x * z) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = i * (b * t); tmp = 0.0; if (x <= -3.7e+181) tmp = -a * (t * x); elseif (x <= -6.6e+126) tmp = x * (y * z); elseif (x <= -5.7e-233) tmp = t_1; elseif (x <= 2.8e-91) tmp = a * (c * j); elseif (x <= 2.3e+47) tmp = t_1; else tmp = (x * z) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(i * N[(b * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.7e+181], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.6e+126], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.7e-233], t$95$1, If[LessEqual[x, 2.8e-91], N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e+47], t$95$1, N[(N[(x * z), $MachinePrecision] * y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := i \cdot \left(b \cdot t\right)\\
\mathbf{if}\;x \leq -3.7 \cdot 10^{+181}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;x \leq -6.6 \cdot 10^{+126}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;x \leq -5.7 \cdot 10^{-233}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-91}:\\
\;\;\;\;a \cdot \left(c \cdot j\right)\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot z\right) \cdot y\\
\end{array}
\end{array}
if x < -3.7000000000000004e181Initial program 73.9%
Taylor expanded in t around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6454.6
Applied rewrites54.6%
Taylor expanded in x around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f64N/A
lower-*.f6444.1
Applied rewrites44.1%
if -3.7000000000000004e181 < x < -6.60000000000000026e126Initial program 72.9%
Taylor expanded in y 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.3
Applied rewrites43.3%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6430.3
Applied rewrites30.3%
if -6.60000000000000026e126 < x < -5.70000000000000037e-233 or 2.8e-91 < x < 2.2999999999999999e47Initial program 75.7%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites75.4%
Taylor expanded in i around inf
mul-1-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6442.6
Applied rewrites42.6%
Taylor expanded in y around 0
lift-*.f6423.8
Applied rewrites23.8%
if -5.70000000000000037e-233 < x < 2.8e-91Initial program 71.9%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6448.6
Applied rewrites48.6%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6428.5
Applied rewrites28.5%
if 2.2999999999999999e47 < x Initial program 73.8%
Taylor expanded in y 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-*.f6444.8
Applied rewrites44.8%
Taylor expanded in x around inf
lower-*.f6434.7
Applied rewrites34.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma i t (* (- c) z)) b)))
(if (<= b -1.4e-85)
t_1
(if (<= b -3.9e-202)
(* (fma (- a) t (* z y)) x)
(if (<= b 5.8e+86) (* (fma (- t) x (* 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(i, t, (-c * z)) * b;
double tmp;
if (b <= -1.4e-85) {
tmp = t_1;
} else if (b <= -3.9e-202) {
tmp = fma(-a, t, (z * y)) * x;
} else if (b <= 5.8e+86) {
tmp = fma(-t, x, (j * c)) * a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(i, t, Float64(Float64(-c) * z)) * b) tmp = 0.0 if (b <= -1.4e-85) tmp = t_1; elseif (b <= -3.9e-202) tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); elseif (b <= 5.8e+86) tmp = Float64(fma(Float64(-t), x, 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[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -1.4e-85], t$95$1, If[LessEqual[b, -3.9e-202], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[b, 5.8e+86], N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{if}\;b \leq -1.4 \cdot 10^{-85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -3.9 \cdot 10^{-202}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.40000000000000008e-85 or 5.79999999999999981e86 < b Initial program 73.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6458.1
Applied rewrites58.1%
if -1.40000000000000008e-85 < b < -3.8999999999999999e-202Initial program 72.0%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/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-*.f6444.3
Applied rewrites44.3%
if -3.8999999999999999e-202 < b < 5.79999999999999981e86Initial program 75.4%
Taylor expanded in a 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-*.f6446.8
Applied rewrites46.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) j (* z x)) y)))
(if (<= y -7.5e+120)
t_1
(if (<= y -3.6e-74)
(* t (fma (- a) x (* b i)))
(if (<= y 1e+19) (* (fma j a (* (- 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(-i, j, (z * x)) * y;
double tmp;
if (y <= -7.5e+120) {
tmp = t_1;
} else if (y <= -3.6e-74) {
tmp = t * fma(-a, x, (b * i));
} else if (y <= 1e+19) {
tmp = fma(j, a, (-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(-i), j, Float64(z * x)) * y) tmp = 0.0 if (y <= -7.5e+120) tmp = t_1; elseif (y <= -3.6e-74) tmp = Float64(t * fma(Float64(-a), x, Float64(b * i))); elseif (y <= 1e+19) tmp = Float64(fma(j, a, 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[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -7.5e+120], t$95$1, If[LessEqual[y, -3.6e-74], N[(t * N[((-a) * x + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+19], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-74}:\\
\;\;\;\;t \cdot \mathsf{fma}\left(-a, x, b \cdot i\right)\\
\mathbf{elif}\;y \leq 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.5000000000000006e120 or 1e19 < y Initial program 64.6%
Taylor expanded in y 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.1
Applied rewrites62.1%
if -7.5000000000000006e120 < y < -3.6000000000000002e-74Initial program 75.0%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites76.7%
Taylor expanded in t around inf
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
fp-cancel-sign-sub-invN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6439.0
Applied rewrites39.0%
if -3.6000000000000002e-74 < y < 1e19Initial program 81.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6447.2
Applied rewrites47.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma j a (* (- b) z)) c)))
(if (<= c -1.45e-43)
t_1
(if (<= c -1.85e-113)
(* i (fma (- j) y (* b t)))
(if (<= c 1.85e-30) (* t (fma (- a) x (* b 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(j, a, (-b * z)) * c;
double tmp;
if (c <= -1.45e-43) {
tmp = t_1;
} else if (c <= -1.85e-113) {
tmp = i * fma(-j, y, (b * t));
} else if (c <= 1.85e-30) {
tmp = t * fma(-a, x, (b * i));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(j, a, Float64(Float64(-b) * z)) * c) tmp = 0.0 if (c <= -1.45e-43) tmp = t_1; elseif (c <= -1.85e-113) tmp = Float64(i * fma(Float64(-j), y, Float64(b * t))); elseif (c <= 1.85e-30) tmp = Float64(t * fma(Float64(-a), x, Float64(b * i))); 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 * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[c, -1.45e-43], t$95$1, If[LessEqual[c, -1.85e-113], N[(i * N[((-j) * y + N[(b * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.85e-30], N[(t * N[((-a) * x + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{if}\;c \leq -1.45 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -1.85 \cdot 10^{-113}:\\
\;\;\;\;i \cdot \mathsf{fma}\left(-j, y, b \cdot t\right)\\
\mathbf{elif}\;c \leq 1.85 \cdot 10^{-30}:\\
\;\;\;\;t \cdot \mathsf{fma}\left(-a, x, b \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -1.4500000000000001e-43 or 1.8500000000000002e-30 < c Initial program 68.4%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6457.0
Applied rewrites57.0%
if -1.4500000000000001e-43 < c < -1.8499999999999999e-113Initial program 79.0%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites79.9%
Taylor expanded in i around inf
mul-1-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6441.0
Applied rewrites41.0%
if -1.8499999999999999e-113 < c < 1.8500000000000002e-30Initial program 81.5%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites83.5%
Taylor expanded in t around inf
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
fp-cancel-sign-sub-invN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6447.2
Applied rewrites47.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* t (fma (- a) x (* b i)))))
(if (<= t -9e-35)
t_1
(if (<= t 0.0048)
(* (fma x y (* (- b) c)) z)
(if (<= t 5.2e+126) (* (fma i t (* (- c) z)) b) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = t * fma(-a, x, (b * i));
double tmp;
if (t <= -9e-35) {
tmp = t_1;
} else if (t <= 0.0048) {
tmp = fma(x, y, (-b * c)) * z;
} else if (t <= 5.2e+126) {
tmp = fma(i, t, (-c * z)) * b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(t * fma(Float64(-a), x, Float64(b * i))) tmp = 0.0 if (t <= -9e-35) tmp = t_1; elseif (t <= 0.0048) tmp = Float64(fma(x, y, Float64(Float64(-b) * c)) * z); elseif (t <= 5.2e+126) tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(t * N[((-a) * x + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9e-35], t$95$1, If[LessEqual[t, 0.0048], N[(N[(x * y + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t, 5.2e+126], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \mathsf{fma}\left(-a, x, b \cdot i\right)\\
\mathbf{if}\;t \leq -9 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.0048:\\
\;\;\;\;\mathsf{fma}\left(x, y, \left(-b\right) \cdot c\right) \cdot z\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.0000000000000002e-35 or 5.1999999999999999e126 < t Initial program 66.6%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites67.3%
Taylor expanded in t around inf
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
fp-cancel-sign-sub-invN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6461.2
Applied rewrites61.2%
if -9.0000000000000002e-35 < t < 0.00479999999999999958Initial program 80.9%
Taylor expanded in z around inf
Applied rewrites71.2%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6445.6
Applied rewrites45.6%
if 0.00479999999999999958 < t < 5.1999999999999999e126Initial program 74.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6441.8
Applied rewrites41.8%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -3.7e+181)
(* (- a) (* t x))
(if (<= x -9.5e+119)
(* x (* y z))
(if (<= x 8.5e+47) (* i (fma (- j) y (* b t))) (* (* x z) y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -3.7e+181) {
tmp = -a * (t * x);
} else if (x <= -9.5e+119) {
tmp = x * (y * z);
} else if (x <= 8.5e+47) {
tmp = i * fma(-j, y, (b * t));
} else {
tmp = (x * z) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -3.7e+181) tmp = Float64(Float64(-a) * Float64(t * x)); elseif (x <= -9.5e+119) tmp = Float64(x * Float64(y * z)); elseif (x <= 8.5e+47) tmp = Float64(i * fma(Float64(-j), y, Float64(b * t))); else tmp = Float64(Float64(x * z) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -3.7e+181], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.5e+119], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e+47], N[(i * N[((-j) * y + N[(b * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * z), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{+181}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{+119}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+47}:\\
\;\;\;\;i \cdot \mathsf{fma}\left(-j, y, b \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot z\right) \cdot y\\
\end{array}
\end{array}
if x < -3.7000000000000004e181Initial program 73.9%
Taylor expanded in t around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6454.6
Applied rewrites54.6%
Taylor expanded in x around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f64N/A
lower-*.f6444.1
Applied rewrites44.1%
if -3.7000000000000004e181 < x < -9.4999999999999994e119Initial program 73.9%
Taylor expanded in y 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.1
Applied rewrites43.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6430.2
Applied rewrites30.2%
if -9.4999999999999994e119 < x < 8.5000000000000008e47Initial program 74.2%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites74.3%
Taylor expanded in i around inf
mul-1-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6444.2
Applied rewrites44.2%
if 8.5000000000000008e47 < x Initial program 73.8%
Taylor expanded in y 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-*.f6444.9
Applied rewrites44.9%
Taylor expanded in x around inf
lower-*.f6434.8
Applied rewrites34.8%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= y -2.4e+87)
(* (- i) (* j y))
(if (<= y -6.6e-99)
(* (* i t) b)
(if (<= y 5e-28)
(* (* (- c) z) b)
(if (<= y 1.1e+103) (* (* a j) c) (* x (* y z)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (y <= -2.4e+87) {
tmp = -i * (j * y);
} else if (y <= -6.6e-99) {
tmp = (i * t) * b;
} else if (y <= 5e-28) {
tmp = (-c * z) * b;
} else if (y <= 1.1e+103) {
tmp = (a * j) * c;
} else {
tmp = x * (y * z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if (y <= (-2.4d+87)) then
tmp = -i * (j * y)
else if (y <= (-6.6d-99)) then
tmp = (i * t) * b
else if (y <= 5d-28) then
tmp = (-c * z) * b
else if (y <= 1.1d+103) then
tmp = (a * j) * c
else
tmp = x * (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (y <= -2.4e+87) {
tmp = -i * (j * y);
} else if (y <= -6.6e-99) {
tmp = (i * t) * b;
} else if (y <= 5e-28) {
tmp = (-c * z) * b;
} else if (y <= 1.1e+103) {
tmp = (a * j) * c;
} else {
tmp = x * (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if y <= -2.4e+87: tmp = -i * (j * y) elif y <= -6.6e-99: tmp = (i * t) * b elif y <= 5e-28: tmp = (-c * z) * b elif y <= 1.1e+103: tmp = (a * j) * c else: tmp = x * (y * z) return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (y <= -2.4e+87) tmp = Float64(Float64(-i) * Float64(j * y)); elseif (y <= -6.6e-99) tmp = Float64(Float64(i * t) * b); elseif (y <= 5e-28) tmp = Float64(Float64(Float64(-c) * z) * b); elseif (y <= 1.1e+103) tmp = Float64(Float64(a * j) * c); else tmp = Float64(x * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (y <= -2.4e+87) tmp = -i * (j * y); elseif (y <= -6.6e-99) tmp = (i * t) * b; elseif (y <= 5e-28) tmp = (-c * z) * b; elseif (y <= 1.1e+103) tmp = (a * j) * c; else tmp = x * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[y, -2.4e+87], N[((-i) * N[(j * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -6.6e-99], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[y, 5e-28], N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[y, 1.1e+103], N[(N[(a * j), $MachinePrecision] * c), $MachinePrecision], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+87}:\\
\;\;\;\;\left(-i\right) \cdot \left(j \cdot y\right)\\
\mathbf{elif}\;y \leq -6.6 \cdot 10^{-99}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-28}:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+103}:\\
\;\;\;\;\left(a \cdot j\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if y < -2.39999999999999981e87Initial program 61.5%
Taylor expanded in y 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.4
Applied rewrites63.4%
Taylor expanded in x around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-*.f6439.2
Applied rewrites39.2%
if -2.39999999999999981e87 < y < -6.59999999999999973e-99Initial program 77.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6439.4
Applied rewrites39.4%
Taylor expanded in z around 0
lower-*.f6422.8
Applied rewrites22.8%
if -6.59999999999999973e-99 < y < 5.0000000000000002e-28Initial program 81.8%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6446.5
Applied rewrites46.5%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f6425.8
Applied rewrites25.8%
if 5.0000000000000002e-28 < y < 1.09999999999999996e103Initial program 74.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6437.6
Applied rewrites37.6%
Taylor expanded in z around 0
lower-*.f6421.4
Applied rewrites21.4%
if 1.09999999999999996e103 < y Initial program 64.7%
Taylor expanded in y 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-*.f6466.9
Applied rewrites66.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6439.2
Applied rewrites39.2%
(FPCore (x y z t a b c i j) :precision binary64 (let* ((t_1 (* t (fma (- a) x (* b i))))) (if (<= t -9e-35) t_1 (if (<= t 0.0038) (* (fma x y (* (- b) c)) 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 = t * fma(-a, x, (b * i));
double tmp;
if (t <= -9e-35) {
tmp = t_1;
} else if (t <= 0.0038) {
tmp = fma(x, y, (-b * c)) * z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(t * fma(Float64(-a), x, Float64(b * i))) tmp = 0.0 if (t <= -9e-35) tmp = t_1; elseif (t <= 0.0038) tmp = Float64(fma(x, y, Float64(Float64(-b) * c)) * z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(t * N[((-a) * x + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9e-35], t$95$1, If[LessEqual[t, 0.0038], N[(N[(x * y + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \mathsf{fma}\left(-a, x, b \cdot i\right)\\
\mathbf{if}\;t \leq -9 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.0038:\\
\;\;\;\;\mathsf{fma}\left(x, y, \left(-b\right) \cdot c\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.0000000000000002e-35 or 0.00379999999999999999 < t Initial program 68.1%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites69.0%
Taylor expanded in t around inf
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
fp-cancel-sign-sub-invN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6458.2
Applied rewrites58.2%
if -9.0000000000000002e-35 < t < 0.00379999999999999999Initial program 80.9%
Taylor expanded in z around inf
Applied rewrites71.2%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6445.6
Applied rewrites45.6%
(FPCore (x y z t a b c i j) :precision binary64 (let* ((t_1 (* t (fma (- a) x (* b i))))) (if (<= t -9e-35) t_1 (if (<= t 0.0038) (* z (fma (- b) c (* x y))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = t * fma(-a, x, (b * i));
double tmp;
if (t <= -9e-35) {
tmp = t_1;
} else if (t <= 0.0038) {
tmp = z * fma(-b, c, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(t * fma(Float64(-a), x, Float64(b * i))) tmp = 0.0 if (t <= -9e-35) tmp = t_1; elseif (t <= 0.0038) tmp = Float64(z * fma(Float64(-b), c, Float64(x * y))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(t * N[((-a) * x + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9e-35], t$95$1, If[LessEqual[t, 0.0038], N[(z * N[((-b) * c + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \mathsf{fma}\left(-a, x, b \cdot i\right)\\
\mathbf{if}\;t \leq -9 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.0038:\\
\;\;\;\;z \cdot \mathsf{fma}\left(-b, c, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.0000000000000002e-35 or 0.00379999999999999999 < t Initial program 68.1%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites69.0%
Taylor expanded in t around inf
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
fp-cancel-sign-sub-invN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6458.2
Applied rewrites58.2%
if -9.0000000000000002e-35 < t < 0.00379999999999999999Initial program 80.9%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites81.0%
Taylor expanded in z around inf
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-outN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6445.4
Applied rewrites45.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= x -1.12e-98) (* t (fma (- a) x (* b i))) (if (<= x 8.5e+47) (* i (fma (- j) y (* b t))) (* (* x z) y))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -1.12e-98) {
tmp = t * fma(-a, x, (b * i));
} else if (x <= 8.5e+47) {
tmp = i * fma(-j, y, (b * t));
} else {
tmp = (x * z) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -1.12e-98) tmp = Float64(t * fma(Float64(-a), x, Float64(b * i))); elseif (x <= 8.5e+47) tmp = Float64(i * fma(Float64(-j), y, Float64(b * t))); else tmp = Float64(Float64(x * z) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -1.12e-98], N[(t * N[((-a) * x + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e+47], N[(i * N[((-j) * y + N[(b * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * z), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.12 \cdot 10^{-98}:\\
\;\;\;\;t \cdot \mathsf{fma}\left(-a, x, b \cdot i\right)\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+47}:\\
\;\;\;\;i \cdot \mathsf{fma}\left(-j, y, b \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot z\right) \cdot y\\
\end{array}
\end{array}
if x < -1.12e-98Initial program 74.6%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites75.1%
Taylor expanded in t around inf
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
fp-cancel-sign-sub-invN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f6443.6
Applied rewrites43.6%
if -1.12e-98 < x < 8.5000000000000008e47Initial program 73.8%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites73.6%
Taylor expanded in i around inf
mul-1-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6445.6
Applied rewrites45.6%
if 8.5000000000000008e47 < x Initial program 73.8%
Taylor expanded in y 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-*.f6444.9
Applied rewrites44.9%
Taylor expanded in x around inf
lower-*.f6434.8
Applied rewrites34.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* a (* c j))))
(if (<= j -1.45e+146)
(* (- i) (* j y))
(if (<= j -1.28e+78) t_1 (if (<= j 1.65e+25) (* (* x z) y) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = a * (c * j);
double tmp;
if (j <= -1.45e+146) {
tmp = -i * (j * y);
} else if (j <= -1.28e+78) {
tmp = t_1;
} else if (j <= 1.65e+25) {
tmp = (x * z) * y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = a * (c * j)
if (j <= (-1.45d+146)) then
tmp = -i * (j * y)
else if (j <= (-1.28d+78)) then
tmp = t_1
else if (j <= 1.65d+25) then
tmp = (x * z) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = a * (c * j);
double tmp;
if (j <= -1.45e+146) {
tmp = -i * (j * y);
} else if (j <= -1.28e+78) {
tmp = t_1;
} else if (j <= 1.65e+25) {
tmp = (x * z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = a * (c * j) tmp = 0 if j <= -1.45e+146: tmp = -i * (j * y) elif j <= -1.28e+78: tmp = t_1 elif j <= 1.65e+25: tmp = (x * z) * y else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(a * Float64(c * j)) tmp = 0.0 if (j <= -1.45e+146) tmp = Float64(Float64(-i) * Float64(j * y)); elseif (j <= -1.28e+78) tmp = t_1; elseif (j <= 1.65e+25) tmp = Float64(Float64(x * z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = a * (c * j); tmp = 0.0; if (j <= -1.45e+146) tmp = -i * (j * y); elseif (j <= -1.28e+78) tmp = t_1; elseif (j <= 1.65e+25) tmp = (x * z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[j, -1.45e+146], N[((-i) * N[(j * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[j, -1.28e+78], t$95$1, If[LessEqual[j, 1.65e+25], N[(N[(x * z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(c \cdot j\right)\\
\mathbf{if}\;j \leq -1.45 \cdot 10^{+146}:\\
\;\;\;\;\left(-i\right) \cdot \left(j \cdot y\right)\\
\mathbf{elif}\;j \leq -1.28 \cdot 10^{+78}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;j \leq 1.65 \cdot 10^{+25}:\\
\;\;\;\;\left(x \cdot z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if j < -1.4499999999999999e146Initial program 73.9%
Taylor expanded in y 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-*.f6447.2
Applied rewrites47.2%
Taylor expanded in x around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-*.f6440.0
Applied rewrites40.0%
if -1.4499999999999999e146 < j < -1.2800000000000001e78 or 1.6500000000000001e25 < j Initial program 75.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6446.1
Applied rewrites46.1%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6435.5
Applied rewrites35.5%
if -1.2800000000000001e78 < j < 1.6500000000000001e25Initial program 73.4%
Taylor expanded in y 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-*.f6432.6
Applied rewrites32.6%
Taylor expanded in x around inf
lower-*.f6423.7
Applied rewrites23.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* a (* c j))))
(if (<= a -1.55e+60)
t_1
(if (<= a -1.65e-230)
(* i (* b t))
(if (<= a 2.3e+70) (* x (* y 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 = a * (c * j);
double tmp;
if (a <= -1.55e+60) {
tmp = t_1;
} else if (a <= -1.65e-230) {
tmp = i * (b * t);
} else if (a <= 2.3e+70) {
tmp = x * (y * z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, 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 = a * (c * j)
if (a <= (-1.55d+60)) then
tmp = t_1
else if (a <= (-1.65d-230)) then
tmp = i * (b * t)
else if (a <= 2.3d+70) then
tmp = x * (y * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = a * (c * j);
double tmp;
if (a <= -1.55e+60) {
tmp = t_1;
} else if (a <= -1.65e-230) {
tmp = i * (b * t);
} else if (a <= 2.3e+70) {
tmp = x * (y * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = a * (c * j) tmp = 0 if a <= -1.55e+60: tmp = t_1 elif a <= -1.65e-230: tmp = i * (b * t) elif a <= 2.3e+70: tmp = x * (y * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(a * Float64(c * j)) tmp = 0.0 if (a <= -1.55e+60) tmp = t_1; elseif (a <= -1.65e-230) tmp = Float64(i * Float64(b * t)); elseif (a <= 2.3e+70) tmp = Float64(x * Float64(y * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = a * (c * j); tmp = 0.0; if (a <= -1.55e+60) tmp = t_1; elseif (a <= -1.65e-230) tmp = i * (b * t); elseif (a <= 2.3e+70) tmp = x * (y * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.55e+60], t$95$1, If[LessEqual[a, -1.65e-230], N[(i * N[(b * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.3e+70], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(c \cdot j\right)\\
\mathbf{if}\;a \leq -1.55 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1.65 \cdot 10^{-230}:\\
\;\;\;\;i \cdot \left(b \cdot t\right)\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+70}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.55e60 or 2.29999999999999994e70 < a Initial program 65.2%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6448.2
Applied rewrites48.2%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6437.5
Applied rewrites37.5%
if -1.55e60 < a < -1.64999999999999997e-230Initial program 79.6%
Taylor expanded in i around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites75.4%
Taylor expanded in i around inf
mul-1-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6443.6
Applied rewrites43.6%
Taylor expanded in y around 0
lift-*.f6424.3
Applied rewrites24.3%
if -1.64999999999999997e-230 < a < 2.29999999999999994e70Initial program 80.6%
Taylor expanded in y 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-*.f6444.9
Applied rewrites44.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6425.6
Applied rewrites25.6%
(FPCore (x y z t a b c i j) :precision binary64 (let* ((t_1 (* a (* c j)))) (if (<= j -1.28e+78) t_1 (if (<= j 1.65e+25) (* (* x z) y) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = a * (c * j);
double tmp;
if (j <= -1.28e+78) {
tmp = t_1;
} else if (j <= 1.65e+25) {
tmp = (x * z) * y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = a * (c * j)
if (j <= (-1.28d+78)) then
tmp = t_1
else if (j <= 1.65d+25) then
tmp = (x * z) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = a * (c * j);
double tmp;
if (j <= -1.28e+78) {
tmp = t_1;
} else if (j <= 1.65e+25) {
tmp = (x * z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = a * (c * j) tmp = 0 if j <= -1.28e+78: tmp = t_1 elif j <= 1.65e+25: tmp = (x * z) * y else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(a * Float64(c * j)) tmp = 0.0 if (j <= -1.28e+78) tmp = t_1; elseif (j <= 1.65e+25) tmp = Float64(Float64(x * z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = a * (c * j); tmp = 0.0; if (j <= -1.28e+78) tmp = t_1; elseif (j <= 1.65e+25) tmp = (x * z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[j, -1.28e+78], t$95$1, If[LessEqual[j, 1.65e+25], N[(N[(x * z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(c \cdot j\right)\\
\mathbf{if}\;j \leq -1.28 \cdot 10^{+78}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;j \leq 1.65 \cdot 10^{+25}:\\
\;\;\;\;\left(x \cdot z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if j < -1.2800000000000001e78 or 1.6500000000000001e25 < j Initial program 75.0%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6446.9
Applied rewrites46.9%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6437.7
Applied rewrites37.7%
if -1.2800000000000001e78 < j < 1.6500000000000001e25Initial program 73.4%
Taylor expanded in y 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-*.f6432.6
Applied rewrites32.6%
Taylor expanded in x around inf
lower-*.f6423.7
Applied rewrites23.7%
(FPCore (x y z t a b c i j) :precision binary64 (let* ((t_1 (* a (* c j)))) (if (<= j -1.28e+78) t_1 (if (<= j 3.2e+19) (* x (* y 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 = a * (c * j);
double tmp;
if (j <= -1.28e+78) {
tmp = t_1;
} else if (j <= 3.2e+19) {
tmp = x * (y * z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, 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 = a * (c * j)
if (j <= (-1.28d+78)) then
tmp = t_1
else if (j <= 3.2d+19) then
tmp = x * (y * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = a * (c * j);
double tmp;
if (j <= -1.28e+78) {
tmp = t_1;
} else if (j <= 3.2e+19) {
tmp = x * (y * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = a * (c * j) tmp = 0 if j <= -1.28e+78: tmp = t_1 elif j <= 3.2e+19: tmp = x * (y * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(a * Float64(c * j)) tmp = 0.0 if (j <= -1.28e+78) tmp = t_1; elseif (j <= 3.2e+19) tmp = Float64(x * Float64(y * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = a * (c * j); tmp = 0.0; if (j <= -1.28e+78) tmp = t_1; elseif (j <= 3.2e+19) tmp = x * (y * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[j, -1.28e+78], t$95$1, If[LessEqual[j, 3.2e+19], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(c \cdot j\right)\\
\mathbf{if}\;j \leq -1.28 \cdot 10^{+78}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;j \leq 3.2 \cdot 10^{+19}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if j < -1.2800000000000001e78 or 3.2e19 < j Initial program 74.9%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6446.8
Applied rewrites46.8%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6437.6
Applied rewrites37.6%
if -1.2800000000000001e78 < j < 3.2e19Initial program 73.5%
Taylor expanded in y 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-*.f6432.5
Applied rewrites32.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6423.8
Applied rewrites23.8%
(FPCore (x y z t a b c i j) :precision binary64 (* a (* c j)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return a * (c * 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 = a * (c * 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 a * (c * j);
}
def code(x, y, z, t, a, b, c, i, j): return a * (c * j)
function code(x, y, z, t, a, b, c, i, j) return Float64(a * Float64(c * j)) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = a * (c * j); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \left(c \cdot j\right)
\end{array}
Initial program 74.1%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6440.1
Applied rewrites40.1%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6423.3
Applied rewrites23.3%
(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 2025095
(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)))))