
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16)) (/ (* a b) 4)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16)) (/ (* a b) 4)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (* (* 1/16 z) t)) (* (* b a) 1/4)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((0.0625 * z) * t)) - ((b * a) * 0.25)) + c;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((x * y) + ((0.0625d0 * z) * t)) - ((b * a) * 0.25d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((0.0625 * z) * t)) - ((b * a) * 0.25)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((0.0625 * z) * t)) - ((b * a) * 0.25)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(0.0625 * z) * t)) - Float64(Float64(b * a) * 0.25)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((0.0625 * z) * t)) - ((b * a) * 0.25)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(1/16 * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] - N[(N[(b * a), $MachinePrecision] * 1/4), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\left(\left(x \cdot y + \left(\frac{1}{16} \cdot z\right) \cdot t\right) - \left(b \cdot a\right) \cdot \frac{1}{4}\right) + c
Initial program 97.5%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval97.6%
Applied rewrites97.6%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lower-*.f6497.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.6%
Applied rewrites97.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* 1/4 (* a b))))
(if (<= (* x y) -500000000000000022442856339037958392774656)
(+ (- (* x y) t_1) c)
(if (<=
(* x y)
40000000000000001313662499568197043159480502654384467820492537050349880275951519821760052625109096507357980191372897423145939625368459673600)
(+ (- (* 1/16 (* t z)) t_1) c)
(+ c (+ (* (* z 1/16) t) (* x y)))))))double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = 0.25 * (a * b);
double tmp;
if ((x * y) <= -5e+41) {
tmp = ((x * y) - t_1) + c;
} else if ((x * y) <= 4e+139) {
tmp = ((0.0625 * (t * z)) - t_1) + c;
} else {
tmp = c + (((z * 0.0625) * t) + (x * y));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = 0.25d0 * (a * b)
if ((x * y) <= (-5d+41)) then
tmp = ((x * y) - t_1) + c
else if ((x * y) <= 4d+139) then
tmp = ((0.0625d0 * (t * z)) - t_1) + c
else
tmp = c + (((z * 0.0625d0) * t) + (x * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = 0.25 * (a * b);
double tmp;
if ((x * y) <= -5e+41) {
tmp = ((x * y) - t_1) + c;
} else if ((x * y) <= 4e+139) {
tmp = ((0.0625 * (t * z)) - t_1) + c;
} else {
tmp = c + (((z * 0.0625) * t) + (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = 0.25 * (a * b) tmp = 0 if (x * y) <= -5e+41: tmp = ((x * y) - t_1) + c elif (x * y) <= 4e+139: tmp = ((0.0625 * (t * z)) - t_1) + c else: tmp = c + (((z * 0.0625) * t) + (x * y)) return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(0.25 * Float64(a * b)) tmp = 0.0 if (Float64(x * y) <= -5e+41) tmp = Float64(Float64(Float64(x * y) - t_1) + c); elseif (Float64(x * y) <= 4e+139) tmp = Float64(Float64(Float64(0.0625 * Float64(t * z)) - t_1) + c); else tmp = Float64(c + Float64(Float64(Float64(z * 0.0625) * t) + Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = 0.25 * (a * b); tmp = 0.0; if ((x * y) <= -5e+41) tmp = ((x * y) - t_1) + c; elseif ((x * y) <= 4e+139) tmp = ((0.0625 * (t * z)) - t_1) + c; else tmp = c + (((z * 0.0625) * t) + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(1/4 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -500000000000000022442856339037958392774656], N[(N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision] + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 40000000000000001313662499568197043159480502654384467820492537050349880275951519821760052625109096507357980191372897423145939625368459673600], N[(N[(N[(1/16 * N[(t * z), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] + c), $MachinePrecision], N[(c + N[(N[(N[(z * 1/16), $MachinePrecision] * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{1}{4} \cdot \left(a \cdot b\right)\\
\mathbf{if}\;x \cdot y \leq -500000000000000022442856339037958392774656:\\
\;\;\;\;\left(x \cdot y - t\_1\right) + c\\
\mathbf{elif}\;x \cdot y \leq 40000000000000001313662499568197043159480502654384467820492537050349880275951519821760052625109096507357980191372897423145939625368459673600:\\
\;\;\;\;\left(\frac{1}{16} \cdot \left(t \cdot z\right) - t\_1\right) + c\\
\mathbf{else}:\\
\;\;\;\;c + \left(\left(z \cdot \frac{1}{16}\right) \cdot t + x \cdot y\right)\\
\end{array}
if (*.f64 x y) < -5.0000000000000002e41Initial program 97.5%
Taylor expanded in z around 0
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.6%
Applied rewrites73.6%
if -5.0000000000000002e41 < (*.f64 x y) < 4.0000000000000001e139Initial program 97.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.4%
Applied rewrites73.4%
if 4.0000000000000001e139 < (*.f64 x y) Initial program 97.5%
Taylor expanded in a around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.8%
Applied rewrites73.8%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6473.8%
Applied rewrites73.8%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (* a b) 4)))
(if (<=
t_1
-5000000000000000014339392554976861624351030032307491891786714963455192826951136079841645978666612324808479156564299152005093968192740890223899883592402933027172967020052041660293849107704861024718326980908701245637596009600853559934996040535864898581843704726957456644770889728)
(* (- (* 1/4 a)) b)
(if (<=
t_1
100000000000000009190283508143378238084034459715684532224)
(+ c (+ (* (* z 1/16) t) (* x y)))
(+ (- (* x y) (* 1/4 (* a b))) c)))))double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) / 4.0;
double tmp;
if (t_1 <= -5e+276) {
tmp = -(0.25 * a) * b;
} else if (t_1 <= 1e+56) {
tmp = c + (((z * 0.0625) * t) + (x * y));
} else {
tmp = ((x * y) - (0.25 * (a * b))) + c;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = (a * b) / 4.0d0
if (t_1 <= (-5d+276)) then
tmp = -(0.25d0 * a) * b
else if (t_1 <= 1d+56) then
tmp = c + (((z * 0.0625d0) * t) + (x * y))
else
tmp = ((x * y) - (0.25d0 * (a * b))) + c
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) / 4.0;
double tmp;
if (t_1 <= -5e+276) {
tmp = -(0.25 * a) * b;
} else if (t_1 <= 1e+56) {
tmp = c + (((z * 0.0625) * t) + (x * y));
} else {
tmp = ((x * y) - (0.25 * (a * b))) + c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (a * b) / 4.0 tmp = 0 if t_1 <= -5e+276: tmp = -(0.25 * a) * b elif t_1 <= 1e+56: tmp = c + (((z * 0.0625) * t) + (x * y)) else: tmp = ((x * y) - (0.25 * (a * b))) + c return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) / 4.0) tmp = 0.0 if (t_1 <= -5e+276) tmp = Float64(Float64(-Float64(0.25 * a)) * b); elseif (t_1 <= 1e+56) tmp = Float64(c + Float64(Float64(Float64(z * 0.0625) * t) + Float64(x * y))); else tmp = Float64(Float64(Float64(x * y) - Float64(0.25 * Float64(a * b))) + c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (a * b) / 4.0; tmp = 0.0; if (t_1 <= -5e+276) tmp = -(0.25 * a) * b; elseif (t_1 <= 1e+56) tmp = c + (((z * 0.0625) * t) + (x * y)); else tmp = ((x * y) - (0.25 * (a * b))) + c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] / 4), $MachinePrecision]}, If[LessEqual[t$95$1, -5000000000000000014339392554976861624351030032307491891786714963455192826951136079841645978666612324808479156564299152005093968192740890223899883592402933027172967020052041660293849107704861024718326980908701245637596009600853559934996040535864898581843704726957456644770889728], N[((-N[(1/4 * a), $MachinePrecision]) * b), $MachinePrecision], If[LessEqual[t$95$1, 100000000000000009190283508143378238084034459715684532224], N[(c + N[(N[(N[(z * 1/16), $MachinePrecision] * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(1/4 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{a \cdot b}{4}\\
\mathbf{if}\;t\_1 \leq -5000000000000000014339392554976861624351030032307491891786714963455192826951136079841645978666612324808479156564299152005093968192740890223899883592402933027172967020052041660293849107704861024718326980908701245637596009600853559934996040535864898581843704726957456644770889728:\\
\;\;\;\;\left(-\frac{1}{4} \cdot a\right) \cdot b\\
\mathbf{elif}\;t\_1 \leq 100000000000000009190283508143378238084034459715684532224:\\
\;\;\;\;c + \left(\left(z \cdot \frac{1}{16}\right) \cdot t + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y - \frac{1}{4} \cdot \left(a \cdot b\right)\right) + c\\
\end{array}
if (/.f64 (*.f64 a b) #s(literal 4 binary64)) < -5e276Initial program 97.5%
Taylor expanded in b 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-*.f64N/A
lower-*.f6481.3%
Applied rewrites81.3%
Taylor expanded in a around inf
lower-*.f6428.5%
Applied rewrites28.5%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6428.5%
Applied rewrites28.5%
if -5e276 < (/.f64 (*.f64 a b) #s(literal 4 binary64)) < 1.0000000000000001e56Initial program 97.5%
Taylor expanded in a around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.8%
Applied rewrites73.8%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6473.8%
Applied rewrites73.8%
if 1.0000000000000001e56 < (/.f64 (*.f64 a b) #s(literal 4 binary64)) Initial program 97.5%
Taylor expanded in z around 0
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.6%
Applied rewrites73.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (* a b) 4)))
(if (<=
t_1
-5000000000000000014339392554976861624351030032307491891786714963455192826951136079841645978666612324808479156564299152005093968192740890223899883592402933027172967020052041660293849107704861024718326980908701245637596009600853559934996040535864898581843704726957456644770889728)
(* (- (* 1/4 a)) b)
(if (<=
t_1
100000000000000003889357755108838843130737249295202013334302382007691294289384896763079965607877701387326460311941213291353170611409437561654018367221268940354434586262616943544566455807655946219322240663552)
(+ c (+ (* (* z 1/16) t) (* x y)))
(+ (* -1/4 (* a b)) c)))))double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) / 4.0;
double tmp;
if (t_1 <= -5e+276) {
tmp = -(0.25 * a) * b;
} else if (t_1 <= 1e+206) {
tmp = c + (((z * 0.0625) * t) + (x * y));
} else {
tmp = (-0.25 * (a * b)) + c;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = (a * b) / 4.0d0
if (t_1 <= (-5d+276)) then
tmp = -(0.25d0 * a) * b
else if (t_1 <= 1d+206) then
tmp = c + (((z * 0.0625d0) * t) + (x * y))
else
tmp = ((-0.25d0) * (a * b)) + c
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) / 4.0;
double tmp;
if (t_1 <= -5e+276) {
tmp = -(0.25 * a) * b;
} else if (t_1 <= 1e+206) {
tmp = c + (((z * 0.0625) * t) + (x * y));
} else {
tmp = (-0.25 * (a * b)) + c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (a * b) / 4.0 tmp = 0 if t_1 <= -5e+276: tmp = -(0.25 * a) * b elif t_1 <= 1e+206: tmp = c + (((z * 0.0625) * t) + (x * y)) else: tmp = (-0.25 * (a * b)) + c return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) / 4.0) tmp = 0.0 if (t_1 <= -5e+276) tmp = Float64(Float64(-Float64(0.25 * a)) * b); elseif (t_1 <= 1e+206) tmp = Float64(c + Float64(Float64(Float64(z * 0.0625) * t) + Float64(x * y))); else tmp = Float64(Float64(-0.25 * Float64(a * b)) + c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (a * b) / 4.0; tmp = 0.0; if (t_1 <= -5e+276) tmp = -(0.25 * a) * b; elseif (t_1 <= 1e+206) tmp = c + (((z * 0.0625) * t) + (x * y)); else tmp = (-0.25 * (a * b)) + c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] / 4), $MachinePrecision]}, If[LessEqual[t$95$1, -5000000000000000014339392554976861624351030032307491891786714963455192826951136079841645978666612324808479156564299152005093968192740890223899883592402933027172967020052041660293849107704861024718326980908701245637596009600853559934996040535864898581843704726957456644770889728], N[((-N[(1/4 * a), $MachinePrecision]) * b), $MachinePrecision], If[LessEqual[t$95$1, 100000000000000003889357755108838843130737249295202013334302382007691294289384896763079965607877701387326460311941213291353170611409437561654018367221268940354434586262616943544566455807655946219322240663552], N[(c + N[(N[(N[(z * 1/16), $MachinePrecision] * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1/4 * N[(a * b), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{a \cdot b}{4}\\
\mathbf{if}\;t\_1 \leq -5000000000000000014339392554976861624351030032307491891786714963455192826951136079841645978666612324808479156564299152005093968192740890223899883592402933027172967020052041660293849107704861024718326980908701245637596009600853559934996040535864898581843704726957456644770889728:\\
\;\;\;\;\left(-\frac{1}{4} \cdot a\right) \cdot b\\
\mathbf{elif}\;t\_1 \leq 100000000000000003889357755108838843130737249295202013334302382007691294289384896763079965607877701387326460311941213291353170611409437561654018367221268940354434586262616943544566455807655946219322240663552:\\
\;\;\;\;c + \left(\left(z \cdot \frac{1}{16}\right) \cdot t + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{4} \cdot \left(a \cdot b\right) + c\\
\end{array}
if (/.f64 (*.f64 a b) #s(literal 4 binary64)) < -5e276Initial program 97.5%
Taylor expanded in b 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-*.f64N/A
lower-*.f6481.3%
Applied rewrites81.3%
Taylor expanded in a around inf
lower-*.f6428.5%
Applied rewrites28.5%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6428.5%
Applied rewrites28.5%
if -5e276 < (/.f64 (*.f64 a b) #s(literal 4 binary64)) < 1e206Initial program 97.5%
Taylor expanded in a around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.8%
Applied rewrites73.8%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6473.8%
Applied rewrites73.8%
if 1e206 < (/.f64 (*.f64 a b) #s(literal 4 binary64)) Initial program 97.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6448.3%
Applied rewrites48.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (* a b) 4)))
(if (<=
t_1
-5000000000000000014339392554976861624351030032307491891786714963455192826951136079841645978666612324808479156564299152005093968192740890223899883592402933027172967020052041660293849107704861024718326980908701245637596009600853559934996040535864898581843704726957456644770889728)
(* (- (* 1/4 a)) b)
(if (<=
t_1
100000000000000003889357755108838843130737249295202013334302382007691294289384896763079965607877701387326460311941213291353170611409437561654018367221268940354434586262616943544566455807655946219322240663552)
(+ c (+ (* 1/16 (* t z)) (* x y)))
(+ (* -1/4 (* a b)) c)))))double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) / 4.0;
double tmp;
if (t_1 <= -5e+276) {
tmp = -(0.25 * a) * b;
} else if (t_1 <= 1e+206) {
tmp = c + ((0.0625 * (t * z)) + (x * y));
} else {
tmp = (-0.25 * (a * b)) + c;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = (a * b) / 4.0d0
if (t_1 <= (-5d+276)) then
tmp = -(0.25d0 * a) * b
else if (t_1 <= 1d+206) then
tmp = c + ((0.0625d0 * (t * z)) + (x * y))
else
tmp = ((-0.25d0) * (a * b)) + c
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) / 4.0;
double tmp;
if (t_1 <= -5e+276) {
tmp = -(0.25 * a) * b;
} else if (t_1 <= 1e+206) {
tmp = c + ((0.0625 * (t * z)) + (x * y));
} else {
tmp = (-0.25 * (a * b)) + c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (a * b) / 4.0 tmp = 0 if t_1 <= -5e+276: tmp = -(0.25 * a) * b elif t_1 <= 1e+206: tmp = c + ((0.0625 * (t * z)) + (x * y)) else: tmp = (-0.25 * (a * b)) + c return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) / 4.0) tmp = 0.0 if (t_1 <= -5e+276) tmp = Float64(Float64(-Float64(0.25 * a)) * b); elseif (t_1 <= 1e+206) tmp = Float64(c + Float64(Float64(0.0625 * Float64(t * z)) + Float64(x * y))); else tmp = Float64(Float64(-0.25 * Float64(a * b)) + c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (a * b) / 4.0; tmp = 0.0; if (t_1 <= -5e+276) tmp = -(0.25 * a) * b; elseif (t_1 <= 1e+206) tmp = c + ((0.0625 * (t * z)) + (x * y)); else tmp = (-0.25 * (a * b)) + c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] / 4), $MachinePrecision]}, If[LessEqual[t$95$1, -5000000000000000014339392554976861624351030032307491891786714963455192826951136079841645978666612324808479156564299152005093968192740890223899883592402933027172967020052041660293849107704861024718326980908701245637596009600853559934996040535864898581843704726957456644770889728], N[((-N[(1/4 * a), $MachinePrecision]) * b), $MachinePrecision], If[LessEqual[t$95$1, 100000000000000003889357755108838843130737249295202013334302382007691294289384896763079965607877701387326460311941213291353170611409437561654018367221268940354434586262616943544566455807655946219322240663552], N[(c + N[(N[(1/16 * N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1/4 * N[(a * b), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{a \cdot b}{4}\\
\mathbf{if}\;t\_1 \leq -5000000000000000014339392554976861624351030032307491891786714963455192826951136079841645978666612324808479156564299152005093968192740890223899883592402933027172967020052041660293849107704861024718326980908701245637596009600853559934996040535864898581843704726957456644770889728:\\
\;\;\;\;\left(-\frac{1}{4} \cdot a\right) \cdot b\\
\mathbf{elif}\;t\_1 \leq 100000000000000003889357755108838843130737249295202013334302382007691294289384896763079965607877701387326460311941213291353170611409437561654018367221268940354434586262616943544566455807655946219322240663552:\\
\;\;\;\;c + \left(\frac{1}{16} \cdot \left(t \cdot z\right) + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{4} \cdot \left(a \cdot b\right) + c\\
\end{array}
if (/.f64 (*.f64 a b) #s(literal 4 binary64)) < -5e276Initial program 97.5%
Taylor expanded in b 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-*.f64N/A
lower-*.f6481.3%
Applied rewrites81.3%
Taylor expanded in a around inf
lower-*.f6428.5%
Applied rewrites28.5%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6428.5%
Applied rewrites28.5%
if -5e276 < (/.f64 (*.f64 a b) #s(literal 4 binary64)) < 1e206Initial program 97.5%
Taylor expanded in a around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.8%
Applied rewrites73.8%
if 1e206 < (/.f64 (*.f64 a b) #s(literal 4 binary64)) Initial program 97.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6448.3%
Applied rewrites48.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* x y))))
(if (<= (* x y) -500000000000000022442856339037958392774656)
t_1
(if (<=
(* x y)
50000000000000003758724345825910431373571453217620410674145455117888296262120760233227055054887901771413297751942626316333875200)
(+ c (* 1/16 (* t z)))
t_1))))double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (x * y);
double tmp;
if ((x * y) <= -5e+41) {
tmp = t_1;
} else if ((x * y) <= 5e+127) {
tmp = c + (0.0625 * (t * z));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = c + (x * y)
if ((x * y) <= (-5d+41)) then
tmp = t_1
else if ((x * y) <= 5d+127) then
tmp = c + (0.0625d0 * (t * z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (x * y);
double tmp;
if ((x * y) <= -5e+41) {
tmp = t_1;
} else if ((x * y) <= 5e+127) {
tmp = c + (0.0625 * (t * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = c + (x * y) tmp = 0 if (x * y) <= -5e+41: tmp = t_1 elif (x * y) <= 5e+127: tmp = c + (0.0625 * (t * z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -5e+41) tmp = t_1; elseif (Float64(x * y) <= 5e+127) tmp = Float64(c + Float64(0.0625 * Float64(t * z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = c + (x * y); tmp = 0.0; if ((x * y) <= -5e+41) tmp = t_1; elseif ((x * y) <= 5e+127) tmp = c + (0.0625 * (t * z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -500000000000000022442856339037958392774656], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 50000000000000003758724345825910431373571453217620410674145455117888296262120760233227055054887901771413297751942626316333875200], N[(c + N[(1/16 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := c + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -500000000000000022442856339037958392774656:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 50000000000000003758724345825910431373571453217620410674145455117888296262120760233227055054887901771413297751942626316333875200:\\
\;\;\;\;c + \frac{1}{16} \cdot \left(t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 x y) < -5.0000000000000002e41 or 5.0000000000000004e127 < (*.f64 x y) Initial program 97.5%
Taylor expanded in a around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.8%
Applied rewrites73.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6448.6%
Applied rewrites48.6%
if -5.0000000000000002e41 < (*.f64 x y) < 5.0000000000000004e127Initial program 97.5%
Taylor expanded in a around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.8%
Applied rewrites73.8%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6448.4%
Applied rewrites48.4%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (* z t) 16)) (t_2 (- (* -1/16 (* t z)))))
(if (<=
t_1
-499999999999999976986103364828435105866493856869550354915370776598145356642472906604169238853083206186863000925026831505293584046586944536955141361661791768572429254787072)
t_2
(if (<=
t_1
1000000000000000068957567536844582937679826098352437099093782830596656320642208754566186799616905285426599982929417458880300383900478261195703581718577367397759832385751351296)
(+ c (* x y))
t_2))))double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (z * t) / 16.0;
double t_2 = -(-0.0625 * (t * z));
double tmp;
if (t_1 <= -5e+170) {
tmp = t_2;
} else if (t_1 <= 1e+174) {
tmp = c + (x * y);
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) / 16.0d0
t_2 = -((-0.0625d0) * (t * z))
if (t_1 <= (-5d+170)) then
tmp = t_2
else if (t_1 <= 1d+174) then
tmp = c + (x * y)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (z * t) / 16.0;
double t_2 = -(-0.0625 * (t * z));
double tmp;
if (t_1 <= -5e+170) {
tmp = t_2;
} else if (t_1 <= 1e+174) {
tmp = c + (x * y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (z * t) / 16.0 t_2 = -(-0.0625 * (t * z)) tmp = 0 if t_1 <= -5e+170: tmp = t_2 elif t_1 <= 1e+174: tmp = c + (x * y) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(z * t) / 16.0) t_2 = Float64(-Float64(-0.0625 * Float64(t * z))) tmp = 0.0 if (t_1 <= -5e+170) tmp = t_2; elseif (t_1 <= 1e+174) tmp = Float64(c + Float64(x * y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (z * t) / 16.0; t_2 = -(-0.0625 * (t * z)); tmp = 0.0; if (t_1 <= -5e+170) tmp = t_2; elseif (t_1 <= 1e+174) tmp = c + (x * y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] / 16), $MachinePrecision]}, Block[{t$95$2 = (-N[(-1/16 * N[(t * z), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t$95$1, -499999999999999976986103364828435105866493856869550354915370776598145356642472906604169238853083206186863000925026831505293584046586944536955141361661791768572429254787072], t$95$2, If[LessEqual[t$95$1, 1000000000000000068957567536844582937679826098352437099093782830596656320642208754566186799616905285426599982929417458880300383900478261195703581718577367397759832385751351296], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \frac{z \cdot t}{16}\\
t_2 := -\frac{-1}{16} \cdot \left(t \cdot z\right)\\
\mathbf{if}\;t\_1 \leq -499999999999999976986103364828435105866493856869550354915370776598145356642472906604169238853083206186863000925026831505293584046586944536955141361661791768572429254787072:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 1000000000000000068957567536844582937679826098352437099093782830596656320642208754566186799616905285426599982929417458880300383900478261195703581718577367397759832385751351296:\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (*.f64 z t) #s(literal 16 binary64)) < -4.9999999999999998e170 or 1.0000000000000001e174 < (/.f64 (*.f64 z t) #s(literal 16 binary64)) Initial program 97.5%
Taylor expanded in b 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-*.f64N/A
lower-*.f6481.3%
Applied rewrites81.3%
Taylor expanded in c around inf
lower-*.f6421.8%
Applied rewrites21.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6421.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6421.8%
Applied rewrites21.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6428.7%
Applied rewrites28.7%
if -4.9999999999999998e170 < (/.f64 (*.f64 z t) #s(literal 16 binary64)) < 1.0000000000000001e174Initial program 97.5%
Taylor expanded in a around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.8%
Applied rewrites73.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6448.6%
Applied rewrites48.6%
(FPCore (x y z t a b c) :precision binary64 (+ c (* x y)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (x * y);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c + (x * y)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (x * y);
}
def code(x, y, z, t, a, b, c): return c + (x * y)
function code(x, y, z, t, a, b, c) return Float64(c + Float64(x * y)) end
function tmp = code(x, y, z, t, a, b, c) tmp = c + (x * y); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]
c + x \cdot y
Initial program 97.5%
Taylor expanded in a around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.8%
Applied rewrites73.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6448.6%
Applied rewrites48.6%
(FPCore (x y z t a b c) :precision binary64 (- (- c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return -(-c);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = -(-c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return -(-c);
}
def code(x, y, z, t, a, b, c): return -(-c)
function code(x, y, z, t, a, b, c) return Float64(-Float64(-c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = -(-c); end
code[x_, y_, z_, t_, a_, b_, c_] := (-(-c))
-\left(-c\right)
Initial program 97.5%
Taylor expanded in b 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-*.f64N/A
lower-*.f6481.3%
Applied rewrites81.3%
Taylor expanded in c around inf
lower-*.f6421.8%
Applied rewrites21.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6421.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6421.8%
Applied rewrites21.8%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, C"
:precision binary64
(+ (- (+ (* x y) (/ (* z t) 16)) (/ (* a b) 4)) c))