
(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 21 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
(+ (* (- t) (fma a x (* (- b) i))) (* j (* (- i) 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 = (-t * fma(a, x, (-b * i))) + (j * (-i * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(Float64(-t) * fma(a, x, Float64(Float64(-b) * i))) + Float64(j * Float64(Float64(-i) * 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[((-t) * N[(a * x + N[((-b) * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[((-i) * y), $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}:\\
\;\;\;\;\left(-t\right) \cdot \mathsf{fma}\left(a, x, \left(-b\right) \cdot i\right) + j \cdot \left(\left(-i\right) \cdot y\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 88.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 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.f6437.5
Applied rewrites37.5%
Taylor expanded in y around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f6452.2
Applied rewrites52.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- i) t (* c z))))
(if (<= b -13200000000000.0)
(- (fma (- a) (* t x) (* (* j c) a)) (* t_1 b))
(if (<= b 2e-115)
(fma (* (- i) j) y (fma (fma (- t) x (* j c)) a (* (* z y) x)))
(fma (fma (- a) t (* z y)) x (* (- 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 = fma(-i, t, (c * z));
double tmp;
if (b <= -13200000000000.0) {
tmp = fma(-a, (t * x), ((j * c) * a)) - (t_1 * b);
} else if (b <= 2e-115) {
tmp = fma((-i * j), y, fma(fma(-t, x, (j * c)), a, ((z * y) * x)));
} else {
tmp = fma(fma(-a, t, (z * y)), x, (-b * t_1));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-i), t, Float64(c * z)) tmp = 0.0 if (b <= -13200000000000.0) tmp = Float64(fma(Float64(-a), Float64(t * x), Float64(Float64(j * c) * a)) - Float64(t_1 * b)); elseif (b <= 2e-115) tmp = fma(Float64(Float64(-i) * j), y, fma(fma(Float64(-t), x, Float64(j * c)), a, Float64(Float64(z * y) * x))); else tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(-b) * t_1)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-i) * t + N[(c * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -13200000000000.0], N[(N[((-a) * N[(t * x), $MachinePrecision] + N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-115], N[(N[((-i) * j), $MachinePrecision] * y + N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a + N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, t, c \cdot z\right)\\
\mathbf{if}\;b \leq -13200000000000:\\
\;\;\;\;\mathsf{fma}\left(-a, t \cdot x, \left(j \cdot c\right) \cdot a\right) - t\_1 \cdot b\\
\mathbf{elif}\;b \leq 2 \cdot 10^{-115}:\\
\;\;\;\;\mathsf{fma}\left(\left(-i\right) \cdot j, y, \mathsf{fma}\left(\mathsf{fma}\left(-t, x, j \cdot c\right), a, \left(z \cdot y\right) \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(-b\right) \cdot t\_1\right)\\
\end{array}
\end{array}
if b < -1.32e13Initial program 74.6%
Taylor expanded in y around 0
lower--.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.2%
if -1.32e13 < b < 2.0000000000000001e-115Initial program 67.3%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites73.1%
Taylor expanded in b around 0
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites71.7%
if 2.0000000000000001e-115 < b Initial program 75.9%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.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-*.f64N/A
Applied rewrites80.4%
Final simplification75.5%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= j -2.9e+93) (not (<= j 0.0001))) (+ (* (- t) (fma a x (* (- b) i))) (* j (- (* c a) (* y i)))) (fma (fma (- a) t (* z y)) x (* (- b) (fma (- i) t (* c z))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((j <= -2.9e+93) || !(j <= 0.0001)) {
tmp = (-t * fma(a, x, (-b * i))) + (j * ((c * a) - (y * i)));
} else {
tmp = fma(fma(-a, t, (z * y)), x, (-b * fma(-i, t, (c * z))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((j <= -2.9e+93) || !(j <= 0.0001)) tmp = Float64(Float64(Float64(-t) * fma(a, x, Float64(Float64(-b) * i))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))); else tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(-b) * fma(Float64(-i), t, Float64(c * z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -2.9e+93], N[Not[LessEqual[j, 0.0001]], $MachinePrecision]], N[(N[((-t) * N[(a * x + N[((-b) * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * N[((-i) * t + N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -2.9 \cdot 10^{+93} \lor \neg \left(j \leq 0.0001\right):\\
\;\;\;\;\left(-t\right) \cdot \mathsf{fma}\left(a, x, \left(-b\right) \cdot i\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(-b\right) \cdot \mathsf{fma}\left(-i, t, c \cdot z\right)\right)\\
\end{array}
\end{array}
if j < -2.8999999999999998e93 or 1.00000000000000005e-4 < j Initial program 70.2%
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.f6472.7
Applied rewrites72.7%
if -2.8999999999999998e93 < j < 1.00000000000000005e-4Initial program 73.5%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.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-*.f64N/A
Applied rewrites76.2%
Final simplification74.9%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= j -2.9e+93)
(* (fma (- i) y (* c a)) j)
(if (<= j 8.5e+138)
(fma (fma (- a) t (* z y)) x (* (- b) (fma (- i) t (* c z))))
(+ (* (- t) (fma a x (* (- b) i))) (* j (* (- i) y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (j <= -2.9e+93) {
tmp = fma(-i, y, (c * a)) * j;
} else if (j <= 8.5e+138) {
tmp = fma(fma(-a, t, (z * y)), x, (-b * fma(-i, t, (c * z))));
} else {
tmp = (-t * fma(a, x, (-b * i))) + (j * (-i * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (j <= -2.9e+93) tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); elseif (j <= 8.5e+138) tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(-b) * fma(Float64(-i), t, Float64(c * z)))); else tmp = Float64(Float64(Float64(-t) * fma(a, x, Float64(Float64(-b) * i))) + Float64(j * Float64(Float64(-i) * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[j, -2.9e+93], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[j, 8.5e+138], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * N[((-i) * t + N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-t) * N[(a * x + N[((-b) * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[((-i) * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -2.9 \cdot 10^{+93}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{elif}\;j \leq 8.5 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(-b\right) \cdot \mathsf{fma}\left(-i, t, c \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot \mathsf{fma}\left(a, x, \left(-b\right) \cdot i\right) + j \cdot \left(\left(-i\right) \cdot y\right)\\
\end{array}
\end{array}
if j < -2.8999999999999998e93Initial program 67.0%
Taylor expanded in j around inf
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/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
lift-*.f6466.5
Applied rewrites66.5%
if -2.8999999999999998e93 < j < 8.5000000000000006e138Initial program 72.5%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.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-*.f64N/A
Applied rewrites74.4%
if 8.5000000000000006e138 < j Initial program 76.1%
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.f6479.6
Applied rewrites79.6%
Taylor expanded in y around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f6475.1
Applied rewrites75.1%
Final simplification73.3%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= i -4.2e-55) (not (<= i 1450000000000.0))) (+ (* (- t) (fma a x (* (- b) i))) (* j (* (- i) y))) (fma (fma (- a) t (* z y)) x (* (- b) (* c z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((i <= -4.2e-55) || !(i <= 1450000000000.0)) {
tmp = (-t * fma(a, x, (-b * i))) + (j * (-i * y));
} else {
tmp = fma(fma(-a, t, (z * y)), x, (-b * (c * z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((i <= -4.2e-55) || !(i <= 1450000000000.0)) tmp = Float64(Float64(Float64(-t) * fma(a, x, Float64(Float64(-b) * i))) + Float64(j * Float64(Float64(-i) * y))); else tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(-b) * Float64(c * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[i, -4.2e-55], N[Not[LessEqual[i, 1450000000000.0]], $MachinePrecision]], N[(N[((-t) * N[(a * x + N[((-b) * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[((-i) * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -4.2 \cdot 10^{-55} \lor \neg \left(i \leq 1450000000000\right):\\
\;\;\;\;\left(-t\right) \cdot \mathsf{fma}\left(a, x, \left(-b\right) \cdot i\right) + j \cdot \left(\left(-i\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(-b\right) \cdot \left(c \cdot z\right)\right)\\
\end{array}
\end{array}
if i < -4.2000000000000003e-55 or 1.45e12 < i Initial program 59.8%
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.f6466.5
Applied rewrites66.5%
Taylor expanded in y around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f6468.8
Applied rewrites68.8%
if -4.2000000000000003e-55 < i < 1.45e12Initial program 83.2%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.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-*.f64N/A
Applied rewrites75.0%
Taylor expanded in z around inf
lift-*.f6471.6
Applied rewrites71.6%
Final simplification70.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- a) t (* z y))))
(if (<= i -5.7e-55)
(fma t_1 x (* (* b t) i))
(if (<= i 3.8e+33)
(fma t_1 x (* (- b) (* c z)))
(* (- i) (* (fma j (/ y t) (- b)) t))))))
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));
double tmp;
if (i <= -5.7e-55) {
tmp = fma(t_1, x, ((b * t) * i));
} else if (i <= 3.8e+33) {
tmp = fma(t_1, x, (-b * (c * z)));
} else {
tmp = -i * (fma(j, (y / t), -b) * t);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-a), t, Float64(z * y)) tmp = 0.0 if (i <= -5.7e-55) tmp = fma(t_1, x, Float64(Float64(b * t) * i)); elseif (i <= 3.8e+33) tmp = fma(t_1, x, Float64(Float64(-b) * Float64(c * z))); else tmp = Float64(Float64(-i) * Float64(fma(j, Float64(y / t), Float64(-b)) * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -5.7e-55], N[(t$95$1 * x + N[(N[(b * t), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.8e+33], N[(t$95$1 * x + N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-i) * N[(N[(j * N[(y / t), $MachinePrecision] + (-b)), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, t, z \cdot y\right)\\
\mathbf{if}\;i \leq -5.7 \cdot 10^{-55}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, x, \left(b \cdot t\right) \cdot i\right)\\
\mathbf{elif}\;i \leq 3.8 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, x, \left(-b\right) \cdot \left(c \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-i\right) \cdot \left(\mathsf{fma}\left(j, \frac{y}{t}, -b\right) \cdot t\right)\\
\end{array}
\end{array}
if i < -5.7000000000000002e-55Initial program 64.6%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.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-*.f64N/A
Applied rewrites60.5%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f64N/A
lift-*.f6460.6
Applied rewrites60.6%
Taylor expanded in z around 0
lower-*.f6459.0
Applied rewrites59.0%
if -5.7000000000000002e-55 < i < 3.80000000000000002e33Initial program 83.0%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.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-*.f64N/A
Applied rewrites75.0%
Taylor expanded in z around inf
lift-*.f6471.7
Applied rewrites71.7%
if 3.80000000000000002e33 < i Initial program 53.4%
Taylor expanded in i 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.f6461.1
Applied rewrites61.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-neg.f6462.7
Applied rewrites62.7%
Final simplification66.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= c -2.9e+123) (not (<= c 1.9e+148))) (* (fma j a (* (- b) z)) c) (fma (fma (- a) t (* z y)) x (* (* b t) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((c <= -2.9e+123) || !(c <= 1.9e+148)) {
tmp = fma(j, a, (-b * z)) * c;
} else {
tmp = fma(fma(-a, t, (z * y)), x, ((b * t) * i));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((c <= -2.9e+123) || !(c <= 1.9e+148)) tmp = Float64(fma(j, a, Float64(Float64(-b) * z)) * c); else tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(b * t) * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[c, -2.9e+123], N[Not[LessEqual[c, 1.9e+148]], $MachinePrecision]], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[(b * t), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.9 \cdot 10^{+123} \lor \neg \left(c \leq 1.9 \cdot 10^{+148}\right):\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(b \cdot t\right) \cdot i\right)\\
\end{array}
\end{array}
if c < -2.9000000000000001e123 or 1.8999999999999999e148 < c Initial program 64.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.f6483.3
Applied rewrites83.3%
if -2.9000000000000001e123 < c < 1.8999999999999999e148Initial program 74.9%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.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-*.f64N/A
Applied rewrites61.0%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f64N/A
lift-*.f6457.0
Applied rewrites57.0%
Taylor expanded in z around 0
lower-*.f6455.4
Applied rewrites55.4%
Final simplification62.2%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= y -2.2e+97)
(* (- i) (* j y))
(if (<= y -1.1e-212)
(* (fma j a (* (- b) z)) c)
(if (<= y 3.15e+90) (* (fma i t (* (- c) z)) b) (* (* y x) 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.2e+97) {
tmp = -i * (j * y);
} else if (y <= -1.1e-212) {
tmp = fma(j, a, (-b * z)) * c;
} else if (y <= 3.15e+90) {
tmp = fma(i, t, (-c * z)) * b;
} else {
tmp = (y * x) * z;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (y <= -2.2e+97) tmp = Float64(Float64(-i) * Float64(j * y)); elseif (y <= -1.1e-212) tmp = Float64(fma(j, a, Float64(Float64(-b) * z)) * c); elseif (y <= 3.15e+90) tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b); else tmp = Float64(Float64(y * x) * z); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[y, -2.2e+97], N[((-i) * N[(j * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.1e-212], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[y, 3.15e+90], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+97}:\\
\;\;\;\;\left(-i\right) \cdot \left(j \cdot y\right)\\
\mathbf{elif}\;y \leq -1.1 \cdot 10^{-212}:\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{elif}\;y \leq 3.15 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\end{array}
\end{array}
if y < -2.2000000000000001e97Initial program 56.5%
Taylor expanded in i 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.f6455.0
Applied rewrites55.0%
Taylor expanded in y around inf
lower-*.f6448.0
Applied rewrites48.0%
if -2.2000000000000001e97 < y < -1.10000000000000002e-212Initial program 77.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.f6455.2
Applied rewrites55.2%
if -1.10000000000000002e-212 < y < 3.15e90Initial program 78.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.f6449.8
Applied rewrites49.8%
if 3.15e90 < y Initial program 61.7%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites61.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
lift-neg.f64N/A
*-commutativeN/A
lower-*.f6455.3
Applied rewrites55.3%
Taylor expanded in x around inf
*-commutativeN/A
lift-*.f6447.7
Applied rewrites47.7%
Final simplification50.5%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* y x) z)))
(if (<= y -2.6e+25)
t_1
(if (<= y -2.05e-184)
(* (* j a) c)
(if (<= y 4400000000000.0)
(* (* (- c) z) b)
(if (<= y 1.9e+85) (* (* i t) 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 = (y * x) * z;
double tmp;
if (y <= -2.6e+25) {
tmp = t_1;
} else if (y <= -2.05e-184) {
tmp = (j * a) * c;
} else if (y <= 4400000000000.0) {
tmp = (-c * z) * b;
} else if (y <= 1.9e+85) {
tmp = (i * t) * b;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = (y * x) * z
if (y <= (-2.6d+25)) then
tmp = t_1
else if (y <= (-2.05d-184)) then
tmp = (j * a) * c
else if (y <= 4400000000000.0d0) then
tmp = (-c * z) * b
else if (y <= 1.9d+85) then
tmp = (i * t) * b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (y * x) * z;
double tmp;
if (y <= -2.6e+25) {
tmp = t_1;
} else if (y <= -2.05e-184) {
tmp = (j * a) * c;
} else if (y <= 4400000000000.0) {
tmp = (-c * z) * b;
} else if (y <= 1.9e+85) {
tmp = (i * t) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (y * x) * z tmp = 0 if y <= -2.6e+25: tmp = t_1 elif y <= -2.05e-184: tmp = (j * a) * c elif y <= 4400000000000.0: tmp = (-c * z) * b elif y <= 1.9e+85: tmp = (i * t) * b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(y * x) * z) tmp = 0.0 if (y <= -2.6e+25) tmp = t_1; elseif (y <= -2.05e-184) tmp = Float64(Float64(j * a) * c); elseif (y <= 4400000000000.0) tmp = Float64(Float64(Float64(-c) * z) * b); elseif (y <= 1.9e+85) tmp = Float64(Float64(i * t) * b); else tmp = t_1; 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 (y <= -2.6e+25) tmp = t_1; elseif (y <= -2.05e-184) tmp = (j * a) * c; elseif (y <= 4400000000000.0) tmp = (-c * z) * b; elseif (y <= 1.9e+85) tmp = (i * t) * b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -2.6e+25], t$95$1, If[LessEqual[y, -2.05e-184], N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[y, 4400000000000.0], N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[y, 1.9e+85], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y \cdot x\right) \cdot z\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.05 \cdot 10^{-184}:\\
\;\;\;\;\left(j \cdot a\right) \cdot c\\
\mathbf{elif}\;y \leq 4400000000000:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+85}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.5999999999999998e25 or 1.89999999999999996e85 < y Initial program 60.7%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites63.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f6451.8
Applied rewrites51.8%
Taylor expanded in x around inf
*-commutativeN/A
lift-*.f6443.3
Applied rewrites43.3%
if -2.5999999999999998e25 < y < -2.05e-184Initial program 78.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.f6458.6
Applied rewrites58.6%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6439.6
Applied rewrites39.6%
if -2.05e-184 < y < 4.4e12Initial program 80.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.f6452.3
Applied rewrites52.3%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f6434.5
Applied rewrites34.5%
if 4.4e12 < y < 1.89999999999999996e85Initial program 72.2%
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.1
Applied rewrites39.1%
Taylor expanded in z around 0
lower-*.f6435.1
Applied rewrites35.1%
Final simplification38.5%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -6.4e+38) (not (<= z 1.38e-6))) (* (fma y x (* (- b) c)) z) (* (- t) (fma (- b) i (* a x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -6.4e+38) || !(z <= 1.38e-6)) {
tmp = fma(y, x, (-b * c)) * z;
} else {
tmp = -t * fma(-b, i, (a * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((z <= -6.4e+38) || !(z <= 1.38e-6)) tmp = Float64(fma(y, x, Float64(Float64(-b) * c)) * z); else tmp = Float64(Float64(-t) * fma(Float64(-b), i, Float64(a * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -6.4e+38], N[Not[LessEqual[z, 1.38e-6]], $MachinePrecision]], N[(N[(y * x + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[((-t) * N[((-b) * i + N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+38} \lor \neg \left(z \leq 1.38 \cdot 10^{-6}\right):\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot \mathsf{fma}\left(-b, i, a \cdot x\right)\\
\end{array}
\end{array}
if z < -6.3999999999999997e38 or 1.3799999999999999e-6 < z Initial program 59.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6470.9
Applied rewrites70.9%
if -6.3999999999999997e38 < z < 1.3799999999999999e-6Initial program 81.7%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites85.1%
Taylor expanded in t around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.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
lift-neg.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
Final simplification60.7%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -6.4e+38) (not (<= z 1.38e-6))) (* (fma y x (* (- b) c)) z) (* (fma (- a) x (* i b)) t)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -6.4e+38) || !(z <= 1.38e-6)) {
tmp = fma(y, x, (-b * c)) * z;
} else {
tmp = fma(-a, x, (i * b)) * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((z <= -6.4e+38) || !(z <= 1.38e-6)) tmp = Float64(fma(y, x, Float64(Float64(-b) * c)) * z); else tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -6.4e+38], N[Not[LessEqual[z, 1.38e-6]], $MachinePrecision]], N[(N[(y * x + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+38} \lor \neg \left(z \leq 1.38 \cdot 10^{-6}\right):\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\end{array}
\end{array}
if z < -6.3999999999999997e38 or 1.3799999999999999e-6 < z Initial program 59.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6470.9
Applied rewrites70.9%
if -6.3999999999999997e38 < z < 1.3799999999999999e-6Initial program 81.7%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites85.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sign-sub-invN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f6452.9
Applied rewrites52.9%
Final simplification60.7%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= x -0.235) (not (<= x 3.4e+52))) (* (fma (- a) t (* z y)) x) (* (fma i t (* (- 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 ((x <= -0.235) || !(x <= 3.4e+52)) {
tmp = fma(-a, t, (z * y)) * x;
} else {
tmp = fma(i, t, (-c * z)) * b;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((x <= -0.235) || !(x <= 3.4e+52)) tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); else tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -0.235], N[Not[LessEqual[x, 3.4e+52]], $MachinePrecision]], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.235 \lor \neg \left(x \leq 3.4 \cdot 10^{+52}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
\end{array}
\end{array}
if x < -0.23499999999999999 or 3.4e52 < x Initial program 71.3%
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-*.f6463.8
Applied rewrites63.8%
if -0.23499999999999999 < x < 3.4e52Initial program 73.1%
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.f6448.6
Applied rewrites48.6%
Final simplification55.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -1.5e+98) (not (<= z 1.2e-15))) (* (fma y x (* (- b) c)) z) (* (fma i t (* (- 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 ((z <= -1.5e+98) || !(z <= 1.2e-15)) {
tmp = fma(y, x, (-b * c)) * z;
} else {
tmp = fma(i, t, (-c * z)) * b;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((z <= -1.5e+98) || !(z <= 1.2e-15)) tmp = Float64(fma(y, x, Float64(Float64(-b) * c)) * z); else tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -1.5e+98], N[Not[LessEqual[z, 1.2e-15]], $MachinePrecision]], N[(N[(y * x + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+98} \lor \neg \left(z \leq 1.2 \cdot 10^{-15}\right):\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
\end{array}
\end{array}
if z < -1.5000000000000001e98 or 1.19999999999999997e-15 < z Initial program 59.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6473.5
Applied rewrites73.5%
if -1.5000000000000001e98 < z < 1.19999999999999997e-15Initial program 80.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.f6440.6
Applied rewrites40.6%
Final simplification53.7%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= t -5.1e+75)
(* (* (- a) t) x)
(if (<= t 2.9e-11)
(* (* (- c) z) b)
(if (<= t 7.5e+34) (* (* j c) a) (* (* (- t) x) a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (t <= -5.1e+75) {
tmp = (-a * t) * x;
} else if (t <= 2.9e-11) {
tmp = (-c * z) * b;
} else if (t <= 7.5e+34) {
tmp = (j * c) * a;
} 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) :: tmp
if (t <= (-5.1d+75)) then
tmp = (-a * t) * x
else if (t <= 2.9d-11) then
tmp = (-c * z) * b
else if (t <= 7.5d+34) then
tmp = (j * c) * a
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 tmp;
if (t <= -5.1e+75) {
tmp = (-a * t) * x;
} else if (t <= 2.9e-11) {
tmp = (-c * z) * b;
} else if (t <= 7.5e+34) {
tmp = (j * c) * a;
} else {
tmp = (-t * x) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if t <= -5.1e+75: tmp = (-a * t) * x elif t <= 2.9e-11: tmp = (-c * z) * b elif t <= 7.5e+34: tmp = (j * c) * a else: tmp = (-t * x) * a return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (t <= -5.1e+75) tmp = Float64(Float64(Float64(-a) * t) * x); elseif (t <= 2.9e-11) tmp = Float64(Float64(Float64(-c) * z) * b); elseif (t <= 7.5e+34) tmp = Float64(Float64(j * c) * a); 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) tmp = 0.0; if (t <= -5.1e+75) tmp = (-a * t) * x; elseif (t <= 2.9e-11) tmp = (-c * z) * b; elseif (t <= 7.5e+34) tmp = (j * c) * a; else tmp = (-t * x) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[t, -5.1e+75], N[(N[((-a) * t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 2.9e-11], N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[t, 7.5e+34], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], N[(N[((-t) * x), $MachinePrecision] * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.1 \cdot 10^{+75}:\\
\;\;\;\;\left(\left(-a\right) \cdot t\right) \cdot x\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-11}:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{+34}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-t\right) \cdot x\right) \cdot a\\
\end{array}
\end{array}
if t < -5.10000000000000037e75Initial program 58.6%
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-*.f6463.8
Applied rewrites63.8%
Taylor expanded in y around 0
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6460.7
Applied rewrites60.7%
if -5.10000000000000037e75 < t < 2.9e-11Initial program 81.1%
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.6
Applied rewrites46.6%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f6434.7
Applied rewrites34.7%
if 2.9e-11 < t < 7.49999999999999976e34Initial program 56.5%
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-*.f6472.7
Applied rewrites72.7%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6470.6
Applied rewrites70.6%
if 7.49999999999999976e34 < t Initial program 63.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-*.f6451.3
Applied rewrites51.3%
Taylor expanded in x around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6441.8
Applied rewrites41.8%
Final simplification42.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* (- a) t) x)))
(if (<= t -5.1e+75)
t_1
(if (<= t 2.9e-11)
(* (* (- c) z) b)
(if (<= t 8e+108) (* (* 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 = (-a * t) * x;
double tmp;
if (t <= -5.1e+75) {
tmp = t_1;
} else if (t <= 2.9e-11) {
tmp = (-c * z) * b;
} else if (t <= 8e+108) {
tmp = (j * c) * a;
} 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 * t) * x
if (t <= (-5.1d+75)) then
tmp = t_1
else if (t <= 2.9d-11) then
tmp = (-c * z) * b
else if (t <= 8d+108) then
tmp = (j * c) * a
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 * t) * x;
double tmp;
if (t <= -5.1e+75) {
tmp = t_1;
} else if (t <= 2.9e-11) {
tmp = (-c * z) * b;
} else if (t <= 8e+108) {
tmp = (j * c) * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (-a * t) * x tmp = 0 if t <= -5.1e+75: tmp = t_1 elif t <= 2.9e-11: tmp = (-c * z) * b elif t <= 8e+108: tmp = (j * c) * a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(-a) * t) * x) tmp = 0.0 if (t <= -5.1e+75) tmp = t_1; elseif (t <= 2.9e-11) tmp = Float64(Float64(Float64(-c) * z) * b); elseif (t <= 8e+108) tmp = Float64(Float64(j * c) * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (-a * t) * x; tmp = 0.0; if (t <= -5.1e+75) tmp = t_1; elseif (t <= 2.9e-11) tmp = (-c * z) * b; elseif (t <= 8e+108) tmp = (j * c) * a; 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[((-a) * t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -5.1e+75], t$95$1, If[LessEqual[t, 2.9e-11], N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[t, 8e+108], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-a\right) \cdot t\right) \cdot x\\
\mathbf{if}\;t \leq -5.1 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-11}:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b\\
\mathbf{elif}\;t \leq 8 \cdot 10^{+108}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.10000000000000037e75 or 8.0000000000000003e108 < t Initial program 58.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-*.f6455.6
Applied rewrites55.6%
Taylor expanded in y around 0
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6449.4
Applied rewrites49.4%
if -5.10000000000000037e75 < t < 2.9e-11Initial program 81.1%
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.6
Applied rewrites46.6%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f6434.7
Applied rewrites34.7%
if 2.9e-11 < t < 8.0000000000000003e108Initial program 68.8%
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-*.f6454.3
Applied rewrites54.3%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6442.6
Applied rewrites42.6%
Final simplification40.5%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= x -6.2e+150) (* (* (- t) x) a) (if (<= x 4.2e+179) (* (fma i t (* (- c) z)) b) (* (- t) (* a 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 <= -6.2e+150) {
tmp = (-t * x) * a;
} else if (x <= 4.2e+179) {
tmp = fma(i, t, (-c * z)) * b;
} else {
tmp = -t * (a * x);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -6.2e+150) tmp = Float64(Float64(Float64(-t) * x) * a); elseif (x <= 4.2e+179) tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b); else tmp = Float64(Float64(-t) * Float64(a * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -6.2e+150], N[(N[((-t) * x), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[x, 4.2e+179], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[((-t) * N[(a * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+150}:\\
\;\;\;\;\left(\left(-t\right) \cdot x\right) \cdot a\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+179}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot \left(a \cdot x\right)\\
\end{array}
\end{array}
if x < -6.20000000000000028e150Initial program 63.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-*.f6449.8
Applied rewrites49.8%
Taylor expanded in x around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6450.0
Applied rewrites50.0%
if -6.20000000000000028e150 < x < 4.1999999999999997e179Initial program 72.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.6
Applied rewrites46.6%
if 4.1999999999999997e179 < x Initial program 77.6%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites80.9%
Taylor expanded in t around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.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
lift-neg.f64N/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in x around inf
lift-*.f6459.9
Applied rewrites59.9%
Final simplification48.6%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= c -1.05e+93) (* (* (- b) z) c) (if (<= c 2.05e+89) (* (* 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 <= -1.05e+93) {
tmp = (-b * z) * c;
} else if (c <= 2.05e+89) {
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 <= (-1.05d+93)) then
tmp = (-b * z) * c
else if (c <= 2.05d+89) 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 <= -1.05e+93) {
tmp = (-b * z) * c;
} else if (c <= 2.05e+89) {
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 <= -1.05e+93: tmp = (-b * z) * c elif c <= 2.05e+89: 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 <= -1.05e+93) tmp = Float64(Float64(Float64(-b) * z) * c); elseif (c <= 2.05e+89) 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 <= -1.05e+93) tmp = (-b * z) * c; elseif (c <= 2.05e+89) 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, -1.05e+93], N[(N[((-b) * z), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[c, 2.05e+89], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.05 \cdot 10^{+93}:\\
\;\;\;\;\left(\left(-b\right) \cdot z\right) \cdot c\\
\mathbf{elif}\;c \leq 2.05 \cdot 10^{+89}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b\\
\end{array}
\end{array}
if c < -1.0499999999999999e93Initial program 65.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.f6482.3
Applied rewrites82.3%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f6459.1
Applied rewrites59.1%
if -1.0499999999999999e93 < c < 2.04999999999999993e89Initial program 73.7%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites77.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f6436.4
Applied rewrites36.4%
Taylor expanded in x around inf
*-commutativeN/A
lift-*.f6426.9
Applied rewrites26.9%
if 2.04999999999999993e89 < c Initial program 74.2%
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.f6465.4
Applied rewrites65.4%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f6451.1
Applied rewrites51.1%
Final simplification35.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -1.5e+98) (not (<= z 1.1e-15))) (* (* z y) x) (* (* i t) b)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -1.5e+98) || !(z <= 1.1e-15)) {
tmp = (z * y) * x;
} else {
tmp = (i * t) * 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 ((z <= (-1.5d+98)) .or. (.not. (z <= 1.1d-15))) then
tmp = (z * y) * x
else
tmp = (i * t) * 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 ((z <= -1.5e+98) || !(z <= 1.1e-15)) {
tmp = (z * y) * x;
} else {
tmp = (i * t) * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (z <= -1.5e+98) or not (z <= 1.1e-15): tmp = (z * y) * x else: tmp = (i * t) * b return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((z <= -1.5e+98) || !(z <= 1.1e-15)) tmp = Float64(Float64(z * y) * x); else tmp = Float64(Float64(i * t) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((z <= -1.5e+98) || ~((z <= 1.1e-15))) tmp = (z * y) * x; else tmp = (i * t) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -1.5e+98], N[Not[LessEqual[z, 1.1e-15]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+98} \lor \neg \left(z \leq 1.1 \cdot 10^{-15}\right):\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\end{array}
\end{array}
if z < -1.5000000000000001e98 or 1.09999999999999993e-15 < z Initial program 59.3%
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-*.f6454.1
Applied rewrites54.1%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6440.8
Applied rewrites40.8%
if -1.5000000000000001e98 < z < 1.09999999999999993e-15Initial program 80.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.f6440.6
Applied rewrites40.6%
Taylor expanded in z around 0
lower-*.f6427.3
Applied rewrites27.3%
Final simplification32.7%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= b -1.45e+163) (not (<= b 5.2e+63))) (* (* i t) b) (* (* j a) c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((b <= -1.45e+163) || !(b <= 5.2e+63)) {
tmp = (i * t) * b;
} else {
tmp = (j * a) * c;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((b <= (-1.45d+163)) .or. (.not. (b <= 5.2d+63))) then
tmp = (i * t) * b
else
tmp = (j * a) * c
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((b <= -1.45e+163) || !(b <= 5.2e+63)) {
tmp = (i * t) * b;
} else {
tmp = (j * a) * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (b <= -1.45e+163) or not (b <= 5.2e+63): tmp = (i * t) * b else: tmp = (j * a) * c return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((b <= -1.45e+163) || !(b <= 5.2e+63)) tmp = Float64(Float64(i * t) * b); else tmp = Float64(Float64(j * a) * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((b <= -1.45e+163) || ~((b <= 5.2e+63))) tmp = (i * t) * b; else tmp = (j * a) * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[b, -1.45e+163], N[Not[LessEqual[b, 5.2e+63]], $MachinePrecision]], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.45 \cdot 10^{+163} \lor \neg \left(b \leq 5.2 \cdot 10^{+63}\right):\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(j \cdot a\right) \cdot c\\
\end{array}
\end{array}
if b < -1.44999999999999999e163 or 5.2000000000000002e63 < b Initial program 73.6%
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.f6467.5
Applied rewrites67.5%
Taylor expanded in z around 0
lower-*.f6436.7
Applied rewrites36.7%
if -1.44999999999999999e163 < b < 5.2000000000000002e63Initial program 71.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.f6432.4
Applied rewrites32.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6420.9
Applied rewrites20.9%
Final simplification26.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= z -1.5e+98) (* (* z y) x) (if (<= z 1.1e-15) (* (* i t) b) (* (* y x) z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (z <= -1.5e+98) {
tmp = (z * y) * x;
} else if (z <= 1.1e-15) {
tmp = (i * t) * b;
} else {
tmp = (y * x) * 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 (z <= (-1.5d+98)) then
tmp = (z * y) * x
else if (z <= 1.1d-15) then
tmp = (i * t) * b
else
tmp = (y * x) * 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 (z <= -1.5e+98) {
tmp = (z * y) * x;
} else if (z <= 1.1e-15) {
tmp = (i * t) * b;
} else {
tmp = (y * x) * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if z <= -1.5e+98: tmp = (z * y) * x elif z <= 1.1e-15: tmp = (i * t) * b else: tmp = (y * x) * z return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (z <= -1.5e+98) tmp = Float64(Float64(z * y) * x); elseif (z <= 1.1e-15) tmp = Float64(Float64(i * t) * b); else tmp = Float64(Float64(y * x) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (z <= -1.5e+98) tmp = (z * y) * x; elseif (z <= 1.1e-15) tmp = (i * t) * b; else tmp = (y * x) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[z, -1.5e+98], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.1e-15], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+98}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-15}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\end{array}
\end{array}
if z < -1.5000000000000001e98Initial program 69.1%
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-*.f6462.8
Applied rewrites62.8%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6448.7
Applied rewrites48.7%
if -1.5000000000000001e98 < z < 1.09999999999999993e-15Initial program 80.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.f6440.6
Applied rewrites40.6%
Taylor expanded in z around 0
lower-*.f6427.3
Applied rewrites27.3%
if 1.09999999999999993e-15 < z Initial program 52.4%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites59.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in x around inf
*-commutativeN/A
lift-*.f6438.4
Applied rewrites38.4%
Final simplification33.4%
(FPCore (x y z t a b c i j) :precision binary64 (* (* i t) b))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (i * t) * b;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = (i * t) * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (i * t) * b;
}
def code(x, y, z, t, a, b, c, i, j): return (i * t) * b
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(i * t) * b) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (i * t) * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]
\begin{array}{l}
\\
\left(i \cdot t\right) \cdot b
\end{array}
Initial program 72.3%
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.4
Applied rewrites41.4%
Taylor expanded in z around 0
lower-*.f6419.7
Applied rewrites19.7%
Final simplification19.7%
(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 2025051
(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)))))