
(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 22 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
(let* ((t_1
(+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b))))
(if (<= t_1 INFINITY) t_1 (* (- b a) t))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (b - a) * t;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (b - a) * t;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (b - a) * t return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(b - a) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (b - a) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \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\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\end{array}
\end{array}
if (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) Initial program 0.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6470.0
Applied rewrites70.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -3.6e+36) (not (<= t 5.6e+47))) (fma (- 1.0 t) a (fma (- (+ t y) 2.0) b x)) (+ (- x (fma z (- y 1.0) (- a))) (fma y b (* (- t 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -3.6e+36) || !(t <= 5.6e+47)) {
tmp = fma((1.0 - t), a, fma(((t + y) - 2.0), b, x));
} else {
tmp = (x - fma(z, (y - 1.0), -a)) + fma(y, b, ((t - 2.0) * b));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -3.6e+36) || !(t <= 5.6e+47)) tmp = fma(Float64(1.0 - t), a, fma(Float64(Float64(t + y) - 2.0), b, x)); else tmp = Float64(Float64(x - fma(z, Float64(y - 1.0), Float64(-a))) + fma(y, b, Float64(Float64(t - 2.0) * b))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -3.6e+36], N[Not[LessEqual[t, 5.6e+47]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision] + N[(y * b + N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+36} \lor \neg \left(t \leq 5.6 \cdot 10^{+47}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - \mathsf{fma}\left(z, y - 1, -a\right)\right) + \mathsf{fma}\left(y, b, \left(t - 2\right) \cdot b\right)\\
\end{array}
\end{array}
if t < -3.5999999999999997e36 or 5.59999999999999976e47 < t Initial program 90.4%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites88.4%
if -3.5999999999999997e36 < t < 5.59999999999999976e47Initial program 98.5%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6499.2
Applied rewrites99.2%
Final simplification94.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -8.5e+31) (not (<= t 4.4e+47))) (fma (- 1.0 t) a (fma (- (+ t y) 2.0) b x)) (fma (- y 2.0) b (+ (fma (- 1.0 y) z x) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -8.5e+31) || !(t <= 4.4e+47)) {
tmp = fma((1.0 - t), a, fma(((t + y) - 2.0), b, x));
} else {
tmp = fma((y - 2.0), b, (fma((1.0 - y), z, x) + a));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -8.5e+31) || !(t <= 4.4e+47)) tmp = fma(Float64(1.0 - t), a, fma(Float64(Float64(t + y) - 2.0), b, x)); else tmp = fma(Float64(y - 2.0), b, Float64(fma(Float64(1.0 - y), z, x) + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -8.5e+31], N[Not[LessEqual[t, 4.4e+47]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(y - 2.0), $MachinePrecision] * b + N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{+31} \lor \neg \left(t \leq 4.4 \cdot 10^{+47}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, \mathsf{fma}\left(1 - y, z, x\right) + a\right)\\
\end{array}
\end{array}
if t < -8.49999999999999947e31 or 4.3999999999999999e47 < t Initial program 90.4%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites88.4%
if -8.49999999999999947e31 < t < 4.3999999999999999e47Initial program 98.5%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
fp-cancel-sign-subN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites98.4%
Final simplification93.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.7e-63) (not (<= b 8.5e-74))) (fma (- 1.0 t) a (fma (- (+ t y) 2.0) b x)) (- (fma (- 1.0 t) a x) (* (- y 1.0) z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.7e-63) || !(b <= 8.5e-74)) {
tmp = fma((1.0 - t), a, fma(((t + y) - 2.0), b, x));
} else {
tmp = fma((1.0 - t), a, x) - ((y - 1.0) * z);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.7e-63) || !(b <= 8.5e-74)) tmp = fma(Float64(1.0 - t), a, fma(Float64(Float64(t + y) - 2.0), b, x)); else tmp = Float64(fma(Float64(1.0 - t), a, x) - Float64(Float64(y - 1.0) * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.7e-63], N[Not[LessEqual[b, 8.5e-74]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision] - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.7 \cdot 10^{-63} \lor \neg \left(b \leq 8.5 \cdot 10^{-74}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right) - \left(y - 1\right) \cdot z\\
\end{array}
\end{array}
if b < -1.69999999999999999e-63 or 8.50000000000000052e-74 < b Initial program 93.3%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites88.3%
if -1.69999999999999999e-63 < b < 8.50000000000000052e-74Initial program 97.8%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.8%
Taylor expanded in b around 0
Applied rewrites93.1%
Final simplification90.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 t) a)))
(if (<= a -5e+114)
t_1
(if (<= a -1.55e+48)
(+ a x)
(if (<= a 9e-189)
(* (- y 2.0) b)
(if (<= a 6e+26) (* (- 1.0 y) z) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - t) * a;
double tmp;
if (a <= -5e+114) {
tmp = t_1;
} else if (a <= -1.55e+48) {
tmp = a + x;
} else if (a <= 9e-189) {
tmp = (y - 2.0) * b;
} else if (a <= 6e+26) {
tmp = (1.0 - y) * z;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 = (1.0d0 - t) * a
if (a <= (-5d+114)) then
tmp = t_1
else if (a <= (-1.55d+48)) then
tmp = a + x
else if (a <= 9d-189) then
tmp = (y - 2.0d0) * b
else if (a <= 6d+26) then
tmp = (1.0d0 - y) * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - t) * a;
double tmp;
if (a <= -5e+114) {
tmp = t_1;
} else if (a <= -1.55e+48) {
tmp = a + x;
} else if (a <= 9e-189) {
tmp = (y - 2.0) * b;
} else if (a <= 6e+26) {
tmp = (1.0 - y) * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (1.0 - t) * a tmp = 0 if a <= -5e+114: tmp = t_1 elif a <= -1.55e+48: tmp = a + x elif a <= 9e-189: tmp = (y - 2.0) * b elif a <= 6e+26: tmp = (1.0 - y) * z else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - t) * a) tmp = 0.0 if (a <= -5e+114) tmp = t_1; elseif (a <= -1.55e+48) tmp = Float64(a + x); elseif (a <= 9e-189) tmp = Float64(Float64(y - 2.0) * b); elseif (a <= 6e+26) tmp = Float64(Float64(1.0 - y) * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (1.0 - t) * a; tmp = 0.0; if (a <= -5e+114) tmp = t_1; elseif (a <= -1.55e+48) tmp = a + x; elseif (a <= 9e-189) tmp = (y - 2.0) * b; elseif (a <= 6e+26) tmp = (1.0 - y) * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -5e+114], t$95$1, If[LessEqual[a, -1.55e+48], N[(a + x), $MachinePrecision], If[LessEqual[a, 9e-189], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[a, 6e+26], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - t\right) \cdot a\\
\mathbf{if}\;a \leq -5 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1.55 \cdot 10^{+48}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;a \leq 9 \cdot 10^{-189}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{elif}\;a \leq 6 \cdot 10^{+26}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.0000000000000001e114 or 5.99999999999999994e26 < a Initial program 90.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6459.3
Applied rewrites59.3%
if -5.0000000000000001e114 < a < -1.55000000000000003e48Initial program 94.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites89.1%
Taylor expanded in b around 0
Applied rewrites58.3%
Taylor expanded in t around 0
Applied rewrites43.1%
if -1.55000000000000003e48 < a < 8.9999999999999992e-189Initial program 100.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites83.5%
Taylor expanded in x around 0
Applied rewrites63.1%
Taylor expanded in a around 0
Applied rewrites59.5%
Taylor expanded in t around 0
Applied rewrites43.6%
if 8.9999999999999992e-189 < a < 5.99999999999999994e26Initial program 97.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.9e-62) (not (<= b 4.8e+26))) (fma (- b a) t (fma (- y 2.0) b a)) (- (fma (- 1.0 t) a x) (* (- y 1.0) z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.9e-62) || !(b <= 4.8e+26)) {
tmp = fma((b - a), t, fma((y - 2.0), b, a));
} else {
tmp = fma((1.0 - t), a, x) - ((y - 1.0) * z);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.9e-62) || !(b <= 4.8e+26)) tmp = fma(Float64(b - a), t, fma(Float64(y - 2.0), b, a)); else tmp = Float64(fma(Float64(1.0 - t), a, x) - Float64(Float64(y - 1.0) * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.9e-62], N[Not[LessEqual[b, 4.8e+26]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b + a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision] - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.9 \cdot 10^{-62} \lor \neg \left(b \leq 4.8 \cdot 10^{+26}\right):\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right) - \left(y - 1\right) \cdot z\\
\end{array}
\end{array}
if b < -1.90000000000000003e-62 or 4.80000000000000009e26 < b Initial program 91.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites91.3%
Taylor expanded in x around 0
Applied rewrites87.9%
if -1.90000000000000003e-62 < b < 4.80000000000000009e26Initial program 98.3%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.3%
Taylor expanded in b around 0
Applied rewrites87.3%
Final simplification87.6%
(FPCore (x y z t a b) :precision binary64 (- (+ (fma (- b a) t (fma (- y 2.0) b x)) a) (* (- y 1.0) z)))
double code(double x, double y, double z, double t, double a, double b) {
return (fma((b - a), t, fma((y - 2.0), b, x)) + a) - ((y - 1.0) * z);
}
function code(x, y, z, t, a, b) return Float64(Float64(fma(Float64(b - a), t, fma(Float64(y - 2.0), b, x)) + a) - Float64(Float64(y - 1.0) * z)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision] - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, x\right)\right) + a\right) - \left(y - 1\right) \cdot z
\end{array}
Initial program 94.9%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -1.02e-14)
(fma (- b a) t (fma (- y 2.0) b a))
(if (<= t 5.6e+47)
(fma 1.0 a (fma (- (+ t y) 2.0) b x))
(fma (- b a) t (* (- y 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.02e-14) {
tmp = fma((b - a), t, fma((y - 2.0), b, a));
} else if (t <= 5.6e+47) {
tmp = fma(1.0, a, fma(((t + y) - 2.0), b, x));
} else {
tmp = fma((b - a), t, ((y - 2.0) * b));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.02e-14) tmp = fma(Float64(b - a), t, fma(Float64(y - 2.0), b, a)); elseif (t <= 5.6e+47) tmp = fma(1.0, a, fma(Float64(Float64(t + y) - 2.0), b, x)); else tmp = fma(Float64(b - a), t, Float64(Float64(y - 2.0) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.02e-14], N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.6e+47], N[(1.0 * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.02 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, a\right)\right)\\
\mathbf{elif}\;t \leq 5.6 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(1, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \left(y - 2\right) \cdot b\right)\\
\end{array}
\end{array}
if t < -1.02e-14Initial program 90.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites86.6%
Taylor expanded in x around 0
Applied rewrites79.0%
if -1.02e-14 < t < 5.59999999999999976e47Initial program 98.5%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites74.8%
Taylor expanded in t around 0
Applied rewrites74.9%
if 5.59999999999999976e47 < t Initial program 91.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites88.0%
Taylor expanded in x around 0
Applied rewrites86.6%
Taylor expanded in a around 0
Applied rewrites86.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.8e+24) (not (<= t 1e-16))) (fma (- b a) t (* (- y 2.0) b)) (+ (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 <= -1.8e+24) || !(t <= 1e-16)) {
tmp = fma((b - a), t, ((y - 2.0) * b));
} else {
tmp = fma((y - 2.0), b, x) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.8e+24) || !(t <= 1e-16)) tmp = fma(Float64(b - a), t, Float64(Float64(y - 2.0) * b)); 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, -1.8e+24], N[Not[LessEqual[t, 1e-16]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+24} \lor \neg \left(t \leq 10^{-16}\right):\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \left(y - 2\right) \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right) + a\\
\end{array}
\end{array}
if t < -1.79999999999999992e24 or 9.9999999999999998e-17 < t Initial program 90.4%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites86.7%
Taylor expanded in x around 0
Applied rewrites80.8%
Taylor expanded in a around 0
Applied rewrites80.8%
if -1.79999999999999992e24 < t < 9.9999999999999998e-17Initial program 99.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites74.8%
Taylor expanded in b around 0
Applied rewrites38.5%
Taylor expanded in t around 0
Applied rewrites74.7%
Final simplification77.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -1.02e-14)
(fma (- b a) t (fma (- y 2.0) b a))
(if (<= t 1e-16)
(+ (fma (- y 2.0) b x) a)
(fma (- b a) t (* (- y 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.02e-14) {
tmp = fma((b - a), t, fma((y - 2.0), b, a));
} else if (t <= 1e-16) {
tmp = fma((y - 2.0), b, x) + a;
} else {
tmp = fma((b - a), t, ((y - 2.0) * b));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.02e-14) tmp = fma(Float64(b - a), t, fma(Float64(y - 2.0), b, a)); elseif (t <= 1e-16) tmp = Float64(fma(Float64(y - 2.0), b, x) + a); else tmp = fma(Float64(b - a), t, Float64(Float64(y - 2.0) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.02e-14], N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-16], N[(N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + a), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.02 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, a\right)\right)\\
\mathbf{elif}\;t \leq 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right) + a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \left(y - 2\right) \cdot b\right)\\
\end{array}
\end{array}
if t < -1.02e-14Initial program 90.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites86.6%
Taylor expanded in x around 0
Applied rewrites79.0%
if -1.02e-14 < t < 9.9999999999999998e-17Initial program 99.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites75.4%
Taylor expanded in b around 0
Applied rewrites39.1%
Taylor expanded in t around 0
Applied rewrites75.4%
if 9.9999999999999998e-17 < t Initial program 90.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites84.9%
Taylor expanded in x around 0
Applied rewrites81.1%
Taylor expanded in a around 0
Applied rewrites81.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -1.7e+33)
(* (- b a) t)
(if (<= t 7.8e+95)
(+ (fma (- y 2.0) b x) a)
(fma (- b a) t (fma -2.0 b a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.7e+33) {
tmp = (b - a) * t;
} else if (t <= 7.8e+95) {
tmp = fma((y - 2.0), b, x) + a;
} else {
tmp = fma((b - a), t, fma(-2.0, b, a));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.7e+33) tmp = Float64(Float64(b - a) * t); elseif (t <= 7.8e+95) tmp = Float64(fma(Float64(y - 2.0), b, x) + a); else tmp = fma(Float64(b - a), t, fma(-2.0, b, a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.7e+33], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t, 7.8e+95], N[(N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + a), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * t + N[(-2.0 * b + a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+33}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right) + a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(-2, b, a\right)\right)\\
\end{array}
\end{array}
if t < -1.7e33Initial program 89.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6477.1
Applied rewrites77.1%
if -1.7e33 < t < 7.7999999999999994e95Initial program 98.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites75.8%
Taylor expanded in b around 0
Applied rewrites36.9%
Taylor expanded in t around 0
Applied rewrites72.5%
if 7.7999999999999994e95 < t Initial program 89.3%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites85.7%
Taylor expanded in x around 0
Applied rewrites84.1%
Taylor expanded in y around 0
Applied rewrites76.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -2.55e-8)
t_1
(if (<= t 2e-185) (+ a x) (if (<= t 7.8e+95) (* (- 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.55e-8) {
tmp = t_1;
} else if (t <= 2e-185) {
tmp = a + x;
} else if (t <= 7.8e+95) {
tmp = (b - 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 = (b - a) * t
if (t <= (-2.55d-8)) then
tmp = t_1
else if (t <= 2d-185) then
tmp = a + x
else if (t <= 7.8d+95) then
tmp = (b - 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 = (b - a) * t;
double tmp;
if (t <= -2.55e-8) {
tmp = t_1;
} else if (t <= 2e-185) {
tmp = a + x;
} else if (t <= 7.8e+95) {
tmp = (b - z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - a) * t tmp = 0 if t <= -2.55e-8: tmp = t_1 elif t <= 2e-185: tmp = a + x elif t <= 7.8e+95: 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.55e-8) tmp = t_1; elseif (t <= 2e-185) tmp = Float64(a + x); elseif (t <= 7.8e+95) tmp = Float64(Float64(b - z) * 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 <= -2.55e-8) tmp = t_1; elseif (t <= 2e-185) tmp = a + x; elseif (t <= 7.8e+95) tmp = (b - z) * 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, -2.55e-8], t$95$1, If[LessEqual[t, 2e-185], N[(a + x), $MachinePrecision], If[LessEqual[t, 7.8e+95], 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.55 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2 \cdot 10^{-185}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+95}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.55e-8 or 7.7999999999999994e95 < t Initial program 89.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.0
Applied rewrites75.0%
if -2.55e-8 < t < 2e-185Initial program 98.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites77.4%
Taylor expanded in b around 0
Applied rewrites43.7%
Taylor expanded in t around 0
Applied rewrites43.6%
if 2e-185 < t < 7.7999999999999994e95Initial program 98.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6454.1
Applied rewrites54.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -2.55e-8)
t_1
(if (<= t 1.02e-289) (+ a x) (if (<= t 7.8e+95) (* (- y 2.0) b) 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.55e-8) {
tmp = t_1;
} else if (t <= 1.02e-289) {
tmp = a + x;
} else if (t <= 7.8e+95) {
tmp = (y - 2.0) * b;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 <= (-2.55d-8)) then
tmp = t_1
else if (t <= 1.02d-289) then
tmp = a + x
else if (t <= 7.8d+95) then
tmp = (y - 2.0d0) * b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -2.55e-8) {
tmp = t_1;
} else if (t <= 1.02e-289) {
tmp = a + x;
} else if (t <= 7.8e+95) {
tmp = (y - 2.0) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - a) * t tmp = 0 if t <= -2.55e-8: tmp = t_1 elif t <= 1.02e-289: tmp = a + x elif t <= 7.8e+95: tmp = (y - 2.0) * b 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.55e-8) tmp = t_1; elseif (t <= 1.02e-289) tmp = Float64(a + x); elseif (t <= 7.8e+95) tmp = Float64(Float64(y - 2.0) * b); 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 <= -2.55e-8) tmp = t_1; elseif (t <= 1.02e-289) tmp = a + x; elseif (t <= 7.8e+95) tmp = (y - 2.0) * b; 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, -2.55e-8], t$95$1, If[LessEqual[t, 1.02e-289], N[(a + x), $MachinePrecision], If[LessEqual[t, 7.8e+95], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -2.55 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{-289}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+95}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.55e-8 or 7.7999999999999994e95 < t Initial program 89.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.0
Applied rewrites75.0%
if -2.55e-8 < t < 1.02e-289Initial program 100.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites78.8%
Taylor expanded in b around 0
Applied rewrites46.2%
Taylor expanded in t around 0
Applied rewrites46.1%
if 1.02e-289 < t < 7.7999999999999994e95Initial program 97.3%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites74.5%
Taylor expanded in x around 0
Applied rewrites60.8%
Taylor expanded in a around 0
Applied rewrites47.6%
Taylor expanded in t around 0
Applied rewrites44.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -1.3e+41)
(* (- y 2.0) b)
(if (<= b 4.6e-117)
(+ a x)
(if (<= b 1.95e+116) (* (- t) a) (* (- t 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.3e+41) {
tmp = (y - 2.0) * b;
} else if (b <= 4.6e-117) {
tmp = a + x;
} else if (b <= 1.95e+116) {
tmp = -t * a;
} else {
tmp = (t - 2.0) * b;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 <= (-1.3d+41)) then
tmp = (y - 2.0d0) * b
else if (b <= 4.6d-117) then
tmp = a + x
else if (b <= 1.95d+116) then
tmp = -t * a
else
tmp = (t - 2.0d0) * b
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 <= -1.3e+41) {
tmp = (y - 2.0) * b;
} else if (b <= 4.6e-117) {
tmp = a + x;
} else if (b <= 1.95e+116) {
tmp = -t * a;
} else {
tmp = (t - 2.0) * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -1.3e+41: tmp = (y - 2.0) * b elif b <= 4.6e-117: tmp = a + x elif b <= 1.95e+116: tmp = -t * a else: tmp = (t - 2.0) * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.3e+41) tmp = Float64(Float64(y - 2.0) * b); elseif (b <= 4.6e-117) tmp = Float64(a + x); elseif (b <= 1.95e+116) tmp = Float64(Float64(-t) * a); else tmp = Float64(Float64(t - 2.0) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -1.3e+41) tmp = (y - 2.0) * b; elseif (b <= 4.6e-117) tmp = a + x; elseif (b <= 1.95e+116) tmp = -t * a; else tmp = (t - 2.0) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.3e+41], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[b, 4.6e-117], N[(a + x), $MachinePrecision], If[LessEqual[b, 1.95e+116], N[((-t) * a), $MachinePrecision], N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.3 \cdot 10^{+41}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{elif}\;b \leq 4.6 \cdot 10^{-117}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;b \leq 1.95 \cdot 10^{+116}:\\
\;\;\;\;\left(-t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(t - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -1.3e41Initial program 95.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites98.3%
Taylor expanded in x around 0
Applied rewrites92.3%
Taylor expanded in a around 0
Applied rewrites86.1%
Taylor expanded in t around 0
Applied rewrites59.2%
if -1.3e41 < b < 4.59999999999999989e-117Initial program 98.1%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites72.8%
Taylor expanded in b around 0
Applied rewrites61.2%
Taylor expanded in t around 0
Applied rewrites40.6%
if 4.59999999999999989e-117 < b < 1.95000000000000016e116Initial program 96.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6434.4
Applied rewrites34.4%
Taylor expanded in t around inf
Applied rewrites32.0%
if 1.95000000000000016e116 < b Initial program 84.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites85.1%
Taylor expanded in x around 0
Applied rewrites80.2%
Taylor expanded in a around 0
Applied rewrites77.5%
Taylor expanded in y around 0
Applied rewrites62.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- y 2.0) b)))
(if (<= b -1.3e+41)
t_1
(if (<= b 4.6e-117) (+ a x) (if (<= b 5.4e-18) (* (- t) a) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y - 2.0) * b;
double tmp;
if (b <= -1.3e+41) {
tmp = t_1;
} else if (b <= 4.6e-117) {
tmp = a + x;
} else if (b <= 5.4e-18) {
tmp = -t * a;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 = (y - 2.0d0) * b
if (b <= (-1.3d+41)) then
tmp = t_1
else if (b <= 4.6d-117) then
tmp = a + x
else if (b <= 5.4d-18) then
tmp = -t * a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y - 2.0) * b;
double tmp;
if (b <= -1.3e+41) {
tmp = t_1;
} else if (b <= 4.6e-117) {
tmp = a + x;
} else if (b <= 5.4e-18) {
tmp = -t * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (y - 2.0) * b tmp = 0 if b <= -1.3e+41: tmp = t_1 elif b <= 4.6e-117: tmp = a + x elif b <= 5.4e-18: tmp = -t * a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y - 2.0) * b) tmp = 0.0 if (b <= -1.3e+41) tmp = t_1; elseif (b <= 4.6e-117) tmp = Float64(a + x); elseif (b <= 5.4e-18) tmp = Float64(Float64(-t) * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (y - 2.0) * b; tmp = 0.0; if (b <= -1.3e+41) tmp = t_1; elseif (b <= 4.6e-117) tmp = a + x; elseif (b <= 5.4e-18) tmp = -t * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -1.3e+41], t$95$1, If[LessEqual[b, 4.6e-117], N[(a + x), $MachinePrecision], If[LessEqual[b, 5.4e-18], N[((-t) * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - 2\right) \cdot b\\
\mathbf{if}\;b \leq -1.3 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 4.6 \cdot 10^{-117}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{-18}:\\
\;\;\;\;\left(-t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.3e41 or 5.39999999999999977e-18 < b Initial program 91.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites89.9%
Taylor expanded in x around 0
Applied rewrites82.7%
Taylor expanded in a around 0
Applied rewrites72.8%
Taylor expanded in t around 0
Applied rewrites51.4%
if -1.3e41 < b < 4.59999999999999989e-117Initial program 98.1%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites72.8%
Taylor expanded in b around 0
Applied rewrites61.2%
Taylor expanded in t around 0
Applied rewrites40.6%
if 4.59999999999999989e-117 < b < 5.39999999999999977e-18Initial program 99.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.5
Applied rewrites39.5%
Taylor expanded in t around inf
Applied rewrites35.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.7e+33) (not (<= t 7.8e+95))) (* (- 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 <= -1.7e+33) || !(t <= 7.8e+95)) {
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 <= -1.7e+33) || !(t <= 7.8e+95)) 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, -1.7e+33], N[Not[LessEqual[t, 7.8e+95]], $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 -1.7 \cdot 10^{+33} \lor \neg \left(t \leq 7.8 \cdot 10^{+95}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right) + a\\
\end{array}
\end{array}
if t < -1.7e33 or 7.7999999999999994e95 < t Initial program 89.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6477.0
Applied rewrites77.0%
if -1.7e33 < t < 7.7999999999999994e95Initial program 98.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites75.8%
Taylor expanded in b around 0
Applied rewrites36.9%
Taylor expanded in t around 0
Applied rewrites72.5%
Final simplification74.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.3e+41) (not (<= b 8.2e+47))) (* (- (+ 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 <= -1.3e+41) || !(b <= 8.2e+47)) {
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 <= -1.3e+41) || !(b <= 8.2e+47)) 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, -1.3e+41], N[Not[LessEqual[b, 8.2e+47]], $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 -1.3 \cdot 10^{+41} \lor \neg \left(b \leq 8.2 \cdot 10^{+47}\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 < -1.3e41 or 8.2000000000000002e47 < b Initial program 90.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites92.8%
Taylor expanded in x around 0
Applied rewrites87.7%
Taylor expanded in a around 0
Applied rewrites80.6%
if -1.3e41 < b < 8.2000000000000002e47Initial program 97.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites71.9%
Taylor expanded in b around 0
Applied rewrites57.3%
Final simplification67.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -140000.0) (not (<= t 7.8e+95))) (* (- b a) t) (fma (- y 2.0) b a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -140000.0) || !(t <= 7.8e+95)) {
tmp = (b - a) * t;
} else {
tmp = fma((y - 2.0), b, a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -140000.0) || !(t <= 7.8e+95)) tmp = Float64(Float64(b - a) * t); else tmp = fma(Float64(y - 2.0), b, a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -140000.0], N[Not[LessEqual[t, 7.8e+95]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(N[(y - 2.0), $MachinePrecision] * b + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -140000 \lor \neg \left(t \leq 7.8 \cdot 10^{+95}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, a\right)\\
\end{array}
\end{array}
if t < -1.4e5 or 7.7999999999999994e95 < t Initial program 89.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.6
Applied rewrites75.6%
if -1.4e5 < t < 7.7999999999999994e95Initial program 98.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites76.8%
Taylor expanded in x around 0
Applied rewrites59.6%
Taylor expanded in t around 0
Applied rewrites56.1%
Final simplification64.4%
(FPCore (x y z t a b) :precision binary64 (if (<= b -2.4e+41) (* (- y 2.0) b) (if (<= b 3.1e+116) (* (- 1.0 t) a) (* (- t 2.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2.4e+41) {
tmp = (y - 2.0) * b;
} else if (b <= 3.1e+116) {
tmp = (1.0 - t) * a;
} else {
tmp = (t - 2.0) * b;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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.4d+41)) then
tmp = (y - 2.0d0) * b
else if (b <= 3.1d+116) then
tmp = (1.0d0 - t) * a
else
tmp = (t - 2.0d0) * b
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.4e+41) {
tmp = (y - 2.0) * b;
} else if (b <= 3.1e+116) {
tmp = (1.0 - t) * a;
} else {
tmp = (t - 2.0) * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -2.4e+41: tmp = (y - 2.0) * b elif b <= 3.1e+116: tmp = (1.0 - t) * a else: tmp = (t - 2.0) * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -2.4e+41) tmp = Float64(Float64(y - 2.0) * b); elseif (b <= 3.1e+116) tmp = Float64(Float64(1.0 - t) * a); else tmp = Float64(Float64(t - 2.0) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -2.4e+41) tmp = (y - 2.0) * b; elseif (b <= 3.1e+116) tmp = (1.0 - t) * a; else tmp = (t - 2.0) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2.4e+41], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[b, 3.1e+116], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.4 \cdot 10^{+41}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(t - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -2.4000000000000002e41Initial program 95.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites98.3%
Taylor expanded in x around 0
Applied rewrites92.3%
Taylor expanded in a around 0
Applied rewrites86.1%
Taylor expanded in t around 0
Applied rewrites59.2%
if -2.4000000000000002e41 < b < 3.09999999999999996e116Initial program 97.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.4
Applied rewrites39.4%
if 3.09999999999999996e116 < b Initial program 84.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites85.1%
Taylor expanded in x around 0
Applied rewrites80.2%
Taylor expanded in a around 0
Applied rewrites77.5%
Taylor expanded in y around 0
Applied rewrites62.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2.55e-8) (not (<= t 5.6e+47))) (* (- t) a) (+ a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.55e-8) || !(t <= 5.6e+47)) {
tmp = -t * a;
} 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 ((t <= (-2.55d-8)) .or. (.not. (t <= 5.6d+47))) then
tmp = -t * a
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 ((t <= -2.55e-8) || !(t <= 5.6e+47)) {
tmp = -t * a;
} else {
tmp = a + x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -2.55e-8) or not (t <= 5.6e+47): tmp = -t * a else: tmp = a + x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2.55e-8) || !(t <= 5.6e+47)) tmp = Float64(Float64(-t) * a); else tmp = Float64(a + x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -2.55e-8) || ~((t <= 5.6e+47))) tmp = -t * a; else tmp = a + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.55e-8], N[Not[LessEqual[t, 5.6e+47]], $MachinePrecision]], N[((-t) * a), $MachinePrecision], N[(a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.55 \cdot 10^{-8} \lor \neg \left(t \leq 5.6 \cdot 10^{+47}\right):\\
\;\;\;\;\left(-t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;a + x\\
\end{array}
\end{array}
if t < -2.55e-8 or 5.59999999999999976e47 < t Initial program 90.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.5
Applied rewrites43.5%
Taylor expanded in t around inf
Applied rewrites43.5%
if -2.55e-8 < t < 5.59999999999999976e47Initial program 98.5%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites75.1%
Taylor expanded in b around 0
Applied rewrites37.8%
Taylor expanded in t around 0
Applied rewrites37.8%
Final simplification40.4%
(FPCore (x y z t a b) :precision binary64 (if (<= z -3.3e+125) (* 1.0 z) (+ a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.3e+125) {
tmp = 1.0 * z;
} 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 (z <= (-3.3d+125)) then
tmp = 1.0d0 * z
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 (z <= -3.3e+125) {
tmp = 1.0 * z;
} else {
tmp = a + x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -3.3e+125: tmp = 1.0 * z else: tmp = a + x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.3e+125) tmp = Float64(1.0 * z); else tmp = Float64(a + x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -3.3e+125) tmp = 1.0 * z; else tmp = a + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.3e+125], N[(1.0 * z), $MachinePrecision], N[(a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+125}:\\
\;\;\;\;1 \cdot z\\
\mathbf{else}:\\
\;\;\;\;a + x\\
\end{array}
\end{array}
if z < -3.30000000000000005e125Initial program 80.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6458.6
Applied rewrites58.6%
Taylor expanded in y around 0
Applied rewrites28.4%
if -3.30000000000000005e125 < z Initial program 96.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites85.5%
Taylor expanded in b around 0
Applied rewrites45.9%
Taylor expanded in t around 0
Applied rewrites25.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 94.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites80.6%
Taylor expanded in b around 0
Applied rewrites42.7%
Taylor expanded in t around 0
Applied rewrites23.8%
herbie shell --seed 2025017
(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)))