
(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 20 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 (- b z) y (fma (- t 2.0) b x)) z) (* (- t 1.0) a)))
double code(double x, double y, double z, double t, double a, double b) {
return (fma((b - z), y, fma((t - 2.0), b, x)) + z) - ((t - 1.0) * a);
}
function code(x, y, z, t, a, b) return Float64(Float64(fma(Float64(b - z), y, fma(Float64(t - 2.0), b, x)) + z) - Float64(Float64(t - 1.0) * a)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(b - z), $MachinePrecision] * y + N[(N[(t - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(b - z, y, \mathsf{fma}\left(t - 2, b, x\right)\right) + z\right) - \left(t - 1\right) \cdot a
\end{array}
Initial program 95.7%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites97.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t 1.0) a)))
(if (<= t -2.1e+183)
(- (* t b) t_1)
(if (<= t -0.031)
(- (fma (- 1.0 y) z x) t_1)
(if (<= t 1.6e+42)
(+ (+ (fma -2.0 b z) (fma (- b z) y x)) a)
(* (- b a) t))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - 1.0) * a;
double tmp;
if (t <= -2.1e+183) {
tmp = (t * b) - t_1;
} else if (t <= -0.031) {
tmp = fma((1.0 - y), z, x) - t_1;
} else if (t <= 1.6e+42) {
tmp = (fma(-2.0, b, z) + fma((b - z), y, x)) + a;
} else {
tmp = (b - a) * t;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - 1.0) * a) tmp = 0.0 if (t <= -2.1e+183) tmp = Float64(Float64(t * b) - t_1); elseif (t <= -0.031) tmp = Float64(fma(Float64(1.0 - y), z, x) - t_1); elseif (t <= 1.6e+42) tmp = Float64(Float64(fma(-2.0, b, z) + fma(Float64(b - z), y, x)) + a); else tmp = Float64(Float64(b - a) * t); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[t, -2.1e+183], N[(N[(t * b), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[t, -0.031], N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[t, 1.6e+42], N[(N[(N[(-2.0 * b + z), $MachinePrecision] + N[(N[(b - z), $MachinePrecision] * y + x), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot a\\
\mathbf{if}\;t \leq -2.1 \cdot 10^{+183}:\\
\;\;\;\;t \cdot b - t\_1\\
\mathbf{elif}\;t \leq -0.031:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right) - t\_1\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+42}:\\
\;\;\;\;\left(\mathsf{fma}\left(-2, b, z\right) + \mathsf{fma}\left(b - z, y, x\right)\right) + a\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\end{array}
\end{array}
if t < -2.1e183Initial program 93.7%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites96.8%
Taylor expanded in t around inf
Applied rewrites83.1%
if -2.1e183 < t < -0.031Initial program 92.5%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites92.5%
Taylor expanded in b around 0
Applied rewrites78.0%
if -0.031 < t < 1.60000000000000001e42Initial program 97.9%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites99.3%
if 1.60000000000000001e42 < t Initial program 93.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.3
Applied rewrites81.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (fma (- 1.0 y) z x) a)) (t_2 (* (- b a) t)))
(if (<= t -25500.0)
t_2
(if (<= t -4.5e-106)
t_1
(if (<= t 1.85e-214)
(+ (fma (- y 2.0) b x) a)
(if (<= t 6.2e+41) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((1.0 - y), z, x) + a;
double t_2 = (b - a) * t;
double tmp;
if (t <= -25500.0) {
tmp = t_2;
} else if (t <= -4.5e-106) {
tmp = t_1;
} else if (t <= 1.85e-214) {
tmp = fma((y - 2.0), b, x) + a;
} else if (t <= 6.2e+41) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(Float64(1.0 - y), z, x) + a) t_2 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -25500.0) tmp = t_2; elseif (t <= -4.5e-106) tmp = t_1; elseif (t <= 1.85e-214) tmp = Float64(fma(Float64(y - 2.0), b, x) + a); elseif (t <= 6.2e+41) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] + a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -25500.0], t$95$2, If[LessEqual[t, -4.5e-106], t$95$1, If[LessEqual[t, 1.85e-214], N[(N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t, 6.2e+41], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - y, z, x\right) + a\\
t_2 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -25500:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -4.5 \cdot 10^{-106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.85 \cdot 10^{-214}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right) + a\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -25500 or 6.2e41 < t Initial program 93.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.5
Applied rewrites72.5%
if -25500 < t < -4.49999999999999955e-106 or 1.8500000000000001e-214 < t < 6.2e41Initial program 97.4%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites98.7%
Taylor expanded in b around 0
Applied rewrites72.6%
if -4.49999999999999955e-106 < t < 1.8500000000000001e-214Initial program 98.4%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites82.5%
Taylor expanded in t around 0
Applied rewrites82.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -22000.0) (not (<= t 4.6e+41))) (fma (- t 2.0) b (+ (fma (- 1.0 t) a x) z)) (+ (+ (fma -2.0 b z) (fma (- b z) y x)) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -22000.0) || !(t <= 4.6e+41)) {
tmp = fma((t - 2.0), b, (fma((1.0 - t), a, x) + z));
} else {
tmp = (fma(-2.0, b, z) + fma((b - z), y, x)) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -22000.0) || !(t <= 4.6e+41)) tmp = fma(Float64(t - 2.0), b, Float64(fma(Float64(1.0 - t), a, x) + z)); else tmp = Float64(Float64(fma(-2.0, b, z) + fma(Float64(b - z), y, x)) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -22000.0], N[Not[LessEqual[t, 4.6e+41]], $MachinePrecision]], N[(N[(t - 2.0), $MachinePrecision] * b + N[(N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * b + z), $MachinePrecision] + N[(N[(b - z), $MachinePrecision] * y + x), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -22000 \lor \neg \left(t \leq 4.6 \cdot 10^{+41}\right):\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, \mathsf{fma}\left(1 - t, a, x\right) + z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-2, b, z\right) + \mathsf{fma}\left(b - z, y, x\right)\right) + a\\
\end{array}
\end{array}
if t < -22000 or 4.5999999999999997e41 < t Initial program 93.0%
Taylor expanded in y around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--r+N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites86.0%
if -22000 < t < 4.5999999999999997e41Initial program 97.9%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites99.3%
Final simplification93.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1400.0) (not (<= t 4.6e+41))) (fma (- 1.0 t) a (fma (- (+ t y) 2.0) b x)) (+ (+ (fma -2.0 b z) (fma (- b z) y x)) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1400.0) || !(t <= 4.6e+41)) {
tmp = fma((1.0 - t), a, fma(((t + y) - 2.0), b, x));
} else {
tmp = (fma(-2.0, b, z) + fma((b - z), y, x)) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1400.0) || !(t <= 4.6e+41)) tmp = fma(Float64(1.0 - t), a, fma(Float64(Float64(t + y) - 2.0), b, x)); else tmp = Float64(Float64(fma(-2.0, b, z) + fma(Float64(b - z), y, x)) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1400.0], N[Not[LessEqual[t, 4.6e+41]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * b + z), $MachinePrecision] + N[(N[(b - z), $MachinePrecision] * y + x), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1400 \lor \neg \left(t \leq 4.6 \cdot 10^{+41}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-2, b, z\right) + \mathsf{fma}\left(b - z, y, x\right)\right) + a\\
\end{array}
\end{array}
if t < -1400 or 4.5999999999999997e41 < t Initial program 93.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites80.9%
if -1400 < t < 4.5999999999999997e41Initial program 97.9%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites99.3%
Final simplification91.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -2.8e+24)
t_1
(if (<= t -3.4e-273)
(fma (- y 2.0) b a)
(if (<= t 4.6e-256)
(+ (fma -2.0 b x) a)
(if (<= t 4.6e+41) (* (- b z) 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 <= -2.8e+24) {
tmp = t_1;
} else if (t <= -3.4e-273) {
tmp = fma((y - 2.0), b, a);
} else if (t <= 4.6e-256) {
tmp = fma(-2.0, b, x) + a;
} else if (t <= 4.6e+41) {
tmp = (b - z) * 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 <= -2.8e+24) tmp = t_1; elseif (t <= -3.4e-273) tmp = fma(Float64(y - 2.0), b, a); elseif (t <= 4.6e-256) tmp = Float64(fma(-2.0, b, x) + a); elseif (t <= 4.6e+41) tmp = Float64(Float64(b - z) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -2.8e+24], t$95$1, If[LessEqual[t, -3.4e-273], N[(N[(y - 2.0), $MachinePrecision] * b + a), $MachinePrecision], If[LessEqual[t, 4.6e-256], N[(N[(-2.0 * b + x), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t, 4.6e+41], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -2.8 \cdot 10^{+24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -3.4 \cdot 10^{-273}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, a\right)\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{-256}:\\
\;\;\;\;\mathsf{fma}\left(-2, b, x\right) + a\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{+41}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.8000000000000002e24 or 4.5999999999999997e41 < t Initial program 92.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.7
Applied rewrites73.7%
if -2.8000000000000002e24 < t < -3.39999999999999991e-273Initial program 100.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites70.9%
Taylor expanded in t around 0
Applied rewrites67.9%
Taylor expanded in x around 0
Applied rewrites53.3%
if -3.39999999999999991e-273 < t < 4.6e-256Initial program 99.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites90.0%
Taylor expanded in t around 0
Applied rewrites90.0%
Taylor expanded in y around 0
Applied rewrites83.2%
if 4.6e-256 < t < 4.5999999999999997e41Initial program 94.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6452.5
Applied rewrites52.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)) (t_2 (* (- b a) t)))
(if (<= t -1.48e+26)
t_2
(if (<= t -3.4e-273)
t_1
(if (<= t 7e-236) (+ a x) (if (<= t 4.6e+41) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - z) * y;
double t_2 = (b - a) * t;
double tmp;
if (t <= -1.48e+26) {
tmp = t_2;
} else if (t <= -3.4e-273) {
tmp = t_1;
} else if (t <= 7e-236) {
tmp = a + x;
} else if (t <= 4.6e+41) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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) :: tmp
t_1 = (b - z) * y
t_2 = (b - a) * t
if (t <= (-1.48d+26)) then
tmp = t_2
else if (t <= (-3.4d-273)) then
tmp = t_1
else if (t <= 7d-236) then
tmp = a + x
else if (t <= 4.6d+41) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - z) * y;
double t_2 = (b - a) * t;
double tmp;
if (t <= -1.48e+26) {
tmp = t_2;
} else if (t <= -3.4e-273) {
tmp = t_1;
} else if (t <= 7e-236) {
tmp = a + x;
} else if (t <= 4.6e+41) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - z) * y t_2 = (b - a) * t tmp = 0 if t <= -1.48e+26: tmp = t_2 elif t <= -3.4e-273: tmp = t_1 elif t <= 7e-236: tmp = a + x elif t <= 4.6e+41: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - z) * y) t_2 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -1.48e+26) tmp = t_2; elseif (t <= -3.4e-273) tmp = t_1; elseif (t <= 7e-236) tmp = Float64(a + x); elseif (t <= 4.6e+41) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b - z) * y; t_2 = (b - a) * t; tmp = 0.0; if (t <= -1.48e+26) tmp = t_2; elseif (t <= -3.4e-273) tmp = t_1; elseif (t <= 7e-236) tmp = a + x; elseif (t <= 4.6e+41) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.48e+26], t$95$2, If[LessEqual[t, -3.4e-273], t$95$1, If[LessEqual[t, 7e-236], N[(a + x), $MachinePrecision], If[LessEqual[t, 4.6e+41], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
t_2 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -1.48 \cdot 10^{+26}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -3.4 \cdot 10^{-273}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-236}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -1.48e26 or 4.5999999999999997e41 < t Initial program 92.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.7
Applied rewrites73.7%
if -1.48e26 < t < -3.39999999999999991e-273 or 6.99999999999999988e-236 < t < 4.5999999999999997e41Initial program 97.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6453.4
Applied rewrites53.4%
if -3.39999999999999991e-273 < t < 6.99999999999999988e-236Initial program 99.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites85.0%
Taylor expanded in t around 0
Applied rewrites85.0%
Taylor expanded in b around 0
Applied rewrites56.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 y) z)) (t_2 (* (- b a) t)))
(if (<= t -25500.0)
t_2
(if (<= t -6.3e-111)
t_1
(if (<= t 8.8e-6) (+ a x) (if (<= t 2.6e+41) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - y) * z;
double t_2 = (b - a) * t;
double tmp;
if (t <= -25500.0) {
tmp = t_2;
} else if (t <= -6.3e-111) {
tmp = t_1;
} else if (t <= 8.8e-6) {
tmp = a + x;
} else if (t <= 2.6e+41) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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) :: tmp
t_1 = (1.0d0 - y) * z
t_2 = (b - a) * t
if (t <= (-25500.0d0)) then
tmp = t_2
else if (t <= (-6.3d-111)) then
tmp = t_1
else if (t <= 8.8d-6) then
tmp = a + x
else if (t <= 2.6d+41) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - y) * z;
double t_2 = (b - a) * t;
double tmp;
if (t <= -25500.0) {
tmp = t_2;
} else if (t <= -6.3e-111) {
tmp = t_1;
} else if (t <= 8.8e-6) {
tmp = a + x;
} else if (t <= 2.6e+41) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (1.0 - y) * z t_2 = (b - a) * t tmp = 0 if t <= -25500.0: tmp = t_2 elif t <= -6.3e-111: tmp = t_1 elif t <= 8.8e-6: tmp = a + x elif t <= 2.6e+41: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - y) * z) t_2 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -25500.0) tmp = t_2; elseif (t <= -6.3e-111) tmp = t_1; elseif (t <= 8.8e-6) tmp = Float64(a + x); elseif (t <= 2.6e+41) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (1.0 - y) * z; t_2 = (b - a) * t; tmp = 0.0; if (t <= -25500.0) tmp = t_2; elseif (t <= -6.3e-111) tmp = t_1; elseif (t <= 8.8e-6) tmp = a + x; elseif (t <= 2.6e+41) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -25500.0], t$95$2, If[LessEqual[t, -6.3e-111], t$95$1, If[LessEqual[t, 8.8e-6], N[(a + x), $MachinePrecision], If[LessEqual[t, 2.6e+41], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - y\right) \cdot z\\
t_2 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -25500:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -6.3 \cdot 10^{-111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.8 \cdot 10^{-6}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -25500 or 2.6000000000000001e41 < t Initial program 93.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.5
Applied rewrites72.5%
if -25500 < t < -6.3000000000000004e-111 or 8.8000000000000004e-6 < t < 2.6000000000000001e41Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6452.9
Applied rewrites52.9%
if -6.3000000000000004e-111 < t < 8.8000000000000004e-6Initial program 97.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites77.0%
Taylor expanded in t around 0
Applied rewrites77.0%
Taylor expanded in b around 0
Applied rewrites40.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.1e+51) (not (<= b 6.8e+61))) (fma 1.0 a (fma (- (+ t y) 2.0) b x)) (- (fma (- 1.0 y) z x) (* (- t 1.0) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.1e+51) || !(b <= 6.8e+61)) {
tmp = fma(1.0, a, fma(((t + y) - 2.0), b, x));
} else {
tmp = fma((1.0 - y), z, x) - ((t - 1.0) * a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.1e+51) || !(b <= 6.8e+61)) tmp = fma(1.0, a, fma(Float64(Float64(t + y) - 2.0), b, x)); else tmp = Float64(fma(Float64(1.0 - y), z, x) - Float64(Float64(t - 1.0) * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.1e+51], N[Not[LessEqual[b, 6.8e+61]], $MachinePrecision]], N[(1.0 * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{+51} \lor \neg \left(b \leq 6.8 \cdot 10^{+61}\right):\\
\;\;\;\;\mathsf{fma}\left(1, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right) - \left(t - 1\right) \cdot a\\
\end{array}
\end{array}
if b < -1.09999999999999996e51 or 6.80000000000000051e61 < b Initial program 89.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites90.4%
Taylor expanded in t around 0
Applied rewrites89.3%
if -1.09999999999999996e51 < b < 6.80000000000000051e61Initial program 99.4%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.4%
Taylor expanded in b around 0
Applied rewrites86.6%
Final simplification87.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -4.3e+129) (not (<= t 6.2e+41))) (* (- b a) t) (+ (fma -2.0 b (fma (- b z) y z)) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -4.3e+129) || !(t <= 6.2e+41)) {
tmp = (b - a) * t;
} else {
tmp = fma(-2.0, b, fma((b - z), y, z)) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -4.3e+129) || !(t <= 6.2e+41)) tmp = Float64(Float64(b - a) * t); else tmp = Float64(fma(-2.0, b, fma(Float64(b - z), y, z)) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -4.3e+129], N[Not[LessEqual[t, 6.2e+41]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(N[(-2.0 * b + N[(N[(b - z), $MachinePrecision] * y + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{+129} \lor \neg \left(t \leq 6.2 \cdot 10^{+41}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-2, b, \mathsf{fma}\left(b - z, y, z\right)\right) + a\\
\end{array}
\end{array}
if t < -4.30000000000000021e129 or 6.2e41 < t Initial program 93.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6480.3
Applied rewrites80.3%
if -4.30000000000000021e129 < t < 6.2e41Initial program 97.0%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites98.8%
Taylor expanded in t around 0
Applied rewrites92.7%
Taylor expanded in x around 0
Applied rewrites75.5%
Final simplification77.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -2.8e+24)
t_1
(if (<= t 2.9e-8)
(fma (- y 2.0) b a)
(if (<= t 4.6e+41) (* (- b z) 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 <= -2.8e+24) {
tmp = t_1;
} else if (t <= 2.9e-8) {
tmp = fma((y - 2.0), b, a);
} else if (t <= 4.6e+41) {
tmp = (b - z) * 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 <= -2.8e+24) tmp = t_1; elseif (t <= 2.9e-8) tmp = fma(Float64(y - 2.0), b, a); elseif (t <= 4.6e+41) tmp = Float64(Float64(b - z) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -2.8e+24], t$95$1, If[LessEqual[t, 2.9e-8], N[(N[(y - 2.0), $MachinePrecision] * b + a), $MachinePrecision], If[LessEqual[t, 4.6e+41], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -2.8 \cdot 10^{+24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, a\right)\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{+41}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.8000000000000002e24 or 4.5999999999999997e41 < t Initial program 92.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.7
Applied rewrites73.7%
if -2.8000000000000002e24 < t < 2.9000000000000002e-8Initial program 97.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites73.1%
Taylor expanded in t around 0
Applied rewrites71.7%
Taylor expanded in x around 0
Applied rewrites52.8%
if 2.9000000000000002e-8 < t < 4.5999999999999997e41Initial program 99.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.1
Applied rewrites75.1%
(FPCore (x y z t a b) :precision binary64 (if (<= t -14000.0) (* (- t) a) (if (<= t 2.55e-5) (+ a x) (if (<= t 2.9e+41) (* (- y) z) (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -14000.0) {
tmp = -t * a;
} else if (t <= 2.55e-5) {
tmp = a + x;
} else if (t <= 2.9e+41) {
tmp = -y * z;
} 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 <= (-14000.0d0)) then
tmp = -t * a
else if (t <= 2.55d-5) then
tmp = a + x
else if (t <= 2.9d+41) then
tmp = -y * z
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 <= -14000.0) {
tmp = -t * a;
} else if (t <= 2.55e-5) {
tmp = a + x;
} else if (t <= 2.9e+41) {
tmp = -y * z;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -14000.0: tmp = -t * a elif t <= 2.55e-5: tmp = a + x elif t <= 2.9e+41: tmp = -y * z else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -14000.0) tmp = Float64(Float64(-t) * a); elseif (t <= 2.55e-5) tmp = Float64(a + x); elseif (t <= 2.9e+41) tmp = Float64(Float64(-y) * z); else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -14000.0) tmp = -t * a; elseif (t <= 2.55e-5) tmp = a + x; elseif (t <= 2.9e+41) tmp = -y * z; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -14000.0], N[((-t) * a), $MachinePrecision], If[LessEqual[t, 2.55e-5], N[(a + x), $MachinePrecision], If[LessEqual[t, 2.9e+41], N[((-y) * z), $MachinePrecision], N[(b * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -14000:\\
\;\;\;\;\left(-t\right) \cdot a\\
\mathbf{elif}\;t \leq 2.55 \cdot 10^{-5}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{+41}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if t < -14000Initial program 93.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.9
Applied rewrites43.9%
Taylor expanded in t around inf
Applied rewrites43.5%
if -14000 < t < 2.54999999999999998e-5Initial program 97.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites72.7%
Taylor expanded in t around 0
Applied rewrites72.7%
Taylor expanded in b around 0
Applied rewrites37.6%
if 2.54999999999999998e-5 < t < 2.89999999999999988e41Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.8
Applied rewrites66.8%
Taylor expanded in y around inf
Applied rewrites57.7%
if 2.89999999999999988e41 < t Initial program 93.0%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.8
Applied rewrites67.8%
Taylor expanded in t around inf
Applied rewrites46.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -6.3e+25) (not (<= t 65000000.0))) (* (- b a) t) (+ (fma (- y 2.0) b x) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -6.3e+25) || !(t <= 65000000.0)) {
tmp = (b - a) * t;
} else {
tmp = fma((y - 2.0), b, x) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -6.3e+25) || !(t <= 65000000.0)) tmp = Float64(Float64(b - a) * t); else tmp = Float64(fma(Float64(y - 2.0), b, x) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -6.3e+25], N[Not[LessEqual[t, 65000000.0]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.3 \cdot 10^{+25} \lor \neg \left(t \leq 65000000\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right) + a\\
\end{array}
\end{array}
if t < -6.29999999999999973e25 or 6.5e7 < t Initial program 93.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.1
Applied rewrites71.1%
if -6.29999999999999973e25 < t < 6.5e7Initial program 97.8%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites72.7%
Taylor expanded in t around 0
Applied rewrites71.3%
Final simplification71.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -2.25e+98) (not (<= b 5e+30))) (* (- (+ t y) 2.0) b) (fma (- 1.0 t) a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -2.25e+98) || !(b <= 5e+30)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = fma((1.0 - t), a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -2.25e+98) || !(b <= 5e+30)) tmp = Float64(Float64(Float64(t + y) - 2.0) * b); else tmp = fma(Float64(1.0 - t), a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -2.25e+98], N[Not[LessEqual[b, 5e+30]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.25 \cdot 10^{+98} \lor \neg \left(b \leq 5 \cdot 10^{+30}\right):\\
\;\;\;\;\left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right)\\
\end{array}
\end{array}
if b < -2.2500000000000001e98 or 4.9999999999999998e30 < b Initial program 90.5%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites93.7%
Taylor expanded in t around 0
Applied rewrites69.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6476.4
Applied rewrites76.4%
if -2.2500000000000001e98 < b < 4.9999999999999998e30Initial program 98.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites67.8%
Taylor expanded in b around 0
Applied rewrites56.0%
Final simplification63.6%
(FPCore (x y z t a b) :precision binary64 (if (<= t -14000.0) (* (- t) a) (if (<= t 3.6e-90) (+ a x) (if (<= t 3.3e+55) (* y b) (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -14000.0) {
tmp = -t * a;
} else if (t <= 3.6e-90) {
tmp = a + x;
} else if (t <= 3.3e+55) {
tmp = y * b;
} 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 <= (-14000.0d0)) then
tmp = -t * a
else if (t <= 3.6d-90) then
tmp = a + x
else if (t <= 3.3d+55) then
tmp = y * b
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 <= -14000.0) {
tmp = -t * a;
} else if (t <= 3.6e-90) {
tmp = a + x;
} else if (t <= 3.3e+55) {
tmp = y * b;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -14000.0: tmp = -t * a elif t <= 3.6e-90: tmp = a + x elif t <= 3.3e+55: tmp = y * b else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -14000.0) tmp = Float64(Float64(-t) * a); elseif (t <= 3.6e-90) tmp = Float64(a + x); elseif (t <= 3.3e+55) tmp = Float64(y * b); else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -14000.0) tmp = -t * a; elseif (t <= 3.6e-90) tmp = a + x; elseif (t <= 3.3e+55) tmp = y * b; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -14000.0], N[((-t) * a), $MachinePrecision], If[LessEqual[t, 3.6e-90], N[(a + x), $MachinePrecision], If[LessEqual[t, 3.3e+55], N[(y * b), $MachinePrecision], N[(b * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -14000:\\
\;\;\;\;\left(-t\right) \cdot a\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-90}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{+55}:\\
\;\;\;\;y \cdot b\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if t < -14000Initial program 93.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.9
Applied rewrites43.9%
Taylor expanded in t around inf
Applied rewrites43.5%
if -14000 < t < 3.59999999999999981e-90Initial program 98.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites71.3%
Taylor expanded in t around 0
Applied rewrites71.3%
Taylor expanded in b around 0
Applied rewrites38.7%
if 3.59999999999999981e-90 < t < 3.3e55Initial program 96.4%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites68.6%
Taylor expanded in y around inf
Applied rewrites37.6%
if 3.3e55 < t Initial program 92.6%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.5
Applied rewrites68.5%
Taylor expanded in t around inf
Applied rewrites48.5%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.75e+40) (* b t) (if (<= t 3.6e-90) (+ a x) (if (<= t 3.3e+55) (* y b) (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.75e+40) {
tmp = b * t;
} else if (t <= 3.6e-90) {
tmp = a + x;
} else if (t <= 3.3e+55) {
tmp = y * b;
} 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.75d+40)) then
tmp = b * t
else if (t <= 3.6d-90) then
tmp = a + x
else if (t <= 3.3d+55) then
tmp = y * b
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.75e+40) {
tmp = b * t;
} else if (t <= 3.6e-90) {
tmp = a + x;
} else if (t <= 3.3e+55) {
tmp = y * b;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.75e+40: tmp = b * t elif t <= 3.6e-90: tmp = a + x elif t <= 3.3e+55: tmp = y * b else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.75e+40) tmp = Float64(b * t); elseif (t <= 3.6e-90) tmp = Float64(a + x); elseif (t <= 3.3e+55) tmp = Float64(y * b); 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.75e+40) tmp = b * t; elseif (t <= 3.6e-90) tmp = a + x; elseif (t <= 3.3e+55) tmp = y * b; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.75e+40], N[(b * t), $MachinePrecision], If[LessEqual[t, 3.6e-90], N[(a + x), $MachinePrecision], If[LessEqual[t, 3.3e+55], N[(y * b), $MachinePrecision], N[(b * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{+40}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-90}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{+55}:\\
\;\;\;\;y \cdot b\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if t < -1.75e40 or 3.3e55 < t Initial program 92.6%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6464.5
Applied rewrites64.5%
Taylor expanded in t around inf
Applied rewrites37.4%
if -1.75e40 < t < 3.59999999999999981e-90Initial program 98.3%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites72.5%
Taylor expanded in t around 0
Applied rewrites69.4%
Taylor expanded in b around 0
Applied rewrites37.3%
if 3.59999999999999981e-90 < t < 3.3e55Initial program 96.4%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites68.6%
Taylor expanded in y around inf
Applied rewrites37.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.6e+45) (not (<= z 1.35e+156))) (* (- 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 <= -1.6e+45) || !(z <= 1.35e+156)) {
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 <= (-1.6d+45)) .or. (.not. (z <= 1.35d+156))) 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 <= -1.6e+45) || !(z <= 1.35e+156)) {
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 <= -1.6e+45) or not (z <= 1.35e+156): 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 <= -1.6e+45) || !(z <= 1.35e+156)) 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 <= -1.6e+45) || ~((z <= 1.35e+156))) 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, -1.6e+45], N[Not[LessEqual[z, 1.35e+156]], $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 -1.6 \cdot 10^{+45} \lor \neg \left(z \leq 1.35 \cdot 10^{+156}\right):\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\end{array}
\end{array}
if z < -1.6000000000000001e45 or 1.35e156 < z Initial program 91.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.9
Applied rewrites65.9%
if -1.6000000000000001e45 < z < 1.35e156Initial program 98.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.9
Applied rewrites38.9%
Final simplification48.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.95e+45) (not (<= z 1.35e+156))) (* (- y) z) (* (- 1.0 t) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.95e+45) || !(z <= 1.35e+156)) {
tmp = -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 <= (-1.95d+45)) .or. (.not. (z <= 1.35d+156))) then
tmp = -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 <= -1.95e+45) || !(z <= 1.35e+156)) {
tmp = -y * z;
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.95e+45) or not (z <= 1.35e+156): tmp = -y * z else: tmp = (1.0 - t) * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.95e+45) || !(z <= 1.35e+156)) tmp = Float64(Float64(-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 <= -1.95e+45) || ~((z <= 1.35e+156))) tmp = -y * z; else tmp = (1.0 - t) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.95e+45], N[Not[LessEqual[z, 1.35e+156]], $MachinePrecision]], N[((-y) * z), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+45} \lor \neg \left(z \leq 1.35 \cdot 10^{+156}\right):\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\end{array}
\end{array}
if z < -1.95e45 or 1.35e156 < z Initial program 91.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.9
Applied rewrites65.9%
Taylor expanded in y around inf
Applied rewrites46.4%
if -1.95e45 < z < 1.35e156Initial program 98.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.9
Applied rewrites38.9%
Final simplification41.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.1e+124) (not (<= y 1.1e+54))) (* y b) (+ a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.1e+124) || !(y <= 1.1e+54)) {
tmp = y * b;
} else {
tmp = a + 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 ((y <= (-2.1d+124)) .or. (.not. (y <= 1.1d+54))) then
tmp = y * b
else
tmp = a + 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 ((y <= -2.1e+124) || !(y <= 1.1e+54)) {
tmp = y * b;
} else {
tmp = a + x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.1e+124) or not (y <= 1.1e+54): tmp = y * b else: tmp = a + x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.1e+124) || !(y <= 1.1e+54)) tmp = Float64(y * b); else tmp = Float64(a + x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.1e+124) || ~((y <= 1.1e+54))) tmp = y * b; else tmp = a + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.1e+124], N[Not[LessEqual[y, 1.1e+54]], $MachinePrecision]], N[(y * b), $MachinePrecision], N[(a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{+124} \lor \neg \left(y \leq 1.1 \cdot 10^{+54}\right):\\
\;\;\;\;y \cdot b\\
\mathbf{else}:\\
\;\;\;\;a + x\\
\end{array}
\end{array}
if y < -2.10000000000000011e124 or 1.09999999999999995e54 < y Initial program 90.3%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites69.6%
Taylor expanded in y around inf
Applied rewrites42.3%
if -2.10000000000000011e124 < y < 1.09999999999999995e54Initial program 98.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites78.2%
Taylor expanded in t around 0
Applied rewrites43.2%
Taylor expanded in b around 0
Applied rewrites30.7%
Final simplification34.9%
(FPCore (x y z t a b) :precision binary64 (+ a x))
double code(double x, double y, double z, double t, double a, double b) {
return a + 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 = a + x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a + x;
}
def code(x, y, z, t, a, b): return a + x
function code(x, y, z, t, a, b) return Float64(a + x) end
function tmp = code(x, y, z, t, a, b) tmp = a + x; end
code[x_, y_, z_, t_, a_, b_] := N[(a + x), $MachinePrecision]
\begin{array}{l}
\\
a + x
\end{array}
Initial program 95.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites75.1%
Taylor expanded in t around 0
Applied rewrites45.6%
Taylor expanded in b around 0
Applied rewrites23.3%
herbie shell --seed 2025015
(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)))