
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 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) (* i a)))) (* j (- (* c t) (* i y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\end{array}
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(* j (- (* c t) (* i y))))))
(if (<= t_1 INFINITY)
t_1
(fma (- a) (* t x) (fma (fma (- b) z (* j t)) c (* (* i b) a))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(-a, (t * x), fma(fma(-b, z, (j * t)), c, ((i * b) * a)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(Float64(-a), Float64(t * x), fma(fma(Float64(-b), z, Float64(j * t)), c, Float64(Float64(i * b) * a))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[((-a) * N[(t * x), $MachinePrecision] + N[(N[((-b) * z + N[(j * t), $MachinePrecision]), $MachinePrecision] * c + N[(N[(i * b), $MachinePrecision] * a), $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 - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, t \cdot x, \mathsf{fma}\left(\mathsf{fma}\left(-b, z, j \cdot t\right), c, \left(i \cdot b\right) \cdot a\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 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) < +inf.0Initial program 87.4%
if +inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) Initial program 0.0%
Taylor expanded in c around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites32.7%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
Applied rewrites60.0%
Final simplification81.5%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* j (- (* c t) (* i y)))))
(if (<=
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) t_1)
INFINITY)
(+ (fma (- a) (* t x) (* (- b) (fma (- a) i (* c z)))) t_1)
(fma (- a) (* t x) (fma (fma (- b) z (* j t)) c (* (* i b) a))))))
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 * t) - (i * y));
double tmp;
if ((((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + t_1) <= ((double) INFINITY)) {
tmp = fma(-a, (t * x), (-b * fma(-a, i, (c * z)))) + t_1;
} else {
tmp = fma(-a, (t * x), fma(fma(-b, z, (j * t)), c, ((i * b) * a)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(j * Float64(Float64(c * t) - Float64(i * y))) tmp = 0.0 if (Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + t_1) <= Inf) tmp = Float64(fma(Float64(-a), Float64(t * x), Float64(Float64(-b) * fma(Float64(-a), i, Float64(c * z)))) + t_1); else tmp = fma(Float64(-a), Float64(t * x), fma(fma(Float64(-b), z, Float64(j * t)), c, Float64(Float64(i * b) * a))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], Infinity], N[(N[((-a) * N[(t * x), $MachinePrecision] + N[((-b) * N[((-a) * i + N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[((-a) * N[(t * x), $MachinePrecision] + N[(N[((-b) * z + N[(j * t), $MachinePrecision]), $MachinePrecision] * c + N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{if}\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(-a, t \cdot x, \left(-b\right) \cdot \mathsf{fma}\left(-a, i, c \cdot z\right)\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, t \cdot x, \mathsf{fma}\left(\mathsf{fma}\left(-b, z, j \cdot t\right), c, \left(i \cdot b\right) \cdot a\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 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) < +inf.0Initial program 87.4%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/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
lower-neg.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
lift-*.f6480.2
Applied rewrites80.2%
if +inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) Initial program 0.0%
Taylor expanded in c around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites32.7%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
Applied rewrites60.0%
Final simplification75.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) j (* z x)) y)))
(if (<= y -1.55e+144)
t_1
(if (<= y 6.2e-45)
(fma (- a) (* t x) (fma (fma (- b) z (* j t)) c (* (* i b) a)))
(if (<= y 8e+35)
(fma (fma (- a) t (* z y)) x (* (- b) (fma (- a) i (* 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 = fma(-i, j, (z * x)) * y;
double tmp;
if (y <= -1.55e+144) {
tmp = t_1;
} else if (y <= 6.2e-45) {
tmp = fma(-a, (t * x), fma(fma(-b, z, (j * t)), c, ((i * b) * a)));
} else if (y <= 8e+35) {
tmp = fma(fma(-a, t, (z * y)), x, (-b * fma(-a, i, (c * z))));
} 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.55e+144) tmp = t_1; elseif (y <= 6.2e-45) tmp = fma(Float64(-a), Float64(t * x), fma(fma(Float64(-b), z, Float64(j * t)), c, Float64(Float64(i * b) * a))); elseif (y <= 8e+35) tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(-b) * fma(Float64(-a), i, Float64(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[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -1.55e+144], t$95$1, If[LessEqual[y, 6.2e-45], N[((-a) * N[(t * x), $MachinePrecision] + N[(N[((-b) * z + N[(j * t), $MachinePrecision]), $MachinePrecision] * c + N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+35], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * N[((-a) * i + N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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.55 \cdot 10^{+144}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-45}:\\
\;\;\;\;\mathsf{fma}\left(-a, t \cdot x, \mathsf{fma}\left(\mathsf{fma}\left(-b, z, j \cdot t\right), c, \left(i \cdot b\right) \cdot a\right)\right)\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(-b\right) \cdot \mathsf{fma}\left(-a, i, c \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.5500000000000001e144 or 7.9999999999999997e35 < y Initial program 62.0%
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-*.f6469.7
Applied rewrites69.7%
if -1.5500000000000001e144 < y < 6.2000000000000002e-45Initial program 72.2%
Taylor expanded in c around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites73.2%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
Applied rewrites74.7%
if 6.2000000000000002e-45 < y < 7.9999999999999997e35Initial program 70.3%
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 rewrites85.7%
Final simplification73.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) j (* z x)) y)))
(if (<= y -3.4e+147)
t_1
(if (<= y 5e-45)
(- (fma (* j c) t (* (- a) (* t x))) (* (fma c z (* (- i) a)) b))
(if (<= y 8e+35)
(fma (fma (- a) t (* z y)) x (* (- b) (fma (- a) i (* 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 = fma(-i, j, (z * x)) * y;
double tmp;
if (y <= -3.4e+147) {
tmp = t_1;
} else if (y <= 5e-45) {
tmp = fma((j * c), t, (-a * (t * x))) - (fma(c, z, (-i * a)) * b);
} else if (y <= 8e+35) {
tmp = fma(fma(-a, t, (z * y)), x, (-b * fma(-a, i, (c * z))));
} 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 <= -3.4e+147) tmp = t_1; elseif (y <= 5e-45) tmp = Float64(fma(Float64(j * c), t, Float64(Float64(-a) * Float64(t * x))) - Float64(fma(c, z, Float64(Float64(-i) * a)) * b)); elseif (y <= 8e+35) tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(-b) * fma(Float64(-a), i, Float64(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[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -3.4e+147], t$95$1, If[LessEqual[y, 5e-45], N[(N[(N[(j * c), $MachinePrecision] * t + N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(c * z + N[((-i) * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+35], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * N[((-a) * i + N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -3.4 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-45}:\\
\;\;\;\;\mathsf{fma}\left(j \cdot c, t, \left(-a\right) \cdot \left(t \cdot x\right)\right) - \mathsf{fma}\left(c, z, \left(-i\right) \cdot a\right) \cdot b\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(-b\right) \cdot \mathsf{fma}\left(-a, i, c \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.4e147 or 7.9999999999999997e35 < y Initial program 61.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-*.f6469.4
Applied rewrites69.4%
if -3.4e147 < y < 4.99999999999999976e-45Initial program 72.4%
Taylor expanded in c around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites73.3%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.0%
if 4.99999999999999976e-45 < y < 7.9999999999999997e35Initial program 70.3%
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 rewrites85.7%
Final simplification71.6%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- a) i (* c z))) (t_2 (* (fma (- i) j (* z x)) y)))
(if (<= y -3.4e+147)
t_2
(if (<= y 3.2e-45)
(- (fma (- a) (* t x) (* (* j t) c)) (* t_1 b))
(if (<= y 8e+35) (fma (fma (- a) t (* z y)) x (* (- 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 = fma(-a, i, (c * z));
double t_2 = fma(-i, j, (z * x)) * y;
double tmp;
if (y <= -3.4e+147) {
tmp = t_2;
} else if (y <= 3.2e-45) {
tmp = fma(-a, (t * x), ((j * t) * c)) - (t_1 * b);
} else if (y <= 8e+35) {
tmp = fma(fma(-a, t, (z * y)), x, (-b * t_1));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-a), i, Float64(c * z)) t_2 = Float64(fma(Float64(-i), j, Float64(z * x)) * y) tmp = 0.0 if (y <= -3.4e+147) tmp = t_2; elseif (y <= 3.2e-45) tmp = Float64(fma(Float64(-a), Float64(t * x), Float64(Float64(j * t) * c)) - Float64(t_1 * b)); elseif (y <= 8e+35) tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(-b) * t_1)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-a) * i + N[(c * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -3.4e+147], t$95$2, If[LessEqual[y, 3.2e-45], N[(N[((-a) * N[(t * x), $MachinePrecision] + N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+35], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, i, c \cdot z\right)\\
t_2 := \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{if}\;y \leq -3.4 \cdot 10^{+147}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-45}:\\
\;\;\;\;\mathsf{fma}\left(-a, t \cdot x, \left(j \cdot t\right) \cdot c\right) - t\_1 \cdot b\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(-b\right) \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -3.4e147 or 7.9999999999999997e35 < y Initial program 61.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-*.f6469.4
Applied rewrites69.4%
if -3.4e147 < y < 3.20000000000000007e-45Initial program 72.4%
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
lower-*.f64N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.4%
if 3.20000000000000007e-45 < y < 7.9999999999999997e35Initial program 70.3%
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 rewrites85.7%
Final simplification71.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= j -1.75e+44) (not (<= j 5.4e+216))) (* (fma (- i) y (* c t)) j) (fma (fma (- a) t (* z y)) x (* (- b) (fma (- a) i (* 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 <= -1.75e+44) || !(j <= 5.4e+216)) {
tmp = fma(-i, y, (c * t)) * j;
} else {
tmp = fma(fma(-a, t, (z * y)), x, (-b * fma(-a, i, (c * z))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((j <= -1.75e+44) || !(j <= 5.4e+216)) tmp = Float64(fma(Float64(-i), y, Float64(c * t)) * j); else tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(-b) * fma(Float64(-a), i, Float64(c * z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -1.75e+44], N[Not[LessEqual[j, 5.4e+216]], $MachinePrecision]], N[(N[((-i) * y + N[(c * t), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * N[((-a) * i + N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -1.75 \cdot 10^{+44} \lor \neg \left(j \leq 5.4 \cdot 10^{+216}\right):\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot t\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(-b\right) \cdot \mathsf{fma}\left(-a, i, c \cdot z\right)\right)\\
\end{array}
\end{array}
if j < -1.75e44 or 5.4000000000000003e216 < j Initial program 74.1%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6472.1
Applied rewrites72.1%
if -1.75e44 < j < 5.4000000000000003e216Initial program 66.7%
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 rewrites67.0%
Final simplification68.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (- a) (fma t x (* (- b) i)))))
(if (<= a -1.3e+25)
t_1
(if (<= a 4.8e-81)
(* (fma j t (* (- b) z)) c)
(if (<= a 1.02e+101) (fma (- a) (* t x) (* 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 = -a * fma(t, x, (-b * i));
double tmp;
if (a <= -1.3e+25) {
tmp = t_1;
} else if (a <= 4.8e-81) {
tmp = fma(j, t, (-b * z)) * c;
} else if (a <= 1.02e+101) {
tmp = fma(-a, (t * x), (b * (-c * z)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(-a) * fma(t, x, Float64(Float64(-b) * i))) tmp = 0.0 if (a <= -1.3e+25) tmp = t_1; elseif (a <= 4.8e-81) tmp = Float64(fma(j, t, Float64(Float64(-b) * z)) * c); elseif (a <= 1.02e+101) tmp = fma(Float64(-a), Float64(t * x), Float64(b * Float64(Float64(-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[((-a) * N[(t * x + N[((-b) * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.3e+25], t$95$1, If[LessEqual[a, 4.8e-81], N[(N[(j * t + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[a, 1.02e+101], N[((-a) * N[(t * x), $MachinePrecision] + N[(b * N[((-c) * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot \mathsf{fma}\left(t, x, \left(-b\right) \cdot i\right)\\
\mathbf{if}\;a \leq -1.3 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4.8 \cdot 10^{-81}:\\
\;\;\;\;\mathsf{fma}\left(j, t, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{elif}\;a \leq 1.02 \cdot 10^{+101}:\\
\;\;\;\;\mathsf{fma}\left(-a, t \cdot x, b \cdot \left(\left(-c\right) \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.2999999999999999e25 or 1.02000000000000002e101 < a Initial program 56.7%
Taylor expanded in a 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.f6470.0
Applied rewrites70.0%
if -1.2999999999999999e25 < a < 4.7999999999999998e-81Initial program 75.8%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6453.2
Applied rewrites53.2%
if 4.7999999999999998e-81 < a < 1.02000000000000002e101Initial program 83.9%
Taylor expanded in c around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites71.4%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
Applied rewrites55.6%
Taylor expanded in z around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
Final simplification61.6%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= i -5.2e+16)
(fma (- i) (* j y) (+ (* (* z y) x) (* a (* i b))))
(if (<= i 7.5e+100)
(fma (fma (- b) z (* j t)) c (* (* (- a) t) x))
(* (- i) (fma j y (* (- a) b))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (i <= -5.2e+16) {
tmp = fma(-i, (j * y), (((z * y) * x) + (a * (i * b))));
} else if (i <= 7.5e+100) {
tmp = fma(fma(-b, z, (j * t)), c, ((-a * t) * x));
} else {
tmp = -i * fma(j, y, (-a * b));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (i <= -5.2e+16) tmp = fma(Float64(-i), Float64(j * y), Float64(Float64(Float64(z * y) * x) + Float64(a * Float64(i * b)))); elseif (i <= 7.5e+100) tmp = fma(fma(Float64(-b), z, Float64(j * t)), c, Float64(Float64(Float64(-a) * t) * x)); else tmp = Float64(Float64(-i) * fma(j, y, Float64(Float64(-a) * b))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[i, -5.2e+16], N[((-i) * N[(j * y), $MachinePrecision] + N[(N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision] + N[(a * N[(i * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 7.5e+100], N[(N[((-b) * z + N[(j * t), $MachinePrecision]), $MachinePrecision] * c + N[(N[((-a) * t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[((-i) * N[(j * y + N[((-a) * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5.2 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(-i, j \cdot y, \left(z \cdot y\right) \cdot x + a \cdot \left(i \cdot b\right)\right)\\
\mathbf{elif}\;i \leq 7.5 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-b, z, j \cdot t\right), c, \left(\left(-a\right) \cdot t\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-a\right) \cdot b\right)\\
\end{array}
\end{array}
if i < -5.2e16Initial program 58.1%
Taylor expanded in c around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites65.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6473.7
Applied rewrites73.7%
if -5.2e16 < i < 7.49999999999999983e100Initial program 75.4%
Taylor expanded in c around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites73.9%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
Applied rewrites67.3%
Taylor expanded in i around 0
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
associate-*r*N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6462.2
Applied rewrites62.2%
if 7.49999999999999983e100 < i Initial program 55.0%
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
mul-1-negN/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6461.9
Applied rewrites61.9%
Final simplification65.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) j (* z x)) y)))
(if (<= y -2.1e+120)
t_1
(if (<= y 1.9e-105)
(fma (fma (- b) z (* j t)) c (* (* (- a) t) x))
(if (<= y 1.85e+52) (* (fma i a (* (- 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 = fma(-i, j, (z * x)) * y;
double tmp;
if (y <= -2.1e+120) {
tmp = t_1;
} else if (y <= 1.9e-105) {
tmp = fma(fma(-b, z, (j * t)), c, ((-a * t) * x));
} else if (y <= 1.85e+52) {
tmp = fma(i, a, (-c * z)) * b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-i), j, Float64(z * x)) * y) tmp = 0.0 if (y <= -2.1e+120) tmp = t_1; elseif (y <= 1.9e-105) tmp = fma(fma(Float64(-b), z, Float64(j * t)), c, Float64(Float64(Float64(-a) * t) * x)); elseif (y <= 1.85e+52) tmp = Float64(fma(i, a, 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[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -2.1e+120], t$95$1, If[LessEqual[y, 1.9e-105], N[(N[((-b) * z + N[(j * t), $MachinePrecision]), $MachinePrecision] * c + N[(N[((-a) * t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e+52], N[(N[(i * a + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{if}\;y \leq -2.1 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-b, z, j \cdot t\right), c, \left(\left(-a\right) \cdot t\right) \cdot x\right)\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(i, a, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.1e120 or 1.85e52 < y Initial program 61.3%
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-*.f6468.9
Applied rewrites68.9%
if -2.1e120 < y < 1.8999999999999999e-105Initial program 72.8%
Taylor expanded in c around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites73.9%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-neg.f64N/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
Applied rewrites75.5%
Taylor expanded in i around 0
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
associate-*r*N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6465.2
Applied rewrites65.2%
if 1.8999999999999999e-105 < y < 1.85e52Initial program 70.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6459.6
Applied rewrites59.6%
Final simplification65.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* (- c) z) b)))
(if (<= b -4.2e+62)
t_1
(if (<= b -8.9e-72)
(* (* (- i) y) j)
(if (<= b -2.9e-186)
(* (* j t) c)
(if (<= b -1.5e-286)
(* (* z y) x)
(if (<= b 1.5e+37) (* (* (- a) t) x) t_1)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (-c * z) * b;
double tmp;
if (b <= -4.2e+62) {
tmp = t_1;
} else if (b <= -8.9e-72) {
tmp = (-i * y) * j;
} else if (b <= -2.9e-186) {
tmp = (j * t) * c;
} else if (b <= -1.5e-286) {
tmp = (z * y) * x;
} else if (b <= 1.5e+37) {
tmp = (-a * t) * x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = (-c * z) * b
if (b <= (-4.2d+62)) then
tmp = t_1
else if (b <= (-8.9d-72)) then
tmp = (-i * y) * j
else if (b <= (-2.9d-186)) then
tmp = (j * t) * c
else if (b <= (-1.5d-286)) then
tmp = (z * y) * x
else if (b <= 1.5d+37) then
tmp = (-a * t) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (-c * z) * b;
double tmp;
if (b <= -4.2e+62) {
tmp = t_1;
} else if (b <= -8.9e-72) {
tmp = (-i * y) * j;
} else if (b <= -2.9e-186) {
tmp = (j * t) * c;
} else if (b <= -1.5e-286) {
tmp = (z * y) * x;
} else if (b <= 1.5e+37) {
tmp = (-a * t) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (-c * z) * b tmp = 0 if b <= -4.2e+62: tmp = t_1 elif b <= -8.9e-72: tmp = (-i * y) * j elif b <= -2.9e-186: tmp = (j * t) * c elif b <= -1.5e-286: tmp = (z * y) * x elif b <= 1.5e+37: tmp = (-a * t) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(-c) * z) * b) tmp = 0.0 if (b <= -4.2e+62) tmp = t_1; elseif (b <= -8.9e-72) tmp = Float64(Float64(Float64(-i) * y) * j); elseif (b <= -2.9e-186) tmp = Float64(Float64(j * t) * c); elseif (b <= -1.5e-286) tmp = Float64(Float64(z * y) * x); elseif (b <= 1.5e+37) tmp = Float64(Float64(Float64(-a) * t) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (-c * z) * b; tmp = 0.0; if (b <= -4.2e+62) tmp = t_1; elseif (b <= -8.9e-72) tmp = (-i * y) * j; elseif (b <= -2.9e-186) tmp = (j * t) * c; elseif (b <= -1.5e-286) tmp = (z * y) * x; elseif (b <= 1.5e+37) tmp = (-a * t) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -4.2e+62], t$95$1, If[LessEqual[b, -8.9e-72], N[(N[((-i) * y), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[b, -2.9e-186], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[b, -1.5e-286], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[b, 1.5e+37], N[(N[((-a) * t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-c\right) \cdot z\right) \cdot b\\
\mathbf{if}\;b \leq -4.2 \cdot 10^{+62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -8.9 \cdot 10^{-72}:\\
\;\;\;\;\left(\left(-i\right) \cdot y\right) \cdot j\\
\mathbf{elif}\;b \leq -2.9 \cdot 10^{-186}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;b \leq -1.5 \cdot 10^{-286}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{+37}:\\
\;\;\;\;\left(\left(-a\right) \cdot t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -4.2e62 or 1.50000000000000011e37 < b Initial program 71.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6467.2
Applied rewrites67.2%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f6442.6
Applied rewrites42.6%
if -4.2e62 < b < -8.8999999999999998e-72Initial program 70.4%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6441.0
Applied rewrites41.0%
Taylor expanded in y around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6434.6
Applied rewrites34.6%
if -8.8999999999999998e-72 < b < -2.90000000000000019e-186Initial program 76.1%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6463.1
Applied rewrites63.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6449.1
Applied rewrites49.1%
if -2.90000000000000019e-186 < b < -1.5e-286Initial program 72.4%
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-*.f6469.0
Applied rewrites69.0%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6457.1
Applied rewrites57.1%
if -1.5e-286 < b < 1.50000000000000011e37Initial program 59.2%
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-*.f6451.7
Applied rewrites51.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6440.8
Applied rewrites40.8%
Final simplification43.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* (- c) z) b)))
(if (<= b -3.4e+88)
t_1
(if (<= b -6.8e-52)
(* (* i b) a)
(if (<= b -2.9e-186)
(* (* j t) c)
(if (<= b -1.5e-286)
(* (* z y) x)
(if (<= b 1.5e+37) (* (* (- a) t) x) t_1)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (-c * z) * b;
double tmp;
if (b <= -3.4e+88) {
tmp = t_1;
} else if (b <= -6.8e-52) {
tmp = (i * b) * a;
} else if (b <= -2.9e-186) {
tmp = (j * t) * c;
} else if (b <= -1.5e-286) {
tmp = (z * y) * x;
} else if (b <= 1.5e+37) {
tmp = (-a * t) * x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = (-c * z) * b
if (b <= (-3.4d+88)) then
tmp = t_1
else if (b <= (-6.8d-52)) then
tmp = (i * b) * a
else if (b <= (-2.9d-186)) then
tmp = (j * t) * c
else if (b <= (-1.5d-286)) then
tmp = (z * y) * x
else if (b <= 1.5d+37) then
tmp = (-a * t) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (-c * z) * b;
double tmp;
if (b <= -3.4e+88) {
tmp = t_1;
} else if (b <= -6.8e-52) {
tmp = (i * b) * a;
} else if (b <= -2.9e-186) {
tmp = (j * t) * c;
} else if (b <= -1.5e-286) {
tmp = (z * y) * x;
} else if (b <= 1.5e+37) {
tmp = (-a * t) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (-c * z) * b tmp = 0 if b <= -3.4e+88: tmp = t_1 elif b <= -6.8e-52: tmp = (i * b) * a elif b <= -2.9e-186: tmp = (j * t) * c elif b <= -1.5e-286: tmp = (z * y) * x elif b <= 1.5e+37: tmp = (-a * t) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(-c) * z) * b) tmp = 0.0 if (b <= -3.4e+88) tmp = t_1; elseif (b <= -6.8e-52) tmp = Float64(Float64(i * b) * a); elseif (b <= -2.9e-186) tmp = Float64(Float64(j * t) * c); elseif (b <= -1.5e-286) tmp = Float64(Float64(z * y) * x); elseif (b <= 1.5e+37) tmp = Float64(Float64(Float64(-a) * t) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (-c * z) * b; tmp = 0.0; if (b <= -3.4e+88) tmp = t_1; elseif (b <= -6.8e-52) tmp = (i * b) * a; elseif (b <= -2.9e-186) tmp = (j * t) * c; elseif (b <= -1.5e-286) tmp = (z * y) * x; elseif (b <= 1.5e+37) tmp = (-a * t) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -3.4e+88], t$95$1, If[LessEqual[b, -6.8e-52], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[b, -2.9e-186], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[b, -1.5e-286], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[b, 1.5e+37], N[(N[((-a) * t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-c\right) \cdot z\right) \cdot b\\
\mathbf{if}\;b \leq -3.4 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -6.8 \cdot 10^{-52}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{elif}\;b \leq -2.9 \cdot 10^{-186}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;b \leq -1.5 \cdot 10^{-286}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{+37}:\\
\;\;\;\;\left(\left(-a\right) \cdot t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -3.40000000000000004e88 or 1.50000000000000011e37 < b Initial program 73.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6467.2
Applied rewrites67.2%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f6444.0
Applied rewrites44.0%
if -3.40000000000000004e88 < b < -6.80000000000000035e-52Initial program 63.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6439.3
Applied rewrites39.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6433.1
Applied rewrites33.1%
if -6.80000000000000035e-52 < b < -2.90000000000000019e-186Initial program 74.2%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6460.5
Applied rewrites60.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6442.6
Applied rewrites42.6%
if -2.90000000000000019e-186 < b < -1.5e-286Initial program 72.4%
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-*.f6469.0
Applied rewrites69.0%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6457.1
Applied rewrites57.1%
if -1.5e-286 < b < 1.50000000000000011e37Initial program 59.2%
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-*.f6451.7
Applied rewrites51.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6440.8
Applied rewrites40.8%
Final simplification43.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* (- c) z) b)))
(if (<= b -3.4e+88)
t_1
(if (<= b -6.8e-52)
(* (* i b) a)
(if (<= b -2.9e-186)
(* (* j t) c)
(if (<= b 4.2e-276)
(* (* z y) x)
(if (<= b 1.5e+37) (* (- a) (* t x)) t_1)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (-c * z) * b;
double tmp;
if (b <= -3.4e+88) {
tmp = t_1;
} else if (b <= -6.8e-52) {
tmp = (i * b) * a;
} else if (b <= -2.9e-186) {
tmp = (j * t) * c;
} else if (b <= 4.2e-276) {
tmp = (z * y) * x;
} else if (b <= 1.5e+37) {
tmp = -a * (t * x);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = (-c * z) * b
if (b <= (-3.4d+88)) then
tmp = t_1
else if (b <= (-6.8d-52)) then
tmp = (i * b) * a
else if (b <= (-2.9d-186)) then
tmp = (j * t) * c
else if (b <= 4.2d-276) then
tmp = (z * y) * x
else if (b <= 1.5d+37) then
tmp = -a * (t * x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (-c * z) * b;
double tmp;
if (b <= -3.4e+88) {
tmp = t_1;
} else if (b <= -6.8e-52) {
tmp = (i * b) * a;
} else if (b <= -2.9e-186) {
tmp = (j * t) * c;
} else if (b <= 4.2e-276) {
tmp = (z * y) * x;
} else if (b <= 1.5e+37) {
tmp = -a * (t * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (-c * z) * b tmp = 0 if b <= -3.4e+88: tmp = t_1 elif b <= -6.8e-52: tmp = (i * b) * a elif b <= -2.9e-186: tmp = (j * t) * c elif b <= 4.2e-276: tmp = (z * y) * x elif b <= 1.5e+37: tmp = -a * (t * x) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(-c) * z) * b) tmp = 0.0 if (b <= -3.4e+88) tmp = t_1; elseif (b <= -6.8e-52) tmp = Float64(Float64(i * b) * a); elseif (b <= -2.9e-186) tmp = Float64(Float64(j * t) * c); elseif (b <= 4.2e-276) tmp = Float64(Float64(z * y) * x); elseif (b <= 1.5e+37) tmp = Float64(Float64(-a) * Float64(t * x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (-c * z) * b; tmp = 0.0; if (b <= -3.4e+88) tmp = t_1; elseif (b <= -6.8e-52) tmp = (i * b) * a; elseif (b <= -2.9e-186) tmp = (j * t) * c; elseif (b <= 4.2e-276) tmp = (z * y) * x; elseif (b <= 1.5e+37) tmp = -a * (t * x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -3.4e+88], t$95$1, If[LessEqual[b, -6.8e-52], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[b, -2.9e-186], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[b, 4.2e-276], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[b, 1.5e+37], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-c\right) \cdot z\right) \cdot b\\
\mathbf{if}\;b \leq -3.4 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -6.8 \cdot 10^{-52}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{elif}\;b \leq -2.9 \cdot 10^{-186}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{-276}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{+37}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -3.40000000000000004e88 or 1.50000000000000011e37 < b Initial program 73.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6467.2
Applied rewrites67.2%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f6444.0
Applied rewrites44.0%
if -3.40000000000000004e88 < b < -6.80000000000000035e-52Initial program 63.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6439.3
Applied rewrites39.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6433.1
Applied rewrites33.1%
if -6.80000000000000035e-52 < b < -2.90000000000000019e-186Initial program 74.2%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6460.5
Applied rewrites60.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6442.6
Applied rewrites42.6%
if -2.90000000000000019e-186 < b < 4.2e-276Initial program 64.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-*.f6457.7
Applied rewrites57.7%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6447.1
Applied rewrites47.1%
if 4.2e-276 < b < 1.50000000000000011e37Initial program 61.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-*.f6455.6
Applied rewrites55.6%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f64N/A
lower-*.f6438.6
Applied rewrites38.6%
Final simplification42.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma i a (* (- c) z)) b)))
(if (<= b -1.1e-47)
t_1
(if (<= b -2.9e-186)
(* (* j t) c)
(if (<= b -1.5e-286)
(* (* z y) x)
(if (<= b 5.6e-71) (* (* (- a) t) x) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(i, a, (-c * z)) * b;
double tmp;
if (b <= -1.1e-47) {
tmp = t_1;
} else if (b <= -2.9e-186) {
tmp = (j * t) * c;
} else if (b <= -1.5e-286) {
tmp = (z * y) * x;
} else if (b <= 5.6e-71) {
tmp = (-a * t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(i, a, Float64(Float64(-c) * z)) * b) tmp = 0.0 if (b <= -1.1e-47) tmp = t_1; elseif (b <= -2.9e-186) tmp = Float64(Float64(j * t) * c); elseif (b <= -1.5e-286) tmp = Float64(Float64(z * y) * x); elseif (b <= 5.6e-71) tmp = Float64(Float64(Float64(-a) * t) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(i * a + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -1.1e-47], t$95$1, If[LessEqual[b, -2.9e-186], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[b, -1.5e-286], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[b, 5.6e-71], N[(N[((-a) * t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, a, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{if}\;b \leq -1.1 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -2.9 \cdot 10^{-186}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;b \leq -1.5 \cdot 10^{-286}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{-71}:\\
\;\;\;\;\left(\left(-a\right) \cdot t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.10000000000000009e-47 or 5.60000000000000001e-71 < b Initial program 71.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6457.7
Applied rewrites57.7%
if -1.10000000000000009e-47 < b < -2.90000000000000019e-186Initial program 71.6%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6458.3
Applied rewrites58.3%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6441.2
Applied rewrites41.2%
if -2.90000000000000019e-186 < b < -1.5e-286Initial program 72.4%
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-*.f6469.0
Applied rewrites69.0%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6457.1
Applied rewrites57.1%
if -1.5e-286 < b < 5.60000000000000001e-71Initial program 55.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-*.f6455.2
Applied rewrites55.2%
Taylor expanded in y around 0
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6446.3
Applied rewrites46.3%
Final simplification53.7%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= a -1.9e+72)
(* (* b a) i)
(if (<= a 4.8e-81)
(* (* j t) c)
(if (or (<= a 1.15e+113) (not (<= a 1.8e+173)))
(* (- a) (* t x))
(* (* i a) b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (a <= -1.9e+72) {
tmp = (b * a) * i;
} else if (a <= 4.8e-81) {
tmp = (j * t) * c;
} else if ((a <= 1.15e+113) || !(a <= 1.8e+173)) {
tmp = -a * (t * x);
} else {
tmp = (i * a) * 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 (a <= (-1.9d+72)) then
tmp = (b * a) * i
else if (a <= 4.8d-81) then
tmp = (j * t) * c
else if ((a <= 1.15d+113) .or. (.not. (a <= 1.8d+173))) then
tmp = -a * (t * x)
else
tmp = (i * a) * 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 (a <= -1.9e+72) {
tmp = (b * a) * i;
} else if (a <= 4.8e-81) {
tmp = (j * t) * c;
} else if ((a <= 1.15e+113) || !(a <= 1.8e+173)) {
tmp = -a * (t * x);
} else {
tmp = (i * a) * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if a <= -1.9e+72: tmp = (b * a) * i elif a <= 4.8e-81: tmp = (j * t) * c elif (a <= 1.15e+113) or not (a <= 1.8e+173): tmp = -a * (t * x) else: tmp = (i * a) * b return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (a <= -1.9e+72) tmp = Float64(Float64(b * a) * i); elseif (a <= 4.8e-81) tmp = Float64(Float64(j * t) * c); elseif ((a <= 1.15e+113) || !(a <= 1.8e+173)) tmp = Float64(Float64(-a) * Float64(t * x)); else tmp = Float64(Float64(i * a) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (a <= -1.9e+72) tmp = (b * a) * i; elseif (a <= 4.8e-81) tmp = (j * t) * c; elseif ((a <= 1.15e+113) || ~((a <= 1.8e+173))) tmp = -a * (t * x); else tmp = (i * a) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[a, -1.9e+72], N[(N[(b * a), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[a, 4.8e-81], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[Or[LessEqual[a, 1.15e+113], N[Not[LessEqual[a, 1.8e+173]], $MachinePrecision]], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], N[(N[(i * a), $MachinePrecision] * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{+72}:\\
\;\;\;\;\left(b \cdot a\right) \cdot i\\
\mathbf{elif}\;a \leq 4.8 \cdot 10^{-81}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;a \leq 1.15 \cdot 10^{+113} \lor \neg \left(a \leq 1.8 \cdot 10^{+173}\right):\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot a\right) \cdot b\\
\end{array}
\end{array}
if a < -1.90000000000000003e72Initial program 57.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6446.7
Applied rewrites46.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6438.2
Applied rewrites38.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6444.8
Applied rewrites44.8%
if -1.90000000000000003e72 < a < 4.7999999999999998e-81Initial program 75.1%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6447.9
Applied rewrites47.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6430.7
Applied rewrites30.7%
if 4.7999999999999998e-81 < a < 1.14999999999999998e113 or 1.8000000000000001e173 < a Initial program 65.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-*.f6445.6
Applied rewrites45.6%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f64N/A
lower-*.f6442.7
Applied rewrites42.7%
if 1.14999999999999998e113 < a < 1.8000000000000001e173Initial program 74.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6475.0
Applied rewrites75.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6466.6
Applied rewrites66.6%
Final simplification39.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma i a (* (- c) z)) b)))
(if (<= b -0.01)
t_1
(if (<= b -9.2e-190)
(* (fma j c (* (- a) x)) t)
(if (<= b 4.5e+37) (* (fma (- a) t (* z y)) x) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(i, a, (-c * z)) * b;
double tmp;
if (b <= -0.01) {
tmp = t_1;
} else if (b <= -9.2e-190) {
tmp = fma(j, c, (-a * x)) * t;
} else if (b <= 4.5e+37) {
tmp = fma(-a, t, (z * y)) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(i, a, Float64(Float64(-c) * z)) * b) tmp = 0.0 if (b <= -0.01) tmp = t_1; elseif (b <= -9.2e-190) tmp = Float64(fma(j, c, Float64(Float64(-a) * x)) * t); elseif (b <= 4.5e+37) tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(i * a + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -0.01], t$95$1, If[LessEqual[b, -9.2e-190], N[(N[(j * c + N[((-a) * x), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[b, 4.5e+37], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, a, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{if}\;b \leq -0.01:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -9.2 \cdot 10^{-190}:\\
\;\;\;\;\mathsf{fma}\left(j, c, \left(-a\right) \cdot x\right) \cdot t\\
\mathbf{elif}\;b \leq 4.5 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -0.0100000000000000002 or 4.49999999999999962e37 < b Initial program 71.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6464.9
Applied rewrites64.9%
if -0.0100000000000000002 < b < -9.19999999999999968e-190Initial program 72.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6452.6
Applied rewrites52.6%
lift-neg.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6452.6
Applied rewrites52.6%
if -9.19999999999999968e-190 < b < 4.49999999999999962e37Initial program 62.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-*.f6456.5
Applied rewrites56.5%
Final simplification60.1%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -1.3e+25) (not (<= a 4.8e-81))) (* (- a) (fma t x (* (- b) i))) (* (fma j t (* (- b) z)) c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -1.3e+25) || !(a <= 4.8e-81)) {
tmp = -a * fma(t, x, (-b * i));
} else {
tmp = fma(j, t, (-b * z)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -1.3e+25) || !(a <= 4.8e-81)) tmp = Float64(Float64(-a) * fma(t, x, Float64(Float64(-b) * i))); else tmp = Float64(fma(j, t, Float64(Float64(-b) * z)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -1.3e+25], N[Not[LessEqual[a, 4.8e-81]], $MachinePrecision]], N[((-a) * N[(t * x + N[((-b) * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(j * t + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.3 \cdot 10^{+25} \lor \neg \left(a \leq 4.8 \cdot 10^{-81}\right):\\
\;\;\;\;\left(-a\right) \cdot \mathsf{fma}\left(t, x, \left(-b\right) \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(j, t, \left(-b\right) \cdot z\right) \cdot c\\
\end{array}
\end{array}
if a < -1.2999999999999999e25 or 4.7999999999999998e-81 < a Initial program 63.5%
Taylor expanded in a 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.f6463.7
Applied rewrites63.7%
if -1.2999999999999999e25 < a < 4.7999999999999998e-81Initial program 75.8%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6453.2
Applied rewrites53.2%
Final simplification59.3%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= b -0.01) (not (<= b 4.5e+37))) (* (fma i a (* (- c) z)) b) (* (fma j c (* (- a) x)) t)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((b <= -0.01) || !(b <= 4.5e+37)) {
tmp = fma(i, a, (-c * z)) * b;
} else {
tmp = fma(j, c, (-a * x)) * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((b <= -0.01) || !(b <= 4.5e+37)) tmp = Float64(fma(i, a, Float64(Float64(-c) * z)) * b); else tmp = Float64(fma(j, c, Float64(Float64(-a) * x)) * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[b, -0.01], N[Not[LessEqual[b, 4.5e+37]], $MachinePrecision]], N[(N[(i * a + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(N[(j * c + N[((-a) * x), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.01 \lor \neg \left(b \leq 4.5 \cdot 10^{+37}\right):\\
\;\;\;\;\mathsf{fma}\left(i, a, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(j, c, \left(-a\right) \cdot x\right) \cdot t\\
\end{array}
\end{array}
if b < -0.0100000000000000002 or 4.49999999999999962e37 < b Initial program 71.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6464.9
Applied rewrites64.9%
if -0.0100000000000000002 < b < 4.49999999999999962e37Initial program 65.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6449.0
Applied rewrites49.0%
lift-neg.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6449.0
Applied rewrites49.0%
Final simplification56.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* z y) x)))
(if (<= x -0.034)
t_1
(if (<= x 1.1e-152)
(* (* i b) a)
(if (<= x 680000.0) (* (* j t) 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 = (z * y) * x;
double tmp;
if (x <= -0.034) {
tmp = t_1;
} else if (x <= 1.1e-152) {
tmp = (i * b) * a;
} else if (x <= 680000.0) {
tmp = (j * t) * c;
} 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 = (z * y) * x
if (x <= (-0.034d0)) then
tmp = t_1
else if (x <= 1.1d-152) then
tmp = (i * b) * a
else if (x <= 680000.0d0) then
tmp = (j * t) * c
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 = (z * y) * x;
double tmp;
if (x <= -0.034) {
tmp = t_1;
} else if (x <= 1.1e-152) {
tmp = (i * b) * a;
} else if (x <= 680000.0) {
tmp = (j * t) * c;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (z * y) * x tmp = 0 if x <= -0.034: tmp = t_1 elif x <= 1.1e-152: tmp = (i * b) * a elif x <= 680000.0: tmp = (j * t) * c else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(z * y) * x) tmp = 0.0 if (x <= -0.034) tmp = t_1; elseif (x <= 1.1e-152) tmp = Float64(Float64(i * b) * a); elseif (x <= 680000.0) tmp = Float64(Float64(j * t) * c); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (z * y) * x; tmp = 0.0; if (x <= -0.034) tmp = t_1; elseif (x <= 1.1e-152) tmp = (i * b) * a; elseif (x <= 680000.0) tmp = (j * t) * c; 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[(z * y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -0.034], t$95$1, If[LessEqual[x, 1.1e-152], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[x, 680000.0], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot y\right) \cdot x\\
\mathbf{if}\;x \leq -0.034:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-152}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{elif}\;x \leq 680000:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -0.034000000000000002 or 6.8e5 < x Initial program 68.7%
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-*.f6458.8
Applied rewrites58.8%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6435.2
Applied rewrites35.2%
if -0.034000000000000002 < x < 1.09999999999999992e-152Initial program 68.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6452.9
Applied rewrites52.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6437.1
Applied rewrites37.1%
if 1.09999999999999992e-152 < x < 6.8e5Initial program 69.0%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6452.6
Applied rewrites52.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.8%
Final simplification36.0%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= a -1.9e+72) (* (* b a) i) (if (<= a 7.9e-10) (* (* j t) c) (* (* i a) b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (a <= -1.9e+72) {
tmp = (b * a) * i;
} else if (a <= 7.9e-10) {
tmp = (j * t) * c;
} else {
tmp = (i * a) * 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 (a <= (-1.9d+72)) then
tmp = (b * a) * i
else if (a <= 7.9d-10) then
tmp = (j * t) * c
else
tmp = (i * a) * 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 (a <= -1.9e+72) {
tmp = (b * a) * i;
} else if (a <= 7.9e-10) {
tmp = (j * t) * c;
} else {
tmp = (i * a) * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if a <= -1.9e+72: tmp = (b * a) * i elif a <= 7.9e-10: tmp = (j * t) * c else: tmp = (i * a) * b return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (a <= -1.9e+72) tmp = Float64(Float64(b * a) * i); elseif (a <= 7.9e-10) tmp = Float64(Float64(j * t) * c); else tmp = Float64(Float64(i * a) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (a <= -1.9e+72) tmp = (b * a) * i; elseif (a <= 7.9e-10) tmp = (j * t) * c; else tmp = (i * a) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[a, -1.9e+72], N[(N[(b * a), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[a, 7.9e-10], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], N[(N[(i * a), $MachinePrecision] * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{+72}:\\
\;\;\;\;\left(b \cdot a\right) \cdot i\\
\mathbf{elif}\;a \leq 7.9 \cdot 10^{-10}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot a\right) \cdot b\\
\end{array}
\end{array}
if a < -1.90000000000000003e72Initial program 57.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6446.7
Applied rewrites46.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6438.2
Applied rewrites38.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6444.8
Applied rewrites44.8%
if -1.90000000000000003e72 < a < 7.8999999999999996e-10Initial program 75.4%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6445.1
Applied rewrites45.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6428.4
Applied rewrites28.4%
if 7.8999999999999996e-10 < a Initial program 65.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6448.7
Applied rewrites48.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6433.9
Applied rewrites33.9%
Final simplification33.7%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= a -1.9e+72) (* (* b a) i) (if (<= a 7.9e-10) (* (* j t) c) (* (* i b) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (a <= -1.9e+72) {
tmp = (b * a) * i;
} else if (a <= 7.9e-10) {
tmp = (j * t) * c;
} else {
tmp = (i * b) * 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 (a <= (-1.9d+72)) then
tmp = (b * a) * i
else if (a <= 7.9d-10) then
tmp = (j * t) * c
else
tmp = (i * b) * 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 (a <= -1.9e+72) {
tmp = (b * a) * i;
} else if (a <= 7.9e-10) {
tmp = (j * t) * c;
} else {
tmp = (i * b) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if a <= -1.9e+72: tmp = (b * a) * i elif a <= 7.9e-10: tmp = (j * t) * c else: tmp = (i * b) * a return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (a <= -1.9e+72) tmp = Float64(Float64(b * a) * i); elseif (a <= 7.9e-10) tmp = Float64(Float64(j * t) * c); else tmp = Float64(Float64(i * b) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (a <= -1.9e+72) tmp = (b * a) * i; elseif (a <= 7.9e-10) tmp = (j * t) * c; else tmp = (i * b) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[a, -1.9e+72], N[(N[(b * a), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[a, 7.9e-10], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{+72}:\\
\;\;\;\;\left(b \cdot a\right) \cdot i\\
\mathbf{elif}\;a \leq 7.9 \cdot 10^{-10}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\end{array}
\end{array}
if a < -1.90000000000000003e72Initial program 57.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6446.7
Applied rewrites46.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6438.2
Applied rewrites38.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6444.8
Applied rewrites44.8%
if -1.90000000000000003e72 < a < 7.8999999999999996e-10Initial program 75.4%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6445.1
Applied rewrites45.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6428.4
Applied rewrites28.4%
if 7.8999999999999996e-10 < a Initial program 65.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6448.7
Applied rewrites48.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6432.5
Applied rewrites32.5%
Final simplification33.3%
(FPCore (x y z t a b c i j) :precision binary64 (* (* b a) i))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (b * a) * 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 = (b * a) * 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 (b * a) * i;
}
def code(x, y, z, t, a, b, c, i, j): return (b * a) * i
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(b * a) * i) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (b * a) * i; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(b * a), $MachinePrecision] * i), $MachinePrecision]
\begin{array}{l}
\\
\left(b \cdot a\right) \cdot i
\end{array}
Initial program 68.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6440.4
Applied rewrites40.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6421.9
Applied rewrites21.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6422.6
Applied rewrites22.6%
Final simplification22.6%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(/
(* j (- (pow (* c t) 2.0) (pow (* i y) 2.0)))
(+ (* c t) (* i y)))))
(t_2
(-
(* x (- (* z y) (* a t)))
(- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j)))))
(if (< t -8.120978919195912e-33)
t_2
(if (< t -4.712553818218485e-169)
t_1
(if (< t -7.633533346031584e-308)
t_2
(if (< t 1.0535888557455487e-139) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (pow((c * t), 2.0) - pow((i * y), 2.0))) / ((c * t) + (i * y)));
double t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j));
double tmp;
if (t < -8.120978919195912e-33) {
tmp = t_2;
} else if (t < -4.712553818218485e-169) {
tmp = t_1;
} else if (t < -7.633533346031584e-308) {
tmp = t_2;
} else if (t < 1.0535888557455487e-139) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (((c * t) ** 2.0d0) - ((i * y) ** 2.0d0))) / ((c * t) + (i * y)))
t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j))
if (t < (-8.120978919195912d-33)) then
tmp = t_2
else if (t < (-4.712553818218485d-169)) then
tmp = t_1
else if (t < (-7.633533346031584d-308)) then
tmp = t_2
else if (t < 1.0535888557455487d-139) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (Math.pow((c * t), 2.0) - Math.pow((i * y), 2.0))) / ((c * t) + (i * y)));
double t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j));
double tmp;
if (t < -8.120978919195912e-33) {
tmp = t_2;
} else if (t < -4.712553818218485e-169) {
tmp = t_1;
} else if (t < -7.633533346031584e-308) {
tmp = t_2;
} else if (t < 1.0535888557455487e-139) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (math.pow((c * t), 2.0) - math.pow((i * y), 2.0))) / ((c * t) + (i * y))) t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j)) tmp = 0 if t < -8.120978919195912e-33: tmp = t_2 elif t < -4.712553818218485e-169: tmp = t_1 elif t < -7.633533346031584e-308: tmp = t_2 elif t < 1.0535888557455487e-139: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(Float64(j * Float64((Float64(c * t) ^ 2.0) - (Float64(i * y) ^ 2.0))) / Float64(Float64(c * t) + Float64(i * y)))) t_2 = Float64(Float64(x * Float64(Float64(z * y) - Float64(a * t))) - Float64(Float64(b * Float64(Float64(z * c) - Float64(a * i))) - Float64(Float64(Float64(c * t) - Float64(y * i)) * j))) tmp = 0.0 if (t < -8.120978919195912e-33) tmp = t_2; elseif (t < -4.712553818218485e-169) tmp = t_1; elseif (t < -7.633533346031584e-308) tmp = t_2; elseif (t < 1.0535888557455487e-139) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (((c * t) ^ 2.0) - ((i * y) ^ 2.0))) / ((c * t) + (i * y))); t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j)); tmp = 0.0; if (t < -8.120978919195912e-33) tmp = t_2; elseif (t < -4.712553818218485e-169) tmp = t_1; elseif (t < -7.633533346031584e-308) tmp = t_2; elseif (t < 1.0535888557455487e-139) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(j * N[(N[Power[N[(c * t), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(i * y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(c * t), $MachinePrecision] + N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(N[(z * y), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(b * N[(N[(z * c), $MachinePrecision] - N[(a * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(c * t), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -8.120978919195912e-33], t$95$2, If[Less[t, -4.712553818218485e-169], t$95$1, If[Less[t, -7.633533346031584e-308], t$95$2, If[Less[t, 1.0535888557455487e-139], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\
t_2 := x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\
\mathbf{if}\;t < -8.120978919195912 \cdot 10^{-33}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < -4.712553818218485 \cdot 10^{-169}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t < -7.633533346031584 \cdot 10^{-308}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < 1.0535888557455487 \cdot 10^{-139}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2025064
(FPCore (x y z t a b c i j)
:name "Linear.Matrix:det33 from linear-1.19.1.3"
:precision binary64
:alt
(! :herbie-platform default (if (< t -1015122364899489/125000000000000000000000000000000000000000000000) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t -942510763643697/2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2) (pow (* i y) 2))) (+ (* c t) (* i y)))) (if (< t -238547917063487/3125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t 10535888557455487/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2) (pow (* i y) 2))) (+ (* c t) (* i y)))) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))