
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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
code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 25 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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
code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (fma (- (+ t y) 2.0) b (- x (fma (- t 1.0) a (* (- y 1.0) z)))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(((t + y) - 2.0), b, (x - fma((t - 1.0), a, ((y - 1.0) * z))));
}
function code(x, y, z, t, a, b) return fma(Float64(Float64(t + y) - 2.0), b, Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z)))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(t + y\right) - 2, b, x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\right)
\end{array}
Initial program 96.1%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites98.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- x (* z y))) (t_2 (* (- b a) t)) (t_3 (+ a (* y b))))
(if (<= t -3.1e+112)
t_2
(if (<= t -1.3e+45)
t_1
(if (<= t -1.15e-26)
(* (- 1.0 y) z)
(if (<= t -9.5e-141)
t_3
(if (<= t 4.3e-247)
t_1
(if (<= t 1.55e-31)
t_3
(if (<= t 7.5e+122) (+ x (* b y)) t_2)))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x - (z * y);
double t_2 = (b - a) * t;
double t_3 = a + (y * b);
double tmp;
if (t <= -3.1e+112) {
tmp = t_2;
} else if (t <= -1.3e+45) {
tmp = t_1;
} else if (t <= -1.15e-26) {
tmp = (1.0 - y) * z;
} else if (t <= -9.5e-141) {
tmp = t_3;
} else if (t <= 4.3e-247) {
tmp = t_1;
} else if (t <= 1.55e-31) {
tmp = t_3;
} else if (t <= 7.5e+122) {
tmp = x + (b * y);
} 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)
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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = x - (z * y)
t_2 = (b - a) * t
t_3 = a + (y * b)
if (t <= (-3.1d+112)) then
tmp = t_2
else if (t <= (-1.3d+45)) then
tmp = t_1
else if (t <= (-1.15d-26)) then
tmp = (1.0d0 - y) * z
else if (t <= (-9.5d-141)) then
tmp = t_3
else if (t <= 4.3d-247) then
tmp = t_1
else if (t <= 1.55d-31) then
tmp = t_3
else if (t <= 7.5d+122) then
tmp = x + (b * y)
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 t_1 = x - (z * y);
double t_2 = (b - a) * t;
double t_3 = a + (y * b);
double tmp;
if (t <= -3.1e+112) {
tmp = t_2;
} else if (t <= -1.3e+45) {
tmp = t_1;
} else if (t <= -1.15e-26) {
tmp = (1.0 - y) * z;
} else if (t <= -9.5e-141) {
tmp = t_3;
} else if (t <= 4.3e-247) {
tmp = t_1;
} else if (t <= 1.55e-31) {
tmp = t_3;
} else if (t <= 7.5e+122) {
tmp = x + (b * y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x - (z * y) t_2 = (b - a) * t t_3 = a + (y * b) tmp = 0 if t <= -3.1e+112: tmp = t_2 elif t <= -1.3e+45: tmp = t_1 elif t <= -1.15e-26: tmp = (1.0 - y) * z elif t <= -9.5e-141: tmp = t_3 elif t <= 4.3e-247: tmp = t_1 elif t <= 1.55e-31: tmp = t_3 elif t <= 7.5e+122: tmp = x + (b * y) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x - Float64(z * y)) t_2 = Float64(Float64(b - a) * t) t_3 = Float64(a + Float64(y * b)) tmp = 0.0 if (t <= -3.1e+112) tmp = t_2; elseif (t <= -1.3e+45) tmp = t_1; elseif (t <= -1.15e-26) tmp = Float64(Float64(1.0 - y) * z); elseif (t <= -9.5e-141) tmp = t_3; elseif (t <= 4.3e-247) tmp = t_1; elseif (t <= 1.55e-31) tmp = t_3; elseif (t <= 7.5e+122) tmp = Float64(x + Float64(b * y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x - (z * y); t_2 = (b - a) * t; t_3 = a + (y * b); tmp = 0.0; if (t <= -3.1e+112) tmp = t_2; elseif (t <= -1.3e+45) tmp = t_1; elseif (t <= -1.15e-26) tmp = (1.0 - y) * z; elseif (t <= -9.5e-141) tmp = t_3; elseif (t <= 4.3e-247) tmp = t_1; elseif (t <= 1.55e-31) tmp = t_3; elseif (t <= 7.5e+122) tmp = x + (b * y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$3 = N[(a + N[(y * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.1e+112], t$95$2, If[LessEqual[t, -1.3e+45], t$95$1, If[LessEqual[t, -1.15e-26], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t, -9.5e-141], t$95$3, If[LessEqual[t, 4.3e-247], t$95$1, If[LessEqual[t, 1.55e-31], t$95$3, If[LessEqual[t, 7.5e+122], N[(x + N[(b * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - z \cdot y\\
t_2 := \left(b - a\right) \cdot t\\
t_3 := a + y \cdot b\\
\mathbf{if}\;t \leq -3.1 \cdot 10^{+112}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -1.3 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.15 \cdot 10^{-26}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{elif}\;t \leq -9.5 \cdot 10^{-141}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{-247}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{-31}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{+122}:\\
\;\;\;\;x + b \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -3.09999999999999983e112 or 7.5000000000000002e122 < t Initial program 91.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6477.0
Applied rewrites77.0%
if -3.09999999999999983e112 < t < -1.30000000000000004e45 or -9.49999999999999996e-141 < t < 4.30000000000000005e-247Initial program 98.1%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6482.1
Applied rewrites82.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6460.6
Applied rewrites60.6%
if -1.30000000000000004e45 < t < -1.15000000000000004e-26Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6459.3
Applied rewrites59.3%
if -1.15000000000000004e-26 < t < -9.49999999999999996e-141 or 4.30000000000000005e-247 < t < 1.55e-31Initial program 97.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.1
Applied rewrites66.1%
Taylor expanded in t around 0
Applied rewrites66.1%
Taylor expanded in y around inf
Applied rewrites58.3%
if 1.55e-31 < t < 7.5000000000000002e122Initial program 96.7%
Taylor expanded in x around inf
Applied rewrites66.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.0
Applied rewrites38.0%
Taylor expanded in y around inf
lower-*.f6456.1
Applied rewrites56.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- y 1.0) z)))
(if (or (<= b -9.5e-47) (not (<= b 2.2e-42)))
(fma (- (+ t y) 2.0) b (- x t_1))
(- x (fma (- t 1.0) a t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y - 1.0) * z;
double tmp;
if ((b <= -9.5e-47) || !(b <= 2.2e-42)) {
tmp = fma(((t + y) - 2.0), b, (x - t_1));
} else {
tmp = x - fma((t - 1.0), a, t_1);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y - 1.0) * z) tmp = 0.0 if ((b <= -9.5e-47) || !(b <= 2.2e-42)) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x - t_1)); else tmp = Float64(x - fma(Float64(t - 1.0), a, t_1)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]}, If[Or[LessEqual[b, -9.5e-47], N[Not[LessEqual[b, 2.2e-42]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - t$95$1), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - 1\right) \cdot z\\
\mathbf{if}\;b \leq -9.5 \cdot 10^{-47} \lor \neg \left(b \leq 2.2 \cdot 10^{-42}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, t\_1\right)\\
\end{array}
\end{array}
if b < -9.4999999999999991e-47 or 2.20000000000000005e-42 < b Initial program 92.9%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites96.5%
Taylor expanded in z around inf
*-commutativeN/A
lift-*.f64N/A
lift--.f6487.6
Applied rewrites87.6%
if -9.4999999999999991e-47 < b < 2.20000000000000005e-42Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6495.8
Applied rewrites95.8%
Final simplification91.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- y 1.0) z)))
(if (or (<= b -9.5e-47) (not (<= b 2.2e-42)))
(- (fma (- (+ t y) 2.0) b x) t_1)
(- x (fma (- t 1.0) a t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y - 1.0) * z;
double tmp;
if ((b <= -9.5e-47) || !(b <= 2.2e-42)) {
tmp = fma(((t + y) - 2.0), b, x) - t_1;
} else {
tmp = x - fma((t - 1.0), a, t_1);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y - 1.0) * z) tmp = 0.0 if ((b <= -9.5e-47) || !(b <= 2.2e-42)) tmp = Float64(fma(Float64(Float64(t + y) - 2.0), b, x) - t_1); else tmp = Float64(x - fma(Float64(t - 1.0), a, t_1)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]}, If[Or[LessEqual[b, -9.5e-47], N[Not[LessEqual[b, 2.2e-42]], $MachinePrecision]], N[(N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision] - t$95$1), $MachinePrecision], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - 1\right) \cdot z\\
\mathbf{if}\;b \leq -9.5 \cdot 10^{-47} \lor \neg \left(b \leq 2.2 \cdot 10^{-42}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, t\_1\right)\\
\end{array}
\end{array}
if b < -9.4999999999999991e-47 or 2.20000000000000005e-42 < b Initial program 92.9%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6486.2
Applied rewrites86.2%
if -9.4999999999999991e-47 < b < 2.20000000000000005e-42Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6495.8
Applied rewrites95.8%
Final simplification90.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -3.1e+112)
t_1
(if (<= t -1.3e+45)
(- x (* z y))
(if (<= t -2.4e-27)
(* (- 1.0 y) z)
(if (<= t 7.5e+122) (+ x (* b y)) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -3.1e+112) {
tmp = t_1;
} else if (t <= -1.3e+45) {
tmp = x - (z * y);
} else if (t <= -2.4e-27) {
tmp = (1.0 - y) * z;
} else if (t <= 7.5e+122) {
tmp = x + (b * y);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = (b - a) * t
if (t <= (-3.1d+112)) then
tmp = t_1
else if (t <= (-1.3d+45)) then
tmp = x - (z * y)
else if (t <= (-2.4d-27)) then
tmp = (1.0d0 - y) * z
else if (t <= 7.5d+122) then
tmp = x + (b * y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -3.1e+112) {
tmp = t_1;
} else if (t <= -1.3e+45) {
tmp = x - (z * y);
} else if (t <= -2.4e-27) {
tmp = (1.0 - y) * z;
} else if (t <= 7.5e+122) {
tmp = x + (b * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - a) * t tmp = 0 if t <= -3.1e+112: tmp = t_1 elif t <= -1.3e+45: tmp = x - (z * y) elif t <= -2.4e-27: tmp = (1.0 - y) * z elif t <= 7.5e+122: tmp = x + (b * y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -3.1e+112) tmp = t_1; elseif (t <= -1.3e+45) tmp = Float64(x - Float64(z * y)); elseif (t <= -2.4e-27) tmp = Float64(Float64(1.0 - y) * z); elseif (t <= 7.5e+122) tmp = Float64(x + Float64(b * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b - a) * t; tmp = 0.0; if (t <= -3.1e+112) tmp = t_1; elseif (t <= -1.3e+45) tmp = x - (z * y); elseif (t <= -2.4e-27) tmp = (1.0 - y) * z; elseif (t <= 7.5e+122) tmp = x + (b * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -3.1e+112], t$95$1, If[LessEqual[t, -1.3e+45], N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.4e-27], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t, 7.5e+122], N[(x + N[(b * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -3.1 \cdot 10^{+112}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.3 \cdot 10^{+45}:\\
\;\;\;\;x - z \cdot y\\
\mathbf{elif}\;t \leq -2.4 \cdot 10^{-27}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{+122}:\\
\;\;\;\;x + b \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.09999999999999983e112 or 7.5000000000000002e122 < t Initial program 91.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6477.0
Applied rewrites77.0%
if -3.09999999999999983e112 < t < -1.30000000000000004e45Initial program 95.5%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6486.6
Applied rewrites86.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6460.4
Applied rewrites60.4%
if -1.30000000000000004e45 < t < -2.40000000000000002e-27Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6459.3
Applied rewrites59.3%
if -2.40000000000000002e-27 < t < 7.5000000000000002e122Initial program 97.9%
Taylor expanded in x around inf
Applied rewrites58.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6432.8
Applied rewrites32.8%
Taylor expanded in y around inf
lower-*.f6449.7
Applied rewrites49.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.55e+20) (not (<= b 2.5e-42))) (fma (- (+ t y) 2.0) b (- x (- z))) (- x (fma (- t 1.0) a (* (- y 1.0) z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.55e+20) || !(b <= 2.5e-42)) {
tmp = fma(((t + y) - 2.0), b, (x - -z));
} else {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.55e+20) || !(b <= 2.5e-42)) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x - Float64(-z))); else tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.55e+20], N[Not[LessEqual[b, 2.5e-42]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - (-z)), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.55 \cdot 10^{+20} \lor \neg \left(b \leq 2.5 \cdot 10^{-42}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x - \left(-z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\end{array}
\end{array}
if b < -1.55e20 or 2.50000000000000001e-42 < b Initial program 92.1%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites96.1%
Taylor expanded in z around inf
*-commutativeN/A
lift-*.f64N/A
lift--.f6489.8
Applied rewrites89.8%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6483.1
Applied rewrites83.1%
if -1.55e20 < b < 2.50000000000000001e-42Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6492.0
Applied rewrites92.0%
Final simplification87.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- (+ t y) 2.0) b a)))
(if (<= b -1.35e+20)
t_1
(if (<= b 2.8e-182)
(- x (* a (- t 1.0)))
(if (<= b 2e-29) (- x (* z (- y 1.0))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(((t + y) - 2.0), b, a);
double tmp;
if (b <= -1.35e+20) {
tmp = t_1;
} else if (b <= 2.8e-182) {
tmp = x - (a * (t - 1.0));
} else if (b <= 2e-29) {
tmp = x - (z * (y - 1.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(Float64(t + y) - 2.0), b, a) tmp = 0.0 if (b <= -1.35e+20) tmp = t_1; elseif (b <= 2.8e-182) tmp = Float64(x - Float64(a * Float64(t - 1.0))); elseif (b <= 2e-29) tmp = Float64(x - Float64(z * Float64(y - 1.0))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + a), $MachinePrecision]}, If[LessEqual[b, -1.35e+20], t$95$1, If[LessEqual[b, 2.8e-182], N[(x - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-29], N[(x - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(t + y\right) - 2, b, a\right)\\
\mathbf{if}\;b \leq -1.35 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2.8 \cdot 10^{-182}:\\
\;\;\;\;x - a \cdot \left(t - 1\right)\\
\mathbf{elif}\;b \leq 2 \cdot 10^{-29}:\\
\;\;\;\;x - z \cdot \left(y - 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.35e20 or 1.99999999999999989e-29 < b Initial program 91.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6474.4
Applied rewrites74.4%
Taylor expanded in t around 0
Applied rewrites73.6%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6473.6
associate--l-73.6
+-commutative73.6
Applied rewrites73.6%
if -1.35e20 < b < 2.79999999999999993e-182Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6492.2
Applied rewrites92.2%
Taylor expanded in z around 0
lower-*.f64N/A
lift--.f6464.0
Applied rewrites64.0%
if 2.79999999999999993e-182 < b < 1.99999999999999989e-29Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6490.0
Applied rewrites90.0%
Taylor expanded in z around inf
lower-*.f64N/A
lift--.f6470.0
Applied rewrites70.0%
Final simplification69.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a) t)))
(if (<= t -1.15e+248)
t_1
(if (<= t -3.5e+132)
(* b t)
(if (<= t -1000000.0) t_1 (if (<= t 3.2e+42) x (* b t)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -a * t;
double tmp;
if (t <= -1.15e+248) {
tmp = t_1;
} else if (t <= -3.5e+132) {
tmp = b * t;
} else if (t <= -1000000.0) {
tmp = t_1;
} else if (t <= 3.2e+42) {
tmp = x;
} else {
tmp = b * t;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = -a * t
if (t <= (-1.15d+248)) then
tmp = t_1
else if (t <= (-3.5d+132)) then
tmp = b * t
else if (t <= (-1000000.0d0)) then
tmp = t_1
else if (t <= 3.2d+42) then
tmp = x
else
tmp = b * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -a * t;
double tmp;
if (t <= -1.15e+248) {
tmp = t_1;
} else if (t <= -3.5e+132) {
tmp = b * t;
} else if (t <= -1000000.0) {
tmp = t_1;
} else if (t <= 3.2e+42) {
tmp = x;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -a * t tmp = 0 if t <= -1.15e+248: tmp = t_1 elif t <= -3.5e+132: tmp = b * t elif t <= -1000000.0: tmp = t_1 elif t <= 3.2e+42: tmp = x else: tmp = b * t return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-a) * t) tmp = 0.0 if (t <= -1.15e+248) tmp = t_1; elseif (t <= -3.5e+132) tmp = Float64(b * t); elseif (t <= -1000000.0) tmp = t_1; elseif (t <= 3.2e+42) tmp = x; else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -a * t; tmp = 0.0; if (t <= -1.15e+248) tmp = t_1; elseif (t <= -3.5e+132) tmp = b * t; elseif (t <= -1000000.0) tmp = t_1; elseif (t <= 3.2e+42) tmp = x; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-a) * t), $MachinePrecision]}, If[LessEqual[t, -1.15e+248], t$95$1, If[LessEqual[t, -3.5e+132], N[(b * t), $MachinePrecision], If[LessEqual[t, -1000000.0], t$95$1, If[LessEqual[t, 3.2e+42], x, N[(b * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot t\\
\mathbf{if}\;t \leq -1.15 \cdot 10^{+248}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -3.5 \cdot 10^{+132}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t \leq -1000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{+42}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if t < -1.1500000000000001e248 or -3.5000000000000002e132 < t < -1e6Initial program 90.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6454.2
Applied rewrites54.2%
Taylor expanded in a around inf
mul-1-negN/A
lower-neg.f6444.7
Applied rewrites44.7%
if -1.1500000000000001e248 < t < -3.5000000000000002e132 or 3.20000000000000002e42 < t Initial program 95.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6462.1
Applied rewrites62.1%
Taylor expanded in a around 0
Applied rewrites45.4%
if -1e6 < t < 3.20000000000000002e42Initial program 98.5%
Taylor expanded in x around inf
Applied rewrites24.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -9.8e-60) (not (<= b 1.55e-42))) (fma (- (+ t y) 2.0) b (- x (- z))) (- x (fma z (- y 1.0) (- a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -9.8e-60) || !(b <= 1.55e-42)) {
tmp = fma(((t + y) - 2.0), b, (x - -z));
} else {
tmp = x - fma(z, (y - 1.0), -a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -9.8e-60) || !(b <= 1.55e-42)) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x - Float64(-z))); else tmp = Float64(x - fma(z, Float64(y - 1.0), Float64(-a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -9.8e-60], N[Not[LessEqual[b, 1.55e-42]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - (-z)), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.8 \cdot 10^{-60} \lor \neg \left(b \leq 1.55 \cdot 10^{-42}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x - \left(-z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y - 1, -a\right)\\
\end{array}
\end{array}
if b < -9.79999999999999977e-60 or 1.5500000000000001e-42 < b Initial program 93.1%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites96.6%
Taylor expanded in z around inf
*-commutativeN/A
lift-*.f64N/A
lift--.f6487.2
Applied rewrites87.2%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6479.9
Applied rewrites79.9%
if -9.79999999999999977e-60 < b < 1.5500000000000001e-42Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6496.6
Applied rewrites96.6%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6477.9
Applied rewrites77.9%
Final simplification79.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ t y) 2.0) b)))
(if (<= b -2.05e+21)
t_1
(if (<= b 2.8e-182)
(- x (* a (- t 1.0)))
(if (<= b 2.7e-29) (- x (* z (- y 1.0))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -2.05e+21) {
tmp = t_1;
} else if (b <= 2.8e-182) {
tmp = x - (a * (t - 1.0));
} else if (b <= 2.7e-29) {
tmp = x - (z * (y - 1.0));
} 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)
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) :: t_1
real(8) :: tmp
t_1 = ((t + y) - 2.0d0) * b
if (b <= (-2.05d+21)) then
tmp = t_1
else if (b <= 2.8d-182) then
tmp = x - (a * (t - 1.0d0))
else if (b <= 2.7d-29) then
tmp = x - (z * (y - 1.0d0))
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 t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -2.05e+21) {
tmp = t_1;
} else if (b <= 2.8e-182) {
tmp = x - (a * (t - 1.0));
} else if (b <= 2.7e-29) {
tmp = x - (z * (y - 1.0));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((t + y) - 2.0) * b tmp = 0 if b <= -2.05e+21: tmp = t_1 elif b <= 2.8e-182: tmp = x - (a * (t - 1.0)) elif b <= 2.7e-29: tmp = x - (z * (y - 1.0)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -2.05e+21) tmp = t_1; elseif (b <= 2.8e-182) tmp = Float64(x - Float64(a * Float64(t - 1.0))); elseif (b <= 2.7e-29) tmp = Float64(x - Float64(z * Float64(y - 1.0))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((t + y) - 2.0) * b; tmp = 0.0; if (b <= -2.05e+21) tmp = t_1; elseif (b <= 2.8e-182) tmp = x - (a * (t - 1.0)); elseif (b <= 2.7e-29) tmp = x - (z * (y - 1.0)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -2.05e+21], t$95$1, If[LessEqual[b, 2.8e-182], N[(x - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e-29], N[(x - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -2.05 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2.8 \cdot 10^{-182}:\\
\;\;\;\;x - a \cdot \left(t - 1\right)\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{-29}:\\
\;\;\;\;x - z \cdot \left(y - 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.05e21 or 2.70000000000000023e-29 < b Initial program 91.8%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6469.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6469.6
Applied rewrites69.6%
if -2.05e21 < b < 2.79999999999999993e-182Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6492.2
Applied rewrites92.2%
Taylor expanded in z around 0
lower-*.f64N/A
lift--.f6464.0
Applied rewrites64.0%
if 2.79999999999999993e-182 < b < 2.70000000000000023e-29Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6490.0
Applied rewrites90.0%
Taylor expanded in z around inf
lower-*.f64N/A
lift--.f6470.0
Applied rewrites70.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ t y) 2.0) b)))
(if (<= b -1.3e+20)
t_1
(if (<= b 2.8e-182) (- x (* a t)) (if (<= b 3e-30) (- x (* z y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -1.3e+20) {
tmp = t_1;
} else if (b <= 2.8e-182) {
tmp = x - (a * t);
} else if (b <= 3e-30) {
tmp = x - (z * y);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = ((t + y) - 2.0d0) * b
if (b <= (-1.3d+20)) then
tmp = t_1
else if (b <= 2.8d-182) then
tmp = x - (a * t)
else if (b <= 3d-30) then
tmp = x - (z * y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -1.3e+20) {
tmp = t_1;
} else if (b <= 2.8e-182) {
tmp = x - (a * t);
} else if (b <= 3e-30) {
tmp = x - (z * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((t + y) - 2.0) * b tmp = 0 if b <= -1.3e+20: tmp = t_1 elif b <= 2.8e-182: tmp = x - (a * t) elif b <= 3e-30: tmp = x - (z * y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -1.3e+20) tmp = t_1; elseif (b <= 2.8e-182) tmp = Float64(x - Float64(a * t)); elseif (b <= 3e-30) tmp = Float64(x - Float64(z * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((t + y) - 2.0) * b; tmp = 0.0; if (b <= -1.3e+20) tmp = t_1; elseif (b <= 2.8e-182) tmp = x - (a * t); elseif (b <= 3e-30) tmp = x - (z * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -1.3e+20], t$95$1, If[LessEqual[b, 2.8e-182], N[(x - N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3e-30], N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -1.3 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2.8 \cdot 10^{-182}:\\
\;\;\;\;x - a \cdot t\\
\mathbf{elif}\;b \leq 3 \cdot 10^{-30}:\\
\;\;\;\;x - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.3e20 or 2.9999999999999999e-30 < b Initial program 91.8%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6469.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6469.6
Applied rewrites69.6%
if -1.3e20 < b < 2.79999999999999993e-182Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6492.2
Applied rewrites92.2%
Taylor expanded in t around inf
lower-*.f6445.4
Applied rewrites45.4%
if 2.79999999999999993e-182 < b < 2.9999999999999999e-30Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6490.0
Applied rewrites90.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6451.8
Applied rewrites51.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -9.8e-60) (not (<= b 4600.0))) (+ x (* (- (+ y t) 2.0) b)) (- x (fma z (- y 1.0) (- a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -9.8e-60) || !(b <= 4600.0)) {
tmp = x + (((y + t) - 2.0) * b);
} else {
tmp = x - fma(z, (y - 1.0), -a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -9.8e-60) || !(b <= 4600.0)) tmp = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)); else tmp = Float64(x - fma(z, Float64(y - 1.0), Float64(-a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -9.8e-60], N[Not[LessEqual[b, 4600.0]], $MachinePrecision]], N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.8 \cdot 10^{-60} \lor \neg \left(b \leq 4600\right):\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y - 1, -a\right)\\
\end{array}
\end{array}
if b < -9.79999999999999977e-60 or 4600 < b Initial program 92.5%
Taylor expanded in x around inf
Applied rewrites77.0%
if -9.79999999999999977e-60 < b < 4600Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6493.8
Applied rewrites93.8%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6476.7
Applied rewrites76.7%
Final simplification76.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -7.2e+42) (not (<= b 2.7e-29))) (fma (- (+ t y) 2.0) b a) (- x (fma z (- y 1.0) (- a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -7.2e+42) || !(b <= 2.7e-29)) {
tmp = fma(((t + y) - 2.0), b, a);
} else {
tmp = x - fma(z, (y - 1.0), -a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -7.2e+42) || !(b <= 2.7e-29)) tmp = fma(Float64(Float64(t + y) - 2.0), b, a); else tmp = Float64(x - fma(z, Float64(y - 1.0), Float64(-a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -7.2e+42], N[Not[LessEqual[b, 2.7e-29]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + a), $MachinePrecision], N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{+42} \lor \neg \left(b \leq 2.7 \cdot 10^{-29}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, a\right)\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y - 1, -a\right)\\
\end{array}
\end{array}
if b < -7.2000000000000002e42 or 2.70000000000000023e-29 < b Initial program 91.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.8
Applied rewrites75.8%
Taylor expanded in t around 0
Applied rewrites75.0%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6475.0
associate--l-75.0
+-commutative75.0
Applied rewrites75.0%
if -7.2000000000000002e42 < b < 2.70000000000000023e-29Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6490.5
Applied rewrites90.5%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6472.8
Applied rewrites72.8%
Final simplification73.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -5.2e+67)
t_1
(if (<= y 7.2e-243)
(- x (* a t))
(if (<= y 3.4e+25) (+ x (* b t)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - z) * y;
double tmp;
if (y <= -5.2e+67) {
tmp = t_1;
} else if (y <= 7.2e-243) {
tmp = x - (a * t);
} else if (y <= 3.4e+25) {
tmp = x + (b * t);
} 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)
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) :: t_1
real(8) :: tmp
t_1 = (b - z) * y
if (y <= (-5.2d+67)) then
tmp = t_1
else if (y <= 7.2d-243) then
tmp = x - (a * t)
else if (y <= 3.4d+25) then
tmp = x + (b * t)
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 t_1 = (b - z) * y;
double tmp;
if (y <= -5.2e+67) {
tmp = t_1;
} else if (y <= 7.2e-243) {
tmp = x - (a * t);
} else if (y <= 3.4e+25) {
tmp = x + (b * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - z) * y tmp = 0 if y <= -5.2e+67: tmp = t_1 elif y <= 7.2e-243: tmp = x - (a * t) elif y <= 3.4e+25: tmp = x + (b * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - z) * y) tmp = 0.0 if (y <= -5.2e+67) tmp = t_1; elseif (y <= 7.2e-243) tmp = Float64(x - Float64(a * t)); elseif (y <= 3.4e+25) tmp = Float64(x + Float64(b * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b - z) * y; tmp = 0.0; if (y <= -5.2e+67) tmp = t_1; elseif (y <= 7.2e-243) tmp = x - (a * t); elseif (y <= 3.4e+25) tmp = x + (b * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -5.2e+67], t$95$1, If[LessEqual[y, 7.2e-243], N[(x - N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e+25], N[(x + N[(b * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-243}:\\
\;\;\;\;x - a \cdot t\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+25}:\\
\;\;\;\;x + b \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.2000000000000001e67 or 3.39999999999999984e25 < y Initial program 95.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.8
Applied rewrites66.8%
if -5.2000000000000001e67 < y < 7.2000000000000003e-243Initial program 96.3%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6477.3
Applied rewrites77.3%
Taylor expanded in t around inf
lower-*.f6446.3
Applied rewrites46.3%
if 7.2000000000000003e-243 < y < 3.39999999999999984e25Initial program 98.0%
Taylor expanded in x around inf
Applied rewrites61.0%
Taylor expanded in t around inf
lower-*.f6447.6
Applied rewrites47.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -5.2e+67)
t_1
(if (<= y 3.55e-301)
(- x (* a t))
(if (<= y 3.6e+61) (* (- b a) t) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - z) * y;
double tmp;
if (y <= -5.2e+67) {
tmp = t_1;
} else if (y <= 3.55e-301) {
tmp = x - (a * t);
} else if (y <= 3.6e+61) {
tmp = (b - a) * t;
} 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)
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) :: t_1
real(8) :: tmp
t_1 = (b - z) * y
if (y <= (-5.2d+67)) then
tmp = t_1
else if (y <= 3.55d-301) then
tmp = x - (a * t)
else if (y <= 3.6d+61) then
tmp = (b - a) * t
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 t_1 = (b - z) * y;
double tmp;
if (y <= -5.2e+67) {
tmp = t_1;
} else if (y <= 3.55e-301) {
tmp = x - (a * t);
} else if (y <= 3.6e+61) {
tmp = (b - a) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - z) * y tmp = 0 if y <= -5.2e+67: tmp = t_1 elif y <= 3.55e-301: tmp = x - (a * t) elif y <= 3.6e+61: tmp = (b - a) * t else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - z) * y) tmp = 0.0 if (y <= -5.2e+67) tmp = t_1; elseif (y <= 3.55e-301) tmp = Float64(x - Float64(a * t)); elseif (y <= 3.6e+61) tmp = Float64(Float64(b - a) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b - z) * y; tmp = 0.0; if (y <= -5.2e+67) tmp = t_1; elseif (y <= 3.55e-301) tmp = x - (a * t); elseif (y <= 3.6e+61) tmp = (b - a) * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -5.2e+67], t$95$1, If[LessEqual[y, 3.55e-301], N[(x - N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.6e+61], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.55 \cdot 10^{-301}:\\
\;\;\;\;x - a \cdot t\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+61}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.2000000000000001e67 or 3.6000000000000001e61 < y Initial program 94.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.1
Applied rewrites69.1%
if -5.2000000000000001e67 < y < 3.55e-301Initial program 95.8%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6477.8
Applied rewrites77.8%
Taylor expanded in t around inf
lower-*.f6448.9
Applied rewrites48.9%
if 3.55e-301 < y < 3.6000000000000001e61Initial program 98.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.2
Applied rewrites39.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -2.05e+21) (not (<= b 3.1e-30))) (* (- (+ t y) 2.0) b) (- x (* a (- t 1.0)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -2.05e+21) || !(b <= 3.1e-30)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = x - (a * (t - 1.0));
}
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)
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) :: tmp
if ((b <= (-2.05d+21)) .or. (.not. (b <= 3.1d-30))) then
tmp = ((t + y) - 2.0d0) * b
else
tmp = x - (a * (t - 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -2.05e+21) || !(b <= 3.1e-30)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = x - (a * (t - 1.0));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -2.05e+21) or not (b <= 3.1e-30): tmp = ((t + y) - 2.0) * b else: tmp = x - (a * (t - 1.0)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -2.05e+21) || !(b <= 3.1e-30)) tmp = Float64(Float64(Float64(t + y) - 2.0) * b); else tmp = Float64(x - Float64(a * Float64(t - 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -2.05e+21) || ~((b <= 3.1e-30))) tmp = ((t + y) - 2.0) * b; else tmp = x - (a * (t - 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -2.05e+21], N[Not[LessEqual[b, 3.1e-30]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision], N[(x - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.05 \cdot 10^{+21} \lor \neg \left(b \leq 3.1 \cdot 10^{-30}\right):\\
\;\;\;\;\left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \left(t - 1\right)\\
\end{array}
\end{array}
if b < -2.05e21 or 3.09999999999999991e-30 < b Initial program 91.8%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6469.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6469.6
Applied rewrites69.6%
if -2.05e21 < b < 3.09999999999999991e-30Initial program 100.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6491.6
Applied rewrites91.6%
Taylor expanded in z around 0
lower-*.f64N/A
lift--.f6459.7
Applied rewrites59.7%
Final simplification64.4%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.95e+132) (* b t) (if (<= t -2.9e+68) (* (- y) z) (if (<= t 3.2e+42) x (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.95e+132) {
tmp = b * t;
} else if (t <= -2.9e+68) {
tmp = -y * z;
} else if (t <= 3.2e+42) {
tmp = x;
} else {
tmp = b * t;
}
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)
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) :: tmp
if (t <= (-1.95d+132)) then
tmp = b * t
else if (t <= (-2.9d+68)) then
tmp = -y * z
else if (t <= 3.2d+42) then
tmp = x
else
tmp = b * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.95e+132) {
tmp = b * t;
} else if (t <= -2.9e+68) {
tmp = -y * z;
} else if (t <= 3.2e+42) {
tmp = x;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.95e+132: tmp = b * t elif t <= -2.9e+68: tmp = -y * z elif t <= 3.2e+42: tmp = x else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.95e+132) tmp = Float64(b * t); elseif (t <= -2.9e+68) tmp = Float64(Float64(-y) * z); elseif (t <= 3.2e+42) tmp = x; else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.95e+132) tmp = b * t; elseif (t <= -2.9e+68) tmp = -y * z; elseif (t <= 3.2e+42) tmp = x; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.95e+132], N[(b * t), $MachinePrecision], If[LessEqual[t, -2.9e+68], N[((-y) * z), $MachinePrecision], If[LessEqual[t, 3.2e+42], x, N[(b * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.95 \cdot 10^{+132}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t \leq -2.9 \cdot 10^{+68}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{+42}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if t < -1.95000000000000001e132 or 3.20000000000000002e42 < t Initial program 91.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.1
Applied rewrites68.1%
Taylor expanded in a around 0
Applied rewrites44.4%
if -1.95000000000000001e132 < t < -2.90000000000000011e68Initial program 94.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6448.6
Applied rewrites48.6%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6442.3
Applied rewrites42.3%
if -2.90000000000000011e68 < t < 3.20000000000000002e42Initial program 98.7%
Taylor expanded in x around inf
Applied rewrites24.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -5.5e+22) (not (<= y 3.6e+61))) (* (- b z) y) (* (- b a) t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -5.5e+22) || !(y <= 3.6e+61)) {
tmp = (b - z) * y;
} else {
tmp = (b - a) * t;
}
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)
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) :: tmp
if ((y <= (-5.5d+22)) .or. (.not. (y <= 3.6d+61))) then
tmp = (b - z) * y
else
tmp = (b - a) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -5.5e+22) || !(y <= 3.6e+61)) {
tmp = (b - z) * y;
} else {
tmp = (b - a) * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -5.5e+22) or not (y <= 3.6e+61): tmp = (b - z) * y else: tmp = (b - a) * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -5.5e+22) || !(y <= 3.6e+61)) tmp = Float64(Float64(b - z) * y); else tmp = Float64(Float64(b - a) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -5.5e+22) || ~((y <= 3.6e+61))) tmp = (b - z) * y; else tmp = (b - a) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -5.5e+22], N[Not[LessEqual[y, 3.6e+61]], $MachinePrecision]], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+22} \lor \neg \left(y \leq 3.6 \cdot 10^{+61}\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\end{array}
\end{array}
if y < -5.50000000000000021e22 or 3.6000000000000001e61 < y Initial program 95.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.6
Applied rewrites67.6%
if -5.50000000000000021e22 < y < 3.6000000000000001e61Initial program 97.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6436.9
Applied rewrites36.9%
Final simplification51.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.8e+111) (not (<= t 2e+128))) (* (- b a) t) (* (- 1.0 y) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.8e+111) || !(t <= 2e+128)) {
tmp = (b - a) * t;
} else {
tmp = (1.0 - y) * z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((t <= (-1.8d+111)) .or. (.not. (t <= 2d+128))) then
tmp = (b - a) * t
else
tmp = (1.0d0 - y) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.8e+111) || !(t <= 2e+128)) {
tmp = (b - a) * t;
} else {
tmp = (1.0 - y) * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.8e+111) or not (t <= 2e+128): tmp = (b - a) * t else: tmp = (1.0 - y) * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.8e+111) || !(t <= 2e+128)) tmp = Float64(Float64(b - a) * t); else tmp = Float64(Float64(1.0 - y) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.8e+111) || ~((t <= 2e+128))) tmp = (b - a) * t; else tmp = (1.0 - y) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.8e+111], N[Not[LessEqual[t, 2e+128]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+111} \lor \neg \left(t \leq 2 \cdot 10^{+128}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\end{array}
\end{array}
if t < -1.8000000000000001e111 or 2.0000000000000002e128 < t Initial program 90.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.5
Applied rewrites81.5%
if -1.8000000000000001e111 < t < 2.0000000000000002e128Initial program 97.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6432.3
Applied rewrites32.3%
Final simplification44.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -4.2e-13) (not (<= z 5.5e+78))) (* (- 1.0 y) z) (* (- 1.0 t) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4.2e-13) || !(z <= 5.5e+78)) {
tmp = (1.0 - y) * z;
} else {
tmp = (1.0 - t) * 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)
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) :: tmp
if ((z <= (-4.2d-13)) .or. (.not. (z <= 5.5d+78))) then
tmp = (1.0d0 - y) * z
else
tmp = (1.0d0 - t) * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4.2e-13) || !(z <= 5.5e+78)) {
tmp = (1.0 - y) * z;
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -4.2e-13) or not (z <= 5.5e+78): tmp = (1.0 - y) * z else: tmp = (1.0 - t) * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -4.2e-13) || !(z <= 5.5e+78)) tmp = Float64(Float64(1.0 - y) * z); else tmp = Float64(Float64(1.0 - t) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -4.2e-13) || ~((z <= 5.5e+78))) tmp = (1.0 - y) * z; else tmp = (1.0 - t) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -4.2e-13], N[Not[LessEqual[z, 5.5e+78]], $MachinePrecision]], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-13} \lor \neg \left(z \leq 5.5 \cdot 10^{+78}\right):\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\end{array}
\end{array}
if z < -4.19999999999999977e-13 or 5.4999999999999997e78 < z Initial program 95.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6451.4
Applied rewrites51.4%
if -4.19999999999999977e-13 < z < 5.4999999999999997e78Initial program 96.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6435.3
Applied rewrites35.3%
Final simplification42.0%
(FPCore (x y z t a b) :precision binary64 (if (<= x -5.3e+75) x (if (<= x 3.6e+124) (* (- 1.0 t) a) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -5.3e+75) {
tmp = x;
} else if (x <= 3.6e+124) {
tmp = (1.0 - t) * a;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (x <= (-5.3d+75)) then
tmp = x
else if (x <= 3.6d+124) then
tmp = (1.0d0 - t) * a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -5.3e+75) {
tmp = x;
} else if (x <= 3.6e+124) {
tmp = (1.0 - t) * a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -5.3e+75: tmp = x elif x <= 3.6e+124: tmp = (1.0 - t) * a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -5.3e+75) tmp = x; elseif (x <= 3.6e+124) tmp = Float64(Float64(1.0 - t) * a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -5.3e+75) tmp = x; elseif (x <= 3.6e+124) tmp = (1.0 - t) * a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -5.3e+75], x, If[LessEqual[x, 3.6e+124], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.3 \cdot 10^{+75}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+124}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.2999999999999998e75 or 3.59999999999999986e124 < x Initial program 94.1%
Taylor expanded in x around inf
Applied rewrites43.6%
if -5.2999999999999998e75 < x < 3.59999999999999986e124Initial program 97.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6434.0
Applied rewrites34.0%
(FPCore (x y z t a b) :precision binary64 (if (<= x -6.2e+36) x (if (<= x 1.5e-275) (* 1.0 a) (if (<= x 4e+99) z x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -6.2e+36) {
tmp = x;
} else if (x <= 1.5e-275) {
tmp = 1.0 * a;
} else if (x <= 4e+99) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (x <= (-6.2d+36)) then
tmp = x
else if (x <= 1.5d-275) then
tmp = 1.0d0 * a
else if (x <= 4d+99) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -6.2e+36) {
tmp = x;
} else if (x <= 1.5e-275) {
tmp = 1.0 * a;
} else if (x <= 4e+99) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -6.2e+36: tmp = x elif x <= 1.5e-275: tmp = 1.0 * a elif x <= 4e+99: tmp = z else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -6.2e+36) tmp = x; elseif (x <= 1.5e-275) tmp = Float64(1.0 * a); elseif (x <= 4e+99) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -6.2e+36) tmp = x; elseif (x <= 1.5e-275) tmp = 1.0 * a; elseif (x <= 4e+99) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -6.2e+36], x, If[LessEqual[x, 1.5e-275], N[(1.0 * a), $MachinePrecision], If[LessEqual[x, 4e+99], z, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+36}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-275}:\\
\;\;\;\;1 \cdot a\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+99}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.1999999999999999e36 or 3.9999999999999999e99 < x Initial program 94.2%
Taylor expanded in x around inf
Applied rewrites39.6%
if -6.1999999999999999e36 < x < 1.5e-275Initial program 98.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6440.0
Applied rewrites40.0%
Taylor expanded in t around 0
Applied rewrites26.2%
if 1.5e-275 < x < 3.9999999999999999e99Initial program 96.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6429.7
Applied rewrites29.7%
Taylor expanded in y around 0
Applied rewrites18.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.26e+98) (not (<= t 3.2e+42))) (* b t) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.26e+98) || !(t <= 3.2e+42)) {
tmp = b * t;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((t <= (-1.26d+98)) .or. (.not. (t <= 3.2d+42))) then
tmp = b * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.26e+98) || !(t <= 3.2e+42)) {
tmp = b * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.26e+98) or not (t <= 3.2e+42): tmp = b * t else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.26e+98) || !(t <= 3.2e+42)) tmp = Float64(b * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.26e+98) || ~((t <= 3.2e+42))) tmp = b * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.26e+98], N[Not[LessEqual[t, 3.2e+42]], $MachinePrecision]], N[(b * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.26 \cdot 10^{+98} \lor \neg \left(t \leq 3.2 \cdot 10^{+42}\right):\\
\;\;\;\;b \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.25999999999999999e98 or 3.20000000000000002e42 < t Initial program 92.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.0
Applied rewrites68.0%
Taylor expanded in a around 0
Applied rewrites41.5%
if -1.25999999999999999e98 < t < 3.20000000000000002e42Initial program 98.2%
Taylor expanded in x around inf
Applied rewrites24.1%
Final simplification30.1%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.4e-10) x (if (<= x 4e+99) z x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.4e-10) {
tmp = x;
} else if (x <= 4e+99) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (x <= (-1.4d-10)) then
tmp = x
else if (x <= 4d+99) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.4e-10) {
tmp = x;
} else if (x <= 4e+99) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.4e-10: tmp = x elif x <= 4e+99: tmp = z else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.4e-10) tmp = x; elseif (x <= 4e+99) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.4e-10) tmp = x; elseif (x <= 4e+99) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.4e-10], x, If[LessEqual[x, 4e+99], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-10}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+99}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.40000000000000008e-10 or 3.9999999999999999e99 < x Initial program 94.5%
Taylor expanded in x around inf
Applied rewrites38.0%
if -1.40000000000000008e-10 < x < 3.9999999999999999e99Initial program 97.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6431.1
Applied rewrites31.1%
Taylor expanded in y around 0
Applied rewrites16.1%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
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)
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
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 96.1%
Taylor expanded in x around inf
Applied rewrites18.2%
herbie shell --seed 2025038
(FPCore (x y z t a b)
:name "Statistics.Distribution.Beta:$centropy from math-functions-0.1.5.2"
:precision binary64
(+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))