
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2) (* (* (* y 9) z) t)) (* (* a 27) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.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 * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2), $MachinePrecision] - N[(N[(N[(y * 9), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2) (* (* (* y 9) z) t)) (* (* a 27) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.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 * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2), $MachinePrecision] - N[(N[(N[(y * 9), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmin (fmin y z) t))
(t_2 (fmax (fmin y z) t))
(t_3 (fmin (fmax y z) t_2))
(t_4 (fmax (fmax y z) t_2)))
(if (<=
t_3
3148880786512287/15744403932561434696684473303452629045213679255131528440951130063136634306810047014785327192773139116009306758441243430342744218096217082060889571263281690386187633395165356521866664817226721079737670210248565328244806179188238434160900023542852296724603729870848)
(+
(- (* x 2) (* (* (* t_4 t_3) t_1) 9))
(* (* (fmin a b) 27) (fmax a b)))
(-
x
(-
(* t_4 (* t_3 (* 9 t_1)))
(+ (* (fmax a b) (* 27 (fmin a b))) x))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmin(fmin(y, z), t);
double t_2 = fmax(fmin(y, z), t);
double t_3 = fmin(fmax(y, z), t_2);
double t_4 = fmax(fmax(y, z), t_2);
double tmp;
if (t_3 <= 2e-247) {
tmp = ((x * 2.0) - (((t_4 * t_3) * t_1) * 9.0)) + ((fmin(a, b) * 27.0) * fmax(a, b));
} else {
tmp = x - ((t_4 * (t_3 * (9.0 * t_1))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = fmin(fmin(y, z), t)
t_2 = fmax(fmin(y, z), t)
t_3 = fmin(fmax(y, z), t_2)
t_4 = fmax(fmax(y, z), t_2)
if (t_3 <= 2d-247) then
tmp = ((x * 2.0d0) - (((t_4 * t_3) * t_1) * 9.0d0)) + ((fmin(a, b) * 27.0d0) * fmax(a, b))
else
tmp = x - ((t_4 * (t_3 * (9.0d0 * t_1))) - ((fmax(a, b) * (27.0d0 * fmin(a, b))) + x))
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 = fmin(fmin(y, z), t);
double t_2 = fmax(fmin(y, z), t);
double t_3 = fmin(fmax(y, z), t_2);
double t_4 = fmax(fmax(y, z), t_2);
double tmp;
if (t_3 <= 2e-247) {
tmp = ((x * 2.0) - (((t_4 * t_3) * t_1) * 9.0)) + ((fmin(a, b) * 27.0) * fmax(a, b));
} else {
tmp = x - ((t_4 * (t_3 * (9.0 * t_1))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmin(fmin(y, z), t) t_2 = fmax(fmin(y, z), t) t_3 = fmin(fmax(y, z), t_2) t_4 = fmax(fmax(y, z), t_2) tmp = 0 if t_3 <= 2e-247: tmp = ((x * 2.0) - (((t_4 * t_3) * t_1) * 9.0)) + ((fmin(a, b) * 27.0) * fmax(a, b)) else: tmp = x - ((t_4 * (t_3 * (9.0 * t_1))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x)) return tmp
function code(x, y, z, t, a, b) t_1 = fmin(fmin(y, z), t) t_2 = fmax(fmin(y, z), t) t_3 = fmin(fmax(y, z), t_2) t_4 = fmax(fmax(y, z), t_2) tmp = 0.0 if (t_3 <= 2e-247) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(t_4 * t_3) * t_1) * 9.0)) + Float64(Float64(fmin(a, b) * 27.0) * fmax(a, b))); else tmp = Float64(x - Float64(Float64(t_4 * Float64(t_3 * Float64(9.0 * t_1))) - Float64(Float64(fmax(a, b) * Float64(27.0 * fmin(a, b))) + x))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = min(min(y, z), t); t_2 = max(min(y, z), t); t_3 = min(max(y, z), t_2); t_4 = max(max(y, z), t_2); tmp = 0.0; if (t_3 <= 2e-247) tmp = ((x * 2.0) - (((t_4 * t_3) * t_1) * 9.0)) + ((min(a, b) * 27.0) * max(a, b)); else tmp = x - ((t_4 * (t_3 * (9.0 * t_1))) - ((max(a, b) * (27.0 * min(a, b))) + x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[y, z], $MachinePrecision], t$95$2], $MachinePrecision]}, Block[{t$95$4 = N[Max[N[Max[y, z], $MachinePrecision], t$95$2], $MachinePrecision]}, If[LessEqual[t$95$3, 3148880786512287/15744403932561434696684473303452629045213679255131528440951130063136634306810047014785327192773139116009306758441243430342744218096217082060889571263281690386187633395165356521866664817226721079737670210248565328244806179188238434160900023542852296724603729870848], N[(N[(N[(x * 2), $MachinePrecision] - N[(N[(N[(t$95$4 * t$95$3), $MachinePrecision] * t$95$1), $MachinePrecision] * 9), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Min[a, b], $MachinePrecision] * 27), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(t$95$4 * N[(t$95$3 * N[(9 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Max[a, b], $MachinePrecision] * N[(27 * N[Min[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_3 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\
t_4 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\
\mathbf{if}\;t\_3 \leq \frac{3148880786512287}{15744403932561434696684473303452629045213679255131528440951130063136634306810047014785327192773139116009306758441243430342744218096217082060889571263281690386187633395165356521866664817226721079737670210248565328244806179188238434160900023542852296724603729870848}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(t\_4 \cdot t\_3\right) \cdot t\_1\right) \cdot 9\right) + \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\
\mathbf{else}:\\
\;\;\;\;x - \left(t\_4 \cdot \left(t\_3 \cdot \left(9 \cdot t\_1\right)\right) - \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right)\\
\end{array}
if z < 2e-247Initial program 94.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6494.3%
Applied rewrites94.3%
if 2e-247 < z Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax (fmin y z) t))
(t_2 (fmin (fmax y z) t_1))
(t_3 (fmax (fmax y z) t_1))
(t_4 (fmin (fmin y z) t)))
(if (<=
(* (* t_4 9) t_2)
100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336)
(-
x
(-
(* t_3 (* t_2 (* 9 t_4)))
(+ (* (fmax a b) (* 27 (fmin a b))) x)))
(+
(- (* x 2) (* (* (* t_3 t_4) 9) t_2))
(* (* (fmin a b) 27) (fmax a b))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double tmp;
if (((t_4 * 9.0) * t_2) <= 1e+308) {
tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
} else {
tmp = ((x * 2.0) - (((t_3 * t_4) * 9.0) * t_2)) + ((fmin(a, b) * 27.0) * fmax(a, b));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = fmax(fmin(y, z), t)
t_2 = fmin(fmax(y, z), t_1)
t_3 = fmax(fmax(y, z), t_1)
t_4 = fmin(fmin(y, z), t)
if (((t_4 * 9.0d0) * t_2) <= 1d+308) then
tmp = x - ((t_3 * (t_2 * (9.0d0 * t_4))) - ((fmax(a, b) * (27.0d0 * fmin(a, b))) + x))
else
tmp = ((x * 2.0d0) - (((t_3 * t_4) * 9.0d0) * t_2)) + ((fmin(a, b) * 27.0d0) * fmax(a, b))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double tmp;
if (((t_4 * 9.0) * t_2) <= 1e+308) {
tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
} else {
tmp = ((x * 2.0) - (((t_3 * t_4) * 9.0) * t_2)) + ((fmin(a, b) * 27.0) * fmax(a, b));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) tmp = 0 if ((t_4 * 9.0) * t_2) <= 1e+308: tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x)) else: tmp = ((x * 2.0) - (((t_3 * t_4) * 9.0) * t_2)) + ((fmin(a, b) * 27.0) * fmax(a, b)) return tmp
function code(x, y, z, t, a, b) t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) tmp = 0.0 if (Float64(Float64(t_4 * 9.0) * t_2) <= 1e+308) tmp = Float64(x - Float64(Float64(t_3 * Float64(t_2 * Float64(9.0 * t_4))) - Float64(Float64(fmax(a, b) * Float64(27.0 * fmin(a, b))) + x))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(t_3 * t_4) * 9.0) * t_2)) + Float64(Float64(fmin(a, b) * 27.0) * fmax(a, b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = max(min(y, z), t); t_2 = min(max(y, z), t_1); t_3 = max(max(y, z), t_1); t_4 = min(min(y, z), t); tmp = 0.0; if (((t_4 * 9.0) * t_2) <= 1e+308) tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((max(a, b) * (27.0 * min(a, b))) + x)); else tmp = ((x * 2.0) - (((t_3 * t_4) * 9.0) * t_2)) + ((min(a, b) * 27.0) * max(a, b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision], 100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336], N[(x - N[(N[(t$95$3 * N[(t$95$2 * N[(9 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Max[a, b], $MachinePrecision] * N[(27 * N[Min[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2), $MachinePrecision] - N[(N[(N[(t$95$3 * t$95$4), $MachinePrecision] * 9), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Min[a, b], $MachinePrecision] * 27), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
\mathbf{if}\;\left(t\_4 \cdot 9\right) \cdot t\_2 \leq 100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336:\\
\;\;\;\;x - \left(t\_3 \cdot \left(t\_2 \cdot \left(9 \cdot t\_4\right)\right) - \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(t\_3 \cdot t\_4\right) \cdot 9\right) \cdot t\_2\right) + \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\
\end{array}
if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 1e308Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
if 1e308 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) Initial program 94.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6494.8%
Applied rewrites94.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax (fmin y z) t))
(t_2 (fmin (fmax y z) t_1))
(t_3 (fmax (fmax y z) t_1))
(t_4 (fmin (fmin y z) t)))
(if (<=
(* (* t_4 9) t_2)
5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392)
(-
x
(-
(* t_3 (* t_2 (* 9 t_4)))
(+ (* (fmax a b) (* 27 (fmin a b))) x)))
(- x (* (* t_4 t_3) (* 9 t_2))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double tmp;
if (((t_4 * 9.0) * t_2) <= 5e+288) {
tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
} else {
tmp = x - ((t_4 * t_3) * (9.0 * t_2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = fmax(fmin(y, z), t)
t_2 = fmin(fmax(y, z), t_1)
t_3 = fmax(fmax(y, z), t_1)
t_4 = fmin(fmin(y, z), t)
if (((t_4 * 9.0d0) * t_2) <= 5d+288) then
tmp = x - ((t_3 * (t_2 * (9.0d0 * t_4))) - ((fmax(a, b) * (27.0d0 * fmin(a, b))) + x))
else
tmp = x - ((t_4 * t_3) * (9.0d0 * 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 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double tmp;
if (((t_4 * 9.0) * t_2) <= 5e+288) {
tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x));
} else {
tmp = x - ((t_4 * t_3) * (9.0 * t_2));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) tmp = 0 if ((t_4 * 9.0) * t_2) <= 5e+288: tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((fmax(a, b) * (27.0 * fmin(a, b))) + x)) else: tmp = x - ((t_4 * t_3) * (9.0 * t_2)) return tmp
function code(x, y, z, t, a, b) t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) tmp = 0.0 if (Float64(Float64(t_4 * 9.0) * t_2) <= 5e+288) tmp = Float64(x - Float64(Float64(t_3 * Float64(t_2 * Float64(9.0 * t_4))) - Float64(Float64(fmax(a, b) * Float64(27.0 * fmin(a, b))) + x))); else tmp = Float64(x - Float64(Float64(t_4 * t_3) * Float64(9.0 * t_2))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = max(min(y, z), t); t_2 = min(max(y, z), t_1); t_3 = max(max(y, z), t_1); t_4 = min(min(y, z), t); tmp = 0.0; if (((t_4 * 9.0) * t_2) <= 5e+288) tmp = x - ((t_3 * (t_2 * (9.0 * t_4))) - ((max(a, b) * (27.0 * min(a, b))) + x)); else tmp = x - ((t_4 * t_3) * (9.0 * t_2)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision], 5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392], N[(x - N[(N[(t$95$3 * N[(t$95$2 * N[(9 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Max[a, b], $MachinePrecision] * N[(27 * N[Min[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(t$95$4 * t$95$3), $MachinePrecision] * N[(9 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
\mathbf{if}\;\left(t\_4 \cdot 9\right) \cdot t\_2 \leq 5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392:\\
\;\;\;\;x - \left(t\_3 \cdot \left(t\_2 \cdot \left(9 \cdot t\_4\right)\right) - \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x - \left(t\_4 \cdot t\_3\right) \cdot \left(9 \cdot t\_2\right)\\
\end{array}
if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 5.0000000000000003e288Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
if 5.0000000000000003e288 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in x around inf
lower-*.f6429.9%
Applied rewrites29.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6440.6%
Applied rewrites40.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6440.8%
Applied rewrites40.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax z (fmax y t))) (t_2 (fmin z (fmax y t))))
(if (<=
(* (* (fmin y t) 9) t_2)
5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392)
(+
(+
(* (* t_1 -9) (* t_2 (fmin y t)))
(+ (* (fmax a b) (* 27 (fmin a b))) x))
x)
(- x (* (* (fmin y t) t_1) (* 9 t_2))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(z, fmax(y, t));
double t_2 = fmin(z, fmax(y, t));
double tmp;
if (((fmin(y, t) * 9.0) * t_2) <= 5e+288) {
tmp = (((t_1 * -9.0) * (t_2 * fmin(y, t))) + ((fmax(a, b) * (27.0 * fmin(a, b))) + x)) + x;
} else {
tmp = x - ((fmin(y, t) * t_1) * (9.0 * 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 = fmax(z, fmax(y, t))
t_2 = fmin(z, fmax(y, t))
if (((fmin(y, t) * 9.0d0) * t_2) <= 5d+288) then
tmp = (((t_1 * (-9.0d0)) * (t_2 * fmin(y, t))) + ((fmax(a, b) * (27.0d0 * fmin(a, b))) + x)) + x
else
tmp = x - ((fmin(y, t) * t_1) * (9.0d0 * 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 = fmax(z, fmax(y, t));
double t_2 = fmin(z, fmax(y, t));
double tmp;
if (((fmin(y, t) * 9.0) * t_2) <= 5e+288) {
tmp = (((t_1 * -9.0) * (t_2 * fmin(y, t))) + ((fmax(a, b) * (27.0 * fmin(a, b))) + x)) + x;
} else {
tmp = x - ((fmin(y, t) * t_1) * (9.0 * t_2));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmax(z, fmax(y, t)) t_2 = fmin(z, fmax(y, t)) tmp = 0 if ((fmin(y, t) * 9.0) * t_2) <= 5e+288: tmp = (((t_1 * -9.0) * (t_2 * fmin(y, t))) + ((fmax(a, b) * (27.0 * fmin(a, b))) + x)) + x else: tmp = x - ((fmin(y, t) * t_1) * (9.0 * t_2)) return tmp
function code(x, y, z, t, a, b) t_1 = fmax(z, fmax(y, t)) t_2 = fmin(z, fmax(y, t)) tmp = 0.0 if (Float64(Float64(fmin(y, t) * 9.0) * t_2) <= 5e+288) tmp = Float64(Float64(Float64(Float64(t_1 * -9.0) * Float64(t_2 * fmin(y, t))) + Float64(Float64(fmax(a, b) * Float64(27.0 * fmin(a, b))) + x)) + x); else tmp = Float64(x - Float64(Float64(fmin(y, t) * t_1) * Float64(9.0 * t_2))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = max(z, max(y, t)); t_2 = min(z, max(y, t)); tmp = 0.0; if (((min(y, t) * 9.0) * t_2) <= 5e+288) tmp = (((t_1 * -9.0) * (t_2 * min(y, t))) + ((max(a, b) * (27.0 * min(a, b))) + x)) + x; else tmp = x - ((min(y, t) * t_1) * (9.0 * t_2)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Min[y, t], $MachinePrecision] * 9), $MachinePrecision] * t$95$2), $MachinePrecision], 5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392], N[(N[(N[(N[(t$95$1 * -9), $MachinePrecision] * N[(t$95$2 * N[Min[y, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Max[a, b], $MachinePrecision] * N[(27 * N[Min[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x - N[(N[(N[Min[y, t], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(9 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\
\mathbf{if}\;\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2 \leq 5000000000000000308639167639335784434971861554815056291550264252694066882698357794712695854722323983471552292257456306551729539271697808586910576768349361427712955105458094109306737151690687681363669298012313862249742312894517401540770056211835210095606628791592565251804447546056630075392:\\
\;\;\;\;\left(\left(t\_1 \cdot -9\right) \cdot \left(t\_2 \cdot \mathsf{min}\left(y, t\right)\right) + \left(\mathsf{max}\left(a, b\right) \cdot \left(27 \cdot \mathsf{min}\left(a, b\right)\right) + x\right)\right) + x\\
\mathbf{else}:\\
\;\;\;\;x - \left(\mathsf{min}\left(y, t\right) \cdot t\_1\right) \cdot \left(9 \cdot t\_2\right)\\
\end{array}
if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 5.0000000000000003e288Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate-+r+N/A
associate-+r+N/A
lower-+.f64N/A
Applied rewrites94.5%
if 5.0000000000000003e288 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in x around inf
lower-*.f6429.9%
Applied rewrites29.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6440.6%
Applied rewrites40.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6440.8%
Applied rewrites40.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax (fmin y z) t))
(t_2 (fmin (fmax y z) t_1))
(t_3 (fmax (fmax y z) t_1))
(t_4 (fmin (fmin y z) t))
(t_5 (* (* (* t_4 9) t_2) t_3)))
(if (<=
t_5
-6805647338418769/340282366920938463463374607431768211456)
(+ (* -9 (* (* t_2 t_3) t_4)) (* (* (fmin a b) 27) (fmax a b)))
(if (<= t_5 200000000000000015259539682183774006589929941893120)
(- x (- (* (* -27 (fmax a b)) (fmin a b)) x))
(-
(* 27 (* (fmin a b) (fmax a b)))
(* 9 (* t_3 (* t_4 t_2))))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -2e-23) {
tmp = (-9.0 * ((t_2 * t_3) * t_4)) + ((fmin(a, b) * 27.0) * fmax(a, b));
} else if (t_5 <= 2e+50) {
tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
} else {
tmp = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_3 * (t_4 * t_2)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = fmax(fmin(y, z), t)
t_2 = fmin(fmax(y, z), t_1)
t_3 = fmax(fmax(y, z), t_1)
t_4 = fmin(fmin(y, z), t)
t_5 = ((t_4 * 9.0d0) * t_2) * t_3
if (t_5 <= (-2d-23)) then
tmp = ((-9.0d0) * ((t_2 * t_3) * t_4)) + ((fmin(a, b) * 27.0d0) * fmax(a, b))
else if (t_5 <= 2d+50) then
tmp = x - ((((-27.0d0) * fmax(a, b)) * fmin(a, b)) - x)
else
tmp = (27.0d0 * (fmin(a, b) * fmax(a, b))) - (9.0d0 * (t_3 * (t_4 * 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 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -2e-23) {
tmp = (-9.0 * ((t_2 * t_3) * t_4)) + ((fmin(a, b) * 27.0) * fmax(a, b));
} else if (t_5 <= 2e+50) {
tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
} else {
tmp = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_3 * (t_4 * t_2)));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = ((t_4 * 9.0) * t_2) * t_3 tmp = 0 if t_5 <= -2e-23: tmp = (-9.0 * ((t_2 * t_3) * t_4)) + ((fmin(a, b) * 27.0) * fmax(a, b)) elif t_5 <= 2e+50: tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x) else: tmp = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_3 * (t_4 * t_2))) return tmp
function code(x, y, z, t, a, b) t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3) tmp = 0.0 if (t_5 <= -2e-23) tmp = Float64(Float64(-9.0 * Float64(Float64(t_2 * t_3) * t_4)) + Float64(Float64(fmin(a, b) * 27.0) * fmax(a, b))); elseif (t_5 <= 2e+50) tmp = Float64(x - Float64(Float64(Float64(-27.0 * fmax(a, b)) * fmin(a, b)) - x)); else tmp = Float64(Float64(27.0 * Float64(fmin(a, b) * fmax(a, b))) - Float64(9.0 * Float64(t_3 * Float64(t_4 * t_2)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = max(min(y, z), t); t_2 = min(max(y, z), t_1); t_3 = max(max(y, z), t_1); t_4 = min(min(y, z), t); t_5 = ((t_4 * 9.0) * t_2) * t_3; tmp = 0.0; if (t_5 <= -2e-23) tmp = (-9.0 * ((t_2 * t_3) * t_4)) + ((min(a, b) * 27.0) * max(a, b)); elseif (t_5 <= 2e+50) tmp = x - (((-27.0 * max(a, b)) * min(a, b)) - x); else tmp = (27.0 * (min(a, b) * max(a, b))) - (9.0 * (t_3 * (t_4 * t_2))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -6805647338418769/340282366920938463463374607431768211456], N[(N[(-9 * N[(N[(t$95$2 * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Min[a, b], $MachinePrecision] * 27), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 200000000000000015259539682183774006589929941893120], N[(x - N[(N[(N[(-27 * N[Max[a, b], $MachinePrecision]), $MachinePrecision] * N[Min[a, b], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(N[(27 * N[(N[Min[a, b], $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(9 * N[(t$95$3 * N[(t$95$4 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\
\;\;\;\;-9 \cdot \left(\left(t\_2 \cdot t\_3\right) \cdot t\_4\right) + \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\
\mathbf{elif}\;t\_5 \leq 200000000000000015259539682183774006589929941893120:\\
\;\;\;\;x - \left(\left(-27 \cdot \mathsf{max}\left(a, b\right)\right) \cdot \mathsf{min}\left(a, b\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right)\right) - 9 \cdot \left(t\_3 \cdot \left(t\_4 \cdot t\_2\right)\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.9999999999999999e-23Initial program 94.4%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.9%
Applied rewrites66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6467.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.8%
Applied rewrites66.8%
if -1.9999999999999999e-23 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000002e50Initial program 94.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-+.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
Applied rewrites64.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6464.0%
Applied rewrites64.0%
if 2.0000000000000002e50 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.9%
Applied rewrites66.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax z (fmax y t)))
(t_2 (fmin z (fmax y t)))
(t_3
(-
(* 27 (* (fmin a b) (fmax a b)))
(* 9 (* t_1 (* (fmin y t) t_2)))))
(t_4 (* (* (* (fmin y t) 9) t_2) t_1)))
(if (<=
t_4
-6805647338418769/340282366920938463463374607431768211456)
t_3
(if (<= t_4 200000000000000015259539682183774006589929941893120)
(- x (- (* (* -27 (fmax a b)) (fmin a b)) x))
t_3))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(z, fmax(y, t));
double t_2 = fmin(z, fmax(y, t));
double t_3 = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_1 * (fmin(y, t) * t_2)));
double t_4 = ((fmin(y, t) * 9.0) * t_2) * t_1;
double tmp;
if (t_4 <= -2e-23) {
tmp = t_3;
} else if (t_4 <= 2e+50) {
tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
} else {
tmp = t_3;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = fmax(z, fmax(y, t))
t_2 = fmin(z, fmax(y, t))
t_3 = (27.0d0 * (fmin(a, b) * fmax(a, b))) - (9.0d0 * (t_1 * (fmin(y, t) * t_2)))
t_4 = ((fmin(y, t) * 9.0d0) * t_2) * t_1
if (t_4 <= (-2d-23)) then
tmp = t_3
else if (t_4 <= 2d+50) then
tmp = x - ((((-27.0d0) * fmax(a, b)) * fmin(a, b)) - x)
else
tmp = t_3
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 = fmax(z, fmax(y, t));
double t_2 = fmin(z, fmax(y, t));
double t_3 = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_1 * (fmin(y, t) * t_2)));
double t_4 = ((fmin(y, t) * 9.0) * t_2) * t_1;
double tmp;
if (t_4 <= -2e-23) {
tmp = t_3;
} else if (t_4 <= 2e+50) {
tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmax(z, fmax(y, t)) t_2 = fmin(z, fmax(y, t)) t_3 = (27.0 * (fmin(a, b) * fmax(a, b))) - (9.0 * (t_1 * (fmin(y, t) * t_2))) t_4 = ((fmin(y, t) * 9.0) * t_2) * t_1 tmp = 0 if t_4 <= -2e-23: tmp = t_3 elif t_4 <= 2e+50: tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x) else: tmp = t_3 return tmp
function code(x, y, z, t, a, b) t_1 = fmax(z, fmax(y, t)) t_2 = fmin(z, fmax(y, t)) t_3 = Float64(Float64(27.0 * Float64(fmin(a, b) * fmax(a, b))) - Float64(9.0 * Float64(t_1 * Float64(fmin(y, t) * t_2)))) t_4 = Float64(Float64(Float64(fmin(y, t) * 9.0) * t_2) * t_1) tmp = 0.0 if (t_4 <= -2e-23) tmp = t_3; elseif (t_4 <= 2e+50) tmp = Float64(x - Float64(Float64(Float64(-27.0 * fmax(a, b)) * fmin(a, b)) - x)); else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = max(z, max(y, t)); t_2 = min(z, max(y, t)); t_3 = (27.0 * (min(a, b) * max(a, b))) - (9.0 * (t_1 * (min(y, t) * t_2))); t_4 = ((min(y, t) * 9.0) * t_2) * t_1; tmp = 0.0; if (t_4 <= -2e-23) tmp = t_3; elseif (t_4 <= 2e+50) tmp = x - (((-27.0 * max(a, b)) * min(a, b)) - x); else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(27 * N[(N[Min[a, b], $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(9 * N[(t$95$1 * N[(N[Min[y, t], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[Min[y, t], $MachinePrecision] * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$4, -6805647338418769/340282366920938463463374607431768211456], t$95$3, If[LessEqual[t$95$4, 200000000000000015259539682183774006589929941893120], N[(x - N[(N[(N[(-27 * N[Max[a, b], $MachinePrecision]), $MachinePrecision] * N[Min[a, b], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_3 := 27 \cdot \left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right)\right) - 9 \cdot \left(t\_1 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_2\right)\right)\\
t_4 := \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2\right) \cdot t\_1\\
\mathbf{if}\;t\_4 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 200000000000000015259539682183774006589929941893120:\\
\;\;\;\;x - \left(\left(-27 \cdot \mathsf{max}\left(a, b\right)\right) \cdot \mathsf{min}\left(a, b\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.9999999999999999e-23 or 2.0000000000000002e50 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6466.9%
Applied rewrites66.9%
if -1.9999999999999999e-23 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000002e50Initial program 94.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-+.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
Applied rewrites64.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6464.0%
Applied rewrites64.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- x (- (* 9 (* (fmax y t) (* (fmin y t) z))) x)))
(t_2 (* (* (* (fmin y t) 9) z) (fmax y t))))
(if (<=
t_2
-6805647338418769/340282366920938463463374607431768211456)
t_1
(if (<=
t_2
336999333339383/3369993333393829974333376885877453834204643052817571560137951281152)
(- x (- (* (* -27 (fmax a b)) (fmin a b)) x))
t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x - ((9.0 * (fmax(y, t) * (fmin(y, t) * z))) - x);
double t_2 = ((fmin(y, t) * 9.0) * z) * fmax(y, t);
double tmp;
if (t_2 <= -2e-23) {
tmp = t_1;
} else if (t_2 <= 1e-52) {
tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 = x - ((9.0d0 * (fmax(y, t) * (fmin(y, t) * z))) - x)
t_2 = ((fmin(y, t) * 9.0d0) * z) * fmax(y, t)
if (t_2 <= (-2d-23)) then
tmp = t_1
else if (t_2 <= 1d-52) then
tmp = x - ((((-27.0d0) * fmax(a, b)) * fmin(a, b)) - x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x - ((9.0 * (fmax(y, t) * (fmin(y, t) * z))) - x);
double t_2 = ((fmin(y, t) * 9.0) * z) * fmax(y, t);
double tmp;
if (t_2 <= -2e-23) {
tmp = t_1;
} else if (t_2 <= 1e-52) {
tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x - ((9.0 * (fmax(y, t) * (fmin(y, t) * z))) - x) t_2 = ((fmin(y, t) * 9.0) * z) * fmax(y, t) tmp = 0 if t_2 <= -2e-23: tmp = t_1 elif t_2 <= 1e-52: tmp = x - (((-27.0 * fmax(a, b)) * fmin(a, b)) - x) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x - Float64(Float64(9.0 * Float64(fmax(y, t) * Float64(fmin(y, t) * z))) - x)) t_2 = Float64(Float64(Float64(fmin(y, t) * 9.0) * z) * fmax(y, t)) tmp = 0.0 if (t_2 <= -2e-23) tmp = t_1; elseif (t_2 <= 1e-52) tmp = Float64(x - Float64(Float64(Float64(-27.0 * fmax(a, b)) * fmin(a, b)) - x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x - ((9.0 * (max(y, t) * (min(y, t) * z))) - x); t_2 = ((min(y, t) * 9.0) * z) * max(y, t); tmp = 0.0; if (t_2 <= -2e-23) tmp = t_1; elseif (t_2 <= 1e-52) tmp = x - (((-27.0 * max(a, b)) * min(a, b)) - x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x - N[(N[(9 * N[(N[Max[y, t], $MachinePrecision] * N[(N[Min[y, t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Min[y, t], $MachinePrecision] * 9), $MachinePrecision] * z), $MachinePrecision] * N[Max[y, t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -6805647338418769/340282366920938463463374607431768211456], t$95$1, If[LessEqual[t$95$2, 336999333339383/3369993333393829974333376885877453834204643052817571560137951281152], N[(x - N[(N[(N[(-27 * N[Max[a, b], $MachinePrecision]), $MachinePrecision] * N[Min[a, b], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := x - \left(9 \cdot \left(\mathsf{max}\left(y, t\right) \cdot \left(\mathsf{min}\left(y, t\right) \cdot z\right)\right) - x\right)\\
t_2 := \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot z\right) \cdot \mathsf{max}\left(y, t\right)\\
\mathbf{if}\;t\_2 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq \frac{336999333339383}{3369993333393829974333376885877453834204643052817571560137951281152}:\\
\;\;\;\;x - \left(\left(-27 \cdot \mathsf{max}\left(a, b\right)\right) \cdot \mathsf{min}\left(a, b\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.9999999999999999e-23 or 1e-52 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in x around inf
lower-*.f6429.9%
Applied rewrites29.9%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6429.9%
Applied rewrites29.9%
Taylor expanded in a around 0
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6463.2%
Applied rewrites63.2%
if -1.9999999999999999e-23 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1e-52Initial program 94.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-+.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
Applied rewrites64.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6464.0%
Applied rewrites64.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax (fmin y z) t))
(t_2 (fmin (fmax y z) t_1))
(t_3 (fmax (fmax y z) t_1))
(t_4 (fmin (fmin y z) t))
(t_5 (* (* (* t_4 9) t_2) t_3)))
(if (<=
t_5
-499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424)
(* (* (* -9 t_2) t_3) t_4)
(if (<=
t_5
199999999999999998950733150383609864631589220901364351243883389463816617076615690273685504)
(- x (- (* -27 (* a b)) x))
(- x (* 9 (* t_3 (* t_4 t_2))))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -5e+224) {
tmp = ((-9.0 * t_2) * t_3) * t_4;
} else if (t_5 <= 2e+89) {
tmp = x - ((-27.0 * (a * b)) - x);
} else {
tmp = x - (9.0 * (t_3 * (t_4 * t_2)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = fmax(fmin(y, z), t)
t_2 = fmin(fmax(y, z), t_1)
t_3 = fmax(fmax(y, z), t_1)
t_4 = fmin(fmin(y, z), t)
t_5 = ((t_4 * 9.0d0) * t_2) * t_3
if (t_5 <= (-5d+224)) then
tmp = (((-9.0d0) * t_2) * t_3) * t_4
else if (t_5 <= 2d+89) then
tmp = x - (((-27.0d0) * (a * b)) - x)
else
tmp = x - (9.0d0 * (t_3 * (t_4 * 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 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -5e+224) {
tmp = ((-9.0 * t_2) * t_3) * t_4;
} else if (t_5 <= 2e+89) {
tmp = x - ((-27.0 * (a * b)) - x);
} else {
tmp = x - (9.0 * (t_3 * (t_4 * t_2)));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = ((t_4 * 9.0) * t_2) * t_3 tmp = 0 if t_5 <= -5e+224: tmp = ((-9.0 * t_2) * t_3) * t_4 elif t_5 <= 2e+89: tmp = x - ((-27.0 * (a * b)) - x) else: tmp = x - (9.0 * (t_3 * (t_4 * t_2))) return tmp
function code(x, y, z, t, a, b) t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3) tmp = 0.0 if (t_5 <= -5e+224) tmp = Float64(Float64(Float64(-9.0 * t_2) * t_3) * t_4); elseif (t_5 <= 2e+89) tmp = Float64(x - Float64(Float64(-27.0 * Float64(a * b)) - x)); else tmp = Float64(x - Float64(9.0 * Float64(t_3 * Float64(t_4 * t_2)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = max(min(y, z), t); t_2 = min(max(y, z), t_1); t_3 = max(max(y, z), t_1); t_4 = min(min(y, z), t); t_5 = ((t_4 * 9.0) * t_2) * t_3; tmp = 0.0; if (t_5 <= -5e+224) tmp = ((-9.0 * t_2) * t_3) * t_4; elseif (t_5 <= 2e+89) tmp = x - ((-27.0 * (a * b)) - x); else tmp = x - (9.0 * (t_3 * (t_4 * t_2))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424], N[(N[(N[(-9 * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[t$95$5, 199999999999999998950733150383609864631589220901364351243883389463816617076615690273685504], N[(x - N[(N[(-27 * N[(a * b), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(x - N[(9 * N[(t$95$3 * N[(t$95$4 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424:\\
\;\;\;\;\left(\left(-9 \cdot t\_2\right) \cdot t\_3\right) \cdot t\_4\\
\mathbf{elif}\;t\_5 \leq 199999999999999998950733150383609864631589220901364351243883389463816617076615690273685504:\\
\;\;\;\;x - \left(-27 \cdot \left(a \cdot b\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;x - 9 \cdot \left(t\_3 \cdot \left(t\_4 \cdot t\_2\right)\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -4.9999999999999996e224Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6480.4%
Applied rewrites80.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6436.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6436.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6436.1%
Applied rewrites36.1%
if -4.9999999999999996e224 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2e89Initial program 94.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-+.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
Applied rewrites64.1%
if 2e89 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in x around inf
lower-*.f6429.9%
Applied rewrites29.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6440.6%
Applied rewrites40.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax (fmin y z) t))
(t_2 (fmin (fmax y z) t_1))
(t_3 (fmax (fmax y z) t_1))
(t_4 (fmin (fmin y z) t))
(t_5 (* (* (* t_4 9) t_2) t_3)))
(if (<=
t_5
-499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424)
(* (* (* -9 t_2) t_3) t_4)
(if (<=
t_5
50000000000000001010943956357797349428804816160717887056888842810400200249908215467934891376640)
(- x (- (* -27 (* a b)) x))
(* t_4 (* -9 (* t_3 t_2)))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -5e+224) {
tmp = ((-9.0 * t_2) * t_3) * t_4;
} else if (t_5 <= 5e+94) {
tmp = x - ((-27.0 * (a * b)) - x);
} else {
tmp = t_4 * (-9.0 * (t_3 * t_2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = fmax(fmin(y, z), t)
t_2 = fmin(fmax(y, z), t_1)
t_3 = fmax(fmax(y, z), t_1)
t_4 = fmin(fmin(y, z), t)
t_5 = ((t_4 * 9.0d0) * t_2) * t_3
if (t_5 <= (-5d+224)) then
tmp = (((-9.0d0) * t_2) * t_3) * t_4
else if (t_5 <= 5d+94) then
tmp = x - (((-27.0d0) * (a * b)) - x)
else
tmp = t_4 * ((-9.0d0) * (t_3 * 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 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -5e+224) {
tmp = ((-9.0 * t_2) * t_3) * t_4;
} else if (t_5 <= 5e+94) {
tmp = x - ((-27.0 * (a * b)) - x);
} else {
tmp = t_4 * (-9.0 * (t_3 * t_2));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = ((t_4 * 9.0) * t_2) * t_3 tmp = 0 if t_5 <= -5e+224: tmp = ((-9.0 * t_2) * t_3) * t_4 elif t_5 <= 5e+94: tmp = x - ((-27.0 * (a * b)) - x) else: tmp = t_4 * (-9.0 * (t_3 * t_2)) return tmp
function code(x, y, z, t, a, b) t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3) tmp = 0.0 if (t_5 <= -5e+224) tmp = Float64(Float64(Float64(-9.0 * t_2) * t_3) * t_4); elseif (t_5 <= 5e+94) tmp = Float64(x - Float64(Float64(-27.0 * Float64(a * b)) - x)); else tmp = Float64(t_4 * Float64(-9.0 * Float64(t_3 * t_2))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = max(min(y, z), t); t_2 = min(max(y, z), t_1); t_3 = max(max(y, z), t_1); t_4 = min(min(y, z), t); t_5 = ((t_4 * 9.0) * t_2) * t_3; tmp = 0.0; if (t_5 <= -5e+224) tmp = ((-9.0 * t_2) * t_3) * t_4; elseif (t_5 <= 5e+94) tmp = x - ((-27.0 * (a * b)) - x); else tmp = t_4 * (-9.0 * (t_3 * t_2)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424], N[(N[(N[(-9 * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[t$95$5, 50000000000000001010943956357797349428804816160717887056888842810400200249908215467934891376640], N[(x - N[(N[(-27 * N[(a * b), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(t$95$4 * N[(-9 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424:\\
\;\;\;\;\left(\left(-9 \cdot t\_2\right) \cdot t\_3\right) \cdot t\_4\\
\mathbf{elif}\;t\_5 \leq 50000000000000001010943956357797349428804816160717887056888842810400200249908215467934891376640:\\
\;\;\;\;x - \left(-27 \cdot \left(a \cdot b\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -4.9999999999999996e224Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6480.4%
Applied rewrites80.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6436.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6436.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6436.1%
Applied rewrites36.1%
if -4.9999999999999996e224 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 5.0000000000000001e94Initial program 94.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-+.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
Applied rewrites64.1%
if 5.0000000000000001e94 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6480.4%
Applied rewrites80.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax (fmin y z) t))
(t_2 (fmin (fmax y z) t_1))
(t_3 (fmax (fmax y z) t_1))
(t_4 (fmin (fmin y z) t))
(t_5 (* (* (* t_4 9) t_2) t_3)))
(if (<=
t_5
-499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424)
(* (* (* -9 t_2) t_3) t_4)
(if (<= t_5 200000000000000015259539682183774006589929941893120)
(+ (+ x x) (* (* 27 b) a))
(* t_4 (* -9 (* t_3 t_2)))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -5e+224) {
tmp = ((-9.0 * t_2) * t_3) * t_4;
} else if (t_5 <= 2e+50) {
tmp = (x + x) + ((27.0 * b) * a);
} else {
tmp = t_4 * (-9.0 * (t_3 * t_2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = fmax(fmin(y, z), t)
t_2 = fmin(fmax(y, z), t_1)
t_3 = fmax(fmax(y, z), t_1)
t_4 = fmin(fmin(y, z), t)
t_5 = ((t_4 * 9.0d0) * t_2) * t_3
if (t_5 <= (-5d+224)) then
tmp = (((-9.0d0) * t_2) * t_3) * t_4
else if (t_5 <= 2d+50) then
tmp = (x + x) + ((27.0d0 * b) * a)
else
tmp = t_4 * ((-9.0d0) * (t_3 * 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 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -5e+224) {
tmp = ((-9.0 * t_2) * t_3) * t_4;
} else if (t_5 <= 2e+50) {
tmp = (x + x) + ((27.0 * b) * a);
} else {
tmp = t_4 * (-9.0 * (t_3 * t_2));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = ((t_4 * 9.0) * t_2) * t_3 tmp = 0 if t_5 <= -5e+224: tmp = ((-9.0 * t_2) * t_3) * t_4 elif t_5 <= 2e+50: tmp = (x + x) + ((27.0 * b) * a) else: tmp = t_4 * (-9.0 * (t_3 * t_2)) return tmp
function code(x, y, z, t, a, b) t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3) tmp = 0.0 if (t_5 <= -5e+224) tmp = Float64(Float64(Float64(-9.0 * t_2) * t_3) * t_4); elseif (t_5 <= 2e+50) tmp = Float64(Float64(x + x) + Float64(Float64(27.0 * b) * a)); else tmp = Float64(t_4 * Float64(-9.0 * Float64(t_3 * t_2))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = max(min(y, z), t); t_2 = min(max(y, z), t_1); t_3 = max(max(y, z), t_1); t_4 = min(min(y, z), t); t_5 = ((t_4 * 9.0) * t_2) * t_3; tmp = 0.0; if (t_5 <= -5e+224) tmp = ((-9.0 * t_2) * t_3) * t_4; elseif (t_5 <= 2e+50) tmp = (x + x) + ((27.0 * b) * a); else tmp = t_4 * (-9.0 * (t_3 * t_2)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424], N[(N[(N[(-9 * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[t$95$5, 200000000000000015259539682183774006589929941893120], N[(N[(x + x), $MachinePrecision] + N[(N[(27 * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(t$95$4 * N[(-9 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq -499999999999999964227111724318263497804707306223243456268197521522525585749208789151208295153553467188676004711794318067127242311470730588919109020314930679307514026089293096804165265079253323065443524458327730161833343975424:\\
\;\;\;\;\left(\left(-9 \cdot t\_2\right) \cdot t\_3\right) \cdot t\_4\\
\mathbf{elif}\;t\_5 \leq 200000000000000015259539682183774006589929941893120:\\
\;\;\;\;\left(x + x\right) + \left(27 \cdot b\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -4.9999999999999996e224Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6480.4%
Applied rewrites80.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6436.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6436.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6436.1%
Applied rewrites36.1%
if -4.9999999999999996e224 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000002e50Initial program 94.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-*.f64N/A
count-2-revN/A
lower-+.f6464.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6464.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6464.0%
Applied rewrites64.0%
if 2.0000000000000002e50 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6480.4%
Applied rewrites80.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax (fmin y z) t))
(t_2 (fmin (fmax y z) t_1))
(t_3 (fmax (fmax y z) t_1))
(t_4 (fmin (fmin y z) t))
(t_5 (* (* (* t_4 9) t_2) t_3)))
(if (<=
t_5
-6805647338418769/340282366920938463463374607431768211456)
(* t_4 (* (* -9 t_3) t_2))
(if (<=
t_5
6304320991423117/630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056)
(- x (* -27 (* a b)))
(if (<= t_5 200000000000000015259539682183774006589929941893120)
(- x (- x))
(* t_4 (* -9 (* t_3 t_2))))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -2e-23) {
tmp = t_4 * ((-9.0 * t_3) * t_2);
} else if (t_5 <= 1e-101) {
tmp = x - (-27.0 * (a * b));
} else if (t_5 <= 2e+50) {
tmp = x - -x;
} else {
tmp = t_4 * (-9.0 * (t_3 * t_2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = fmax(fmin(y, z), t)
t_2 = fmin(fmax(y, z), t_1)
t_3 = fmax(fmax(y, z), t_1)
t_4 = fmin(fmin(y, z), t)
t_5 = ((t_4 * 9.0d0) * t_2) * t_3
if (t_5 <= (-2d-23)) then
tmp = t_4 * (((-9.0d0) * t_3) * t_2)
else if (t_5 <= 1d-101) then
tmp = x - ((-27.0d0) * (a * b))
else if (t_5 <= 2d+50) then
tmp = x - -x
else
tmp = t_4 * ((-9.0d0) * (t_3 * 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 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_5 <= -2e-23) {
tmp = t_4 * ((-9.0 * t_3) * t_2);
} else if (t_5 <= 1e-101) {
tmp = x - (-27.0 * (a * b));
} else if (t_5 <= 2e+50) {
tmp = x - -x;
} else {
tmp = t_4 * (-9.0 * (t_3 * t_2));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = ((t_4 * 9.0) * t_2) * t_3 tmp = 0 if t_5 <= -2e-23: tmp = t_4 * ((-9.0 * t_3) * t_2) elif t_5 <= 1e-101: tmp = x - (-27.0 * (a * b)) elif t_5 <= 2e+50: tmp = x - -x else: tmp = t_4 * (-9.0 * (t_3 * t_2)) return tmp
function code(x, y, z, t, a, b) t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3) tmp = 0.0 if (t_5 <= -2e-23) tmp = Float64(t_4 * Float64(Float64(-9.0 * t_3) * t_2)); elseif (t_5 <= 1e-101) tmp = Float64(x - Float64(-27.0 * Float64(a * b))); elseif (t_5 <= 2e+50) tmp = Float64(x - Float64(-x)); else tmp = Float64(t_4 * Float64(-9.0 * Float64(t_3 * t_2))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = max(min(y, z), t); t_2 = min(max(y, z), t_1); t_3 = max(max(y, z), t_1); t_4 = min(min(y, z), t); t_5 = ((t_4 * 9.0) * t_2) * t_3; tmp = 0.0; if (t_5 <= -2e-23) tmp = t_4 * ((-9.0 * t_3) * t_2); elseif (t_5 <= 1e-101) tmp = x - (-27.0 * (a * b)); elseif (t_5 <= 2e+50) tmp = x - -x; else tmp = t_4 * (-9.0 * (t_3 * t_2)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -6805647338418769/340282366920938463463374607431768211456], N[(t$95$4 * N[(N[(-9 * t$95$3), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 6304320991423117/630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056], N[(x - N[(-27 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 200000000000000015259539682183774006589929941893120], N[(x - (-x)), $MachinePrecision], N[(t$95$4 * N[(-9 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_5 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\
\;\;\;\;t\_4 \cdot \left(\left(-9 \cdot t\_3\right) \cdot t\_2\right)\\
\mathbf{elif}\;t\_5 \leq \frac{6304320991423117}{630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056}:\\
\;\;\;\;x - -27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;t\_5 \leq 200000000000000015259539682183774006589929941893120:\\
\;\;\;\;x - \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.9999999999999999e-23Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6480.4%
Applied rewrites80.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
if -1.9999999999999999e-23 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.0000000000000001e-101Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6440.9%
Applied rewrites40.9%
if 1.0000000000000001e-101 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000002e50Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in x around inf
lower-*.f6429.9%
Applied rewrites29.9%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6429.9%
Applied rewrites29.9%
if 2.0000000000000002e50 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6480.4%
Applied rewrites80.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fmax (fmin y z) t))
(t_2 (fmin (fmax y z) t_1))
(t_3 (fmax (fmax y z) t_1))
(t_4 (fmin (fmin y z) t))
(t_5 (* t_4 (* -9 (* t_3 t_2))))
(t_6 (* (* (* t_4 9) t_2) t_3)))
(if (<=
t_6
-6805647338418769/340282366920938463463374607431768211456)
t_5
(if (<=
t_6
6304320991423117/630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056)
(- x (* -27 (* a b)))
(if (<= t_6 200000000000000015259539682183774006589929941893120)
(- x (- x))
t_5)))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = t_4 * (-9.0 * (t_3 * t_2));
double t_6 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_6 <= -2e-23) {
tmp = t_5;
} else if (t_6 <= 1e-101) {
tmp = x - (-27.0 * (a * b));
} else if (t_6 <= 2e+50) {
tmp = x - -x;
} else {
tmp = t_5;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = fmax(fmin(y, z), t)
t_2 = fmin(fmax(y, z), t_1)
t_3 = fmax(fmax(y, z), t_1)
t_4 = fmin(fmin(y, z), t)
t_5 = t_4 * ((-9.0d0) * (t_3 * t_2))
t_6 = ((t_4 * 9.0d0) * t_2) * t_3
if (t_6 <= (-2d-23)) then
tmp = t_5
else if (t_6 <= 1d-101) then
tmp = x - ((-27.0d0) * (a * b))
else if (t_6 <= 2d+50) then
tmp = x - -x
else
tmp = t_5
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 = fmax(fmin(y, z), t);
double t_2 = fmin(fmax(y, z), t_1);
double t_3 = fmax(fmax(y, z), t_1);
double t_4 = fmin(fmin(y, z), t);
double t_5 = t_4 * (-9.0 * (t_3 * t_2));
double t_6 = ((t_4 * 9.0) * t_2) * t_3;
double tmp;
if (t_6 <= -2e-23) {
tmp = t_5;
} else if (t_6 <= 1e-101) {
tmp = x - (-27.0 * (a * b));
} else if (t_6 <= 2e+50) {
tmp = x - -x;
} else {
tmp = t_5;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = t_4 * (-9.0 * (t_3 * t_2)) t_6 = ((t_4 * 9.0) * t_2) * t_3 tmp = 0 if t_6 <= -2e-23: tmp = t_5 elif t_6 <= 1e-101: tmp = x - (-27.0 * (a * b)) elif t_6 <= 2e+50: tmp = x - -x else: tmp = t_5 return tmp
function code(x, y, z, t, a, b) t_1 = fmax(fmin(y, z), t) t_2 = fmin(fmax(y, z), t_1) t_3 = fmax(fmax(y, z), t_1) t_4 = fmin(fmin(y, z), t) t_5 = Float64(t_4 * Float64(-9.0 * Float64(t_3 * t_2))) t_6 = Float64(Float64(Float64(t_4 * 9.0) * t_2) * t_3) tmp = 0.0 if (t_6 <= -2e-23) tmp = t_5; elseif (t_6 <= 1e-101) tmp = Float64(x - Float64(-27.0 * Float64(a * b))); elseif (t_6 <= 2e+50) tmp = Float64(x - Float64(-x)); else tmp = t_5; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = max(min(y, z), t); t_2 = min(max(y, z), t_1); t_3 = max(max(y, z), t_1); t_4 = min(min(y, z), t); t_5 = t_4 * (-9.0 * (t_3 * t_2)); t_6 = ((t_4 * 9.0) * t_2) * t_3; tmp = 0.0; if (t_6 <= -2e-23) tmp = t_5; elseif (t_6 <= 1e-101) tmp = x - (-27.0 * (a * b)); elseif (t_6 <= 2e+50) tmp = x - -x; else tmp = t_5; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * N[(-9 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$4 * 9), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision]}, If[LessEqual[t$95$6, -6805647338418769/340282366920938463463374607431768211456], t$95$5, If[LessEqual[t$95$6, 6304320991423117/630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056], N[(x - N[(-27 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 200000000000000015259539682183774006589929941893120], N[(x - (-x)), $MachinePrecision], t$95$5]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_5 := t\_4 \cdot \left(-9 \cdot \left(t\_3 \cdot t\_2\right)\right)\\
t_6 := \left(\left(t\_4 \cdot 9\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{if}\;t\_6 \leq \frac{-6805647338418769}{340282366920938463463374607431768211456}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_6 \leq \frac{6304320991423117}{630432099142311667396464641602297820881275828327447146687172694467931548343955369782628260078158650252906047844909056}:\\
\;\;\;\;x - -27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;t\_6 \leq 200000000000000015259539682183774006589929941893120:\\
\;\;\;\;x - \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -1.9999999999999999e-23 or 2.0000000000000002e50 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6480.4%
Applied rewrites80.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f6436.1%
Applied rewrites36.1%
if -1.9999999999999999e-23 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.0000000000000001e-101Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6440.9%
Applied rewrites40.9%
if 1.0000000000000001e-101 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000002e50Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in x around inf
lower-*.f6429.9%
Applied rewrites29.9%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6429.9%
Applied rewrites29.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* a 27) b)) (t_2 (- x (* -27 (* a b)))))
(if (<= t_1 -2000000000000)
t_2
(if (<=
t_1
4789048565205903/95780971304118053647396689196894323976171195136475136)
(- x (- x))
t_2))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double t_2 = x - (-27.0 * (a * b));
double tmp;
if (t_1 <= -2000000000000.0) {
tmp = t_2;
} else if (t_1 <= 5e-38) {
tmp = x - -x;
} 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 = (a * 27.0d0) * b
t_2 = x - ((-27.0d0) * (a * b))
if (t_1 <= (-2000000000000.0d0)) then
tmp = t_2
else if (t_1 <= 5d-38) then
tmp = x - -x
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 = (a * 27.0) * b;
double t_2 = x - (-27.0 * (a * b));
double tmp;
if (t_1 <= -2000000000000.0) {
tmp = t_2;
} else if (t_1 <= 5e-38) {
tmp = x - -x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * 27.0) * b t_2 = x - (-27.0 * (a * b)) tmp = 0 if t_1 <= -2000000000000.0: tmp = t_2 elif t_1 <= 5e-38: tmp = x - -x else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * 27.0) * b) t_2 = Float64(x - Float64(-27.0 * Float64(a * b))) tmp = 0.0 if (t_1 <= -2000000000000.0) tmp = t_2; elseif (t_1 <= 5e-38) tmp = Float64(x - Float64(-x)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * 27.0) * b; t_2 = x - (-27.0 * (a * b)); tmp = 0.0; if (t_1 <= -2000000000000.0) tmp = t_2; elseif (t_1 <= 5e-38) tmp = x - -x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(-27 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2000000000000], t$95$2, If[LessEqual[t$95$1, 4789048565205903/95780971304118053647396689196894323976171195136475136], N[(x - (-x)), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
t_2 := x - -27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;t\_1 \leq -2000000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \frac{4789048565205903}{95780971304118053647396689196894323976171195136475136}:\\
\;\;\;\;x - \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -2e12 or 5.0000000000000003e-38 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6440.9%
Applied rewrites40.9%
if -2e12 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 5.0000000000000003e-38Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in x around inf
lower-*.f6429.9%
Applied rewrites29.9%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6429.9%
Applied rewrites29.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* a 27) b)) (t_2 (* 27 (* a b))))
(if (<= t_1 -10000000000000000905969664)
t_2
(if (<=
t_1
5021681388309345/50216813883093446110686315385661331328818843555712276103168)
(- x (- x))
t_2))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double t_2 = 27.0 * (a * b);
double tmp;
if (t_1 <= -1e+25) {
tmp = t_2;
} else if (t_1 <= 1e-43) {
tmp = x - -x;
} 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 = (a * 27.0d0) * b
t_2 = 27.0d0 * (a * b)
if (t_1 <= (-1d+25)) then
tmp = t_2
else if (t_1 <= 1d-43) then
tmp = x - -x
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 = (a * 27.0) * b;
double t_2 = 27.0 * (a * b);
double tmp;
if (t_1 <= -1e+25) {
tmp = t_2;
} else if (t_1 <= 1e-43) {
tmp = x - -x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * 27.0) * b t_2 = 27.0 * (a * b) tmp = 0 if t_1 <= -1e+25: tmp = t_2 elif t_1 <= 1e-43: tmp = x - -x else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * 27.0) * b) t_2 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (t_1 <= -1e+25) tmp = t_2; elseif (t_1 <= 1e-43) tmp = Float64(x - Float64(-x)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * 27.0) * b; t_2 = 27.0 * (a * b); tmp = 0.0; if (t_1 <= -1e+25) tmp = t_2; elseif (t_1 <= 1e-43) tmp = x - -x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(27 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -10000000000000000905969664], t$95$2, If[LessEqual[t$95$1, 5021681388309345/50216813883093446110686315385661331328818843555712276103168], N[(x - (-x)), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;t\_1 \leq -10000000000000000905969664:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \frac{5021681388309345}{50216813883093446110686315385661331328818843555712276103168}:\\
\;\;\;\;x - \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -1.0000000000000001e25 or 1.0000000000000001e-43 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) Initial program 94.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.1%
Applied rewrites64.1%
lift-+.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
Applied rewrites64.1%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6436.2%
Applied rewrites36.2%
if -1.0000000000000001e25 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 1.0000000000000001e-43Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in x around inf
lower-*.f6429.9%
Applied rewrites29.9%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6429.9%
Applied rewrites29.9%
(FPCore (x y z t a b) :precision binary64 (- x (- x)))
double code(double x, double y, double z, double t, double a, double b) {
return x - -x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x - -x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x - -x;
}
def code(x, y, z, t, a, b): return x - -x
function code(x, y, z, t, a, b) return Float64(x - Float64(-x)) end
function tmp = code(x, y, z, t, a, b) tmp = x - -x; end
code[x_, y_, z_, t_, a_, b_] := N[(x - (-x)), $MachinePrecision]
x - \left(-x\right)
Initial program 94.4%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in x around inf
lower-*.f6429.9%
Applied rewrites29.9%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6429.9%
Applied rewrites29.9%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
(+ (- (* x 2) (* (* (* y 9) z) t)) (* (* a 27) b)))