
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
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, i)
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), intent (in) :: i
code = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
}
def code(x, y, z, t, a, b, c, i): return (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\end{array}
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
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, i)
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), intent (in) :: i
code = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
}
def code(x, y, z, t, a, b, c, i): return (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
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, i)
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), intent (in) :: i
code = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
}
def code(x, y, z, t, a, b, c, i): return (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\end{array}
Initial program 99.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma i y (fma x (log y) (* (log c) (- b 0.5)))))
(t_2 (+ a (+ t t_1))))
(if (<= a -1.9e+148) t_2 (if (<= a 7e+171) (+ t (+ z t_1)) t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(i, y, fma(x, log(y), (log(c) * (b - 0.5))));
double t_2 = a + (t + t_1);
double tmp;
if (a <= -1.9e+148) {
tmp = t_2;
} else if (a <= 7e+171) {
tmp = t + (z + t_1);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(i, y, fma(x, log(y), Float64(log(c) * Float64(b - 0.5)))) t_2 = Float64(a + Float64(t + t_1)) tmp = 0.0 if (a <= -1.9e+148) tmp = t_2; elseif (a <= 7e+171) tmp = Float64(t + Float64(z + t_1)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(i * y + N[(x * N[Log[y], $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a + N[(t + t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.9e+148], t$95$2, If[LessEqual[a, 7e+171], N[(t + N[(z + t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\\
t_2 := a + \left(t + t\_1\right)\\
\mathbf{if}\;a \leq -1.9 \cdot 10^{+148}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq 7 \cdot 10^{+171}:\\
\;\;\;\;t + \left(z + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -1.8999999999999999e148 or 6.9999999999999999e171 < a Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites84.4%
if -1.8999999999999999e148 < a < 6.9999999999999999e171Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (log c) (- b 0.5))))
(if (<= z -4.25e+102)
(+ t (+ z (fma i y (fma x (log y) (* (log c) -0.5)))))
(if (<= z 4.5e+62)
(+ a (+ t (fma i y (fma x (log y) t_1))))
(+ a (+ t (+ z (fma i y t_1))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(c) * (b - 0.5);
double tmp;
if (z <= -4.25e+102) {
tmp = t + (z + fma(i, y, fma(x, log(y), (log(c) * -0.5))));
} else if (z <= 4.5e+62) {
tmp = a + (t + fma(i, y, fma(x, log(y), t_1)));
} else {
tmp = a + (t + (z + fma(i, y, t_1)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(c) * Float64(b - 0.5)) tmp = 0.0 if (z <= -4.25e+102) tmp = Float64(t + Float64(z + fma(i, y, fma(x, log(y), Float64(log(c) * -0.5))))); elseif (z <= 4.5e+62) tmp = Float64(a + Float64(t + fma(i, y, fma(x, log(y), t_1)))); else tmp = Float64(a + Float64(t + Float64(z + fma(i, y, t_1)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.25e+102], N[(t + N[(z + N[(i * y + N[(x * N[Log[y], $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+62], N[(a + N[(t + N[(i * y + N[(x * N[Log[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(t + N[(z + N[(i * y + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log c \cdot \left(b - 0.5\right)\\
\mathbf{if}\;z \leq -4.25 \cdot 10^{+102}:\\
\;\;\;\;t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+62}:\\
\;\;\;\;a + \left(t + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, t\_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a + \left(t + \left(z + \mathsf{fma}\left(i, y, t\_1\right)\right)\right)\\
\end{array}
\end{array}
if z < -4.2499999999999998e102Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Taylor expanded in b around 0
Applied rewrites69.3%
if -4.2499999999999998e102 < z < 4.49999999999999999e62Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites84.4%
if 4.49999999999999999e62 < z Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites84.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ t (+ z (fma i y (fma x (log y) (* (log c) -0.5)))))))
(if (<= x -1.9e+219)
t_1
(if (<= x 1.35e+95)
(+ a (+ t (+ z (fma i y (* (log c) (- b 0.5))))))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = t + (z + fma(i, y, fma(x, log(y), (log(c) * -0.5))));
double tmp;
if (x <= -1.9e+219) {
tmp = t_1;
} else if (x <= 1.35e+95) {
tmp = a + (t + (z + fma(i, y, (log(c) * (b - 0.5)))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(t + Float64(z + fma(i, y, fma(x, log(y), Float64(log(c) * -0.5))))) tmp = 0.0 if (x <= -1.9e+219) tmp = t_1; elseif (x <= 1.35e+95) tmp = Float64(a + Float64(t + Float64(z + fma(i, y, Float64(log(c) * Float64(b - 0.5)))))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(t + N[(z + N[(i * y + N[(x * N[Log[y], $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.9e+219], t$95$1, If[LessEqual[x, 1.35e+95], N[(a + N[(t + N[(z + N[(i * y + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot -0.5\right)\right)\right)\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+219}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+95}:\\
\;\;\;\;a + \left(t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.89999999999999998e219 or 1.35e95 < x Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Taylor expanded in b around 0
Applied rewrites69.3%
if -1.89999999999999998e219 < x < 1.35e95Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites84.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (log c) (- b 0.5))) (t_2 (fma x (log y) t_1)))
(if (<= x -3.7e+124)
(+ a (+ t t_2))
(if (<= x 6e+147) (+ a (+ t (+ z (fma i y t_1)))) (+ t (+ z t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(c) * (b - 0.5);
double t_2 = fma(x, log(y), t_1);
double tmp;
if (x <= -3.7e+124) {
tmp = a + (t + t_2);
} else if (x <= 6e+147) {
tmp = a + (t + (z + fma(i, y, t_1)));
} else {
tmp = t + (z + t_2);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(c) * Float64(b - 0.5)) t_2 = fma(x, log(y), t_1) tmp = 0.0 if (x <= -3.7e+124) tmp = Float64(a + Float64(t + t_2)); elseif (x <= 6e+147) tmp = Float64(a + Float64(t + Float64(z + fma(i, y, t_1)))); else tmp = Float64(t + Float64(z + t_2)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Log[y], $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[x, -3.7e+124], N[(a + N[(t + t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e+147], N[(a + N[(t + N[(z + N[(i * y + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log c \cdot \left(b - 0.5\right)\\
t_2 := \mathsf{fma}\left(x, \log y, t\_1\right)\\
\mathbf{if}\;x \leq -3.7 \cdot 10^{+124}:\\
\;\;\;\;a + \left(t + t\_2\right)\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+147}:\\
\;\;\;\;a + \left(t + \left(z + \mathsf{fma}\left(i, y, t\_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t + \left(z + t\_2\right)\\
\end{array}
\end{array}
if x < -3.70000000000000008e124Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites84.4%
Taylor expanded in y around 0
Applied rewrites61.4%
if -3.70000000000000008e124 < x < 5.99999999999999987e147Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites84.3%
if 5.99999999999999987e147 < x Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Taylor expanded in b around 0
Applied rewrites69.3%
Taylor expanded in y around 0
Applied rewrites61.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (log c) (- b 0.5))) (t_2 (+ a (+ t (fma x (log y) t_1)))))
(if (<= x -3.7e+124)
t_2
(if (<= x 1.15e+140) (+ a (+ t (+ z (fma i y t_1)))) t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(c) * (b - 0.5);
double t_2 = a + (t + fma(x, log(y), t_1));
double tmp;
if (x <= -3.7e+124) {
tmp = t_2;
} else if (x <= 1.15e+140) {
tmp = a + (t + (z + fma(i, y, t_1)));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(c) * Float64(b - 0.5)) t_2 = Float64(a + Float64(t + fma(x, log(y), t_1))) tmp = 0.0 if (x <= -3.7e+124) tmp = t_2; elseif (x <= 1.15e+140) tmp = Float64(a + Float64(t + Float64(z + fma(i, y, t_1)))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a + N[(t + N[(x * N[Log[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.7e+124], t$95$2, If[LessEqual[x, 1.15e+140], N[(a + N[(t + N[(z + N[(i * y + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log c \cdot \left(b - 0.5\right)\\
t_2 := a + \left(t + \mathsf{fma}\left(x, \log y, t\_1\right)\right)\\
\mathbf{if}\;x \leq -3.7 \cdot 10^{+124}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+140}:\\
\;\;\;\;a + \left(t + \left(z + \mathsf{fma}\left(i, y, t\_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -3.70000000000000008e124 or 1.14999999999999995e140 < x Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites84.4%
Taylor expanded in y around 0
Applied rewrites61.4%
if -3.70000000000000008e124 < x < 1.14999999999999995e140Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites84.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -1.25e+225)
t_1
(if (<= x 6.5e+220)
(+ a (+ t (+ z (fma i y (* (log c) (- b 0.5))))))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = x * log(y);
double tmp;
if (x <= -1.25e+225) {
tmp = t_1;
} else if (x <= 6.5e+220) {
tmp = a + (t + (z + fma(i, y, (log(c) * (b - 0.5)))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -1.25e+225) tmp = t_1; elseif (x <= 6.5e+220) tmp = Float64(a + Float64(t + Float64(z + fma(i, y, Float64(log(c) * Float64(b - 0.5)))))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.25e+225], t$95$1, If[LessEqual[x, 6.5e+220], N[(a + N[(t + N[(z + N[(i * y + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{+225}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+220}:\\
\;\;\;\;a + \left(t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.24999999999999995e225 or 6.5000000000000001e220 < x Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Taylor expanded in x around inf
Applied rewrites16.5%
if -1.24999999999999995e225 < x < 6.5000000000000001e220Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites84.3%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma i y (* (log c) (- b 0.5)))) (t_2 (+ a (+ t t_1)))) (if (<= a -1.9e+148) t_2 (if (<= a 7e+171) (+ t (+ z t_1)) t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(i, y, (log(c) * (b - 0.5)));
double t_2 = a + (t + t_1);
double tmp;
if (a <= -1.9e+148) {
tmp = t_2;
} else if (a <= 7e+171) {
tmp = t + (z + t_1);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(i, y, Float64(log(c) * Float64(b - 0.5))) t_2 = Float64(a + Float64(t + t_1)) tmp = 0.0 if (a <= -1.9e+148) tmp = t_2; elseif (a <= 7e+171) tmp = Float64(t + Float64(z + t_1)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(i * y + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a + N[(t + t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.9e+148], t$95$2, If[LessEqual[a, 7e+171], N[(t + N[(z + t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\\
t_2 := a + \left(t + t\_1\right)\\
\mathbf{if}\;a \leq -1.9 \cdot 10^{+148}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq 7 \cdot 10^{+171}:\\
\;\;\;\;t + \left(z + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -1.8999999999999999e148 or 6.9999999999999999e171 < a Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites84.4%
Taylor expanded in x around 0
Applied rewrites69.2%
if -1.8999999999999999e148 < a < 6.9999999999999999e171Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Taylor expanded in x around 0
Applied rewrites69.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ t (+ z (fma i y (* (log c) -0.5))))))
(if (<= z -4.25e+102)
t_1
(if (<= z 8e+137) (+ a (+ t (fma i y (* (log c) (- b 0.5))))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = t + (z + fma(i, y, (log(c) * -0.5)));
double tmp;
if (z <= -4.25e+102) {
tmp = t_1;
} else if (z <= 8e+137) {
tmp = a + (t + fma(i, y, (log(c) * (b - 0.5))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(t + Float64(z + fma(i, y, Float64(log(c) * -0.5)))) tmp = 0.0 if (z <= -4.25e+102) tmp = t_1; elseif (z <= 8e+137) tmp = Float64(a + Float64(t + fma(i, y, Float64(log(c) * Float64(b - 0.5))))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(t + N[(z + N[(i * y + N[(N[Log[c], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.25e+102], t$95$1, If[LessEqual[z, 8e+137], N[(a + N[(t + N[(i * y + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot -0.5\right)\right)\\
\mathbf{if}\;z \leq -4.25 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+137}:\\
\;\;\;\;a + \left(t + \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.2499999999999998e102 or 8.0000000000000003e137 < z Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Taylor expanded in x around 0
Applied rewrites69.4%
Taylor expanded in b around 0
Applied rewrites54.5%
if -4.2499999999999998e102 < z < 8.0000000000000003e137Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites84.4%
Taylor expanded in x around 0
Applied rewrites69.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -1.9e+113)
t_1
(if (<= x 1.15e+219) (+ t (+ z (fma i y (* (log c) -0.5)))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = x * log(y);
double tmp;
if (x <= -1.9e+113) {
tmp = t_1;
} else if (x <= 1.15e+219) {
tmp = t + (z + fma(i, y, (log(c) * -0.5)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -1.9e+113) tmp = t_1; elseif (x <= 1.15e+219) tmp = Float64(t + Float64(z + fma(i, y, Float64(log(c) * -0.5)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.9e+113], t$95$1, If[LessEqual[x, 1.15e+219], N[(t + N[(z + N[(i * y + N[(N[Log[c], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+219}:\\
\;\;\;\;t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.9000000000000002e113 or 1.15e219 < x Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Taylor expanded in x around inf
Applied rewrites16.5%
if -1.9000000000000002e113 < x < 1.15e219Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Taylor expanded in x around 0
Applied rewrites69.4%
Taylor expanded in b around 0
Applied rewrites54.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -1.35e+139)
t_1
(if (<= x 1.2e+216) (fma (log c) 2.0 (fma i y t)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = x * log(y);
double tmp;
if (x <= -1.35e+139) {
tmp = t_1;
} else if (x <= 1.2e+216) {
tmp = fma(log(c), 2.0, fma(i, y, t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -1.35e+139) tmp = t_1; elseif (x <= 1.2e+216) tmp = fma(log(c), 2.0, fma(i, y, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+139], t$95$1, If[LessEqual[x, 1.2e+216], N[(N[Log[c], $MachinePrecision] * 2.0 + N[(i * y + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+139}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+216}:\\
\;\;\;\;\mathsf{fma}\left(\log c, 2, \mathsf{fma}\left(i, y, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.3499999999999999e139 or 1.2e216 < x Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Taylor expanded in x around inf
Applied rewrites16.5%
if -1.3499999999999999e139 < x < 1.2e216Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Applied rewrites65.3%
Applied rewrites38.8%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= y 1.1e-199)
(* x (log y))
(if (<= y 6.6e-98)
(* -1.0 (* -1.0 t))
(if (<= y 2.8e+72) (* -1.0 (* -1.0 z)) (* -1.0 (* i (- y)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= 1.1e-199) {
tmp = x * log(y);
} else if (y <= 6.6e-98) {
tmp = -1.0 * (-1.0 * t);
} else if (y <= 2.8e+72) {
tmp = -1.0 * (-1.0 * z);
} else {
tmp = -1.0 * (i * -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, i)
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), intent (in) :: i
real(8) :: tmp
if (y <= 1.1d-199) then
tmp = x * log(y)
else if (y <= 6.6d-98) then
tmp = (-1.0d0) * ((-1.0d0) * t)
else if (y <= 2.8d+72) then
tmp = (-1.0d0) * ((-1.0d0) * z)
else
tmp = (-1.0d0) * (i * -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 i) {
double tmp;
if (y <= 1.1e-199) {
tmp = x * Math.log(y);
} else if (y <= 6.6e-98) {
tmp = -1.0 * (-1.0 * t);
} else if (y <= 2.8e+72) {
tmp = -1.0 * (-1.0 * z);
} else {
tmp = -1.0 * (i * -y);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if y <= 1.1e-199: tmp = x * math.log(y) elif y <= 6.6e-98: tmp = -1.0 * (-1.0 * t) elif y <= 2.8e+72: tmp = -1.0 * (-1.0 * z) else: tmp = -1.0 * (i * -y) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (y <= 1.1e-199) tmp = Float64(x * log(y)); elseif (y <= 6.6e-98) tmp = Float64(-1.0 * Float64(-1.0 * t)); elseif (y <= 2.8e+72) tmp = Float64(-1.0 * Float64(-1.0 * z)); else tmp = Float64(-1.0 * Float64(i * Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (y <= 1.1e-199) tmp = x * log(y); elseif (y <= 6.6e-98) tmp = -1.0 * (-1.0 * t); elseif (y <= 2.8e+72) tmp = -1.0 * (-1.0 * z); else tmp = -1.0 * (i * -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, 1.1e-199], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e-98], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e+72], N[(-1.0 * N[(-1.0 * z), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(i * (-y)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{-199}:\\
\;\;\;\;x \cdot \log y\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-98}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+72}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(i \cdot \left(-y\right)\right)\\
\end{array}
\end{array}
if y < 1.0999999999999999e-199Initial program 99.8%
Taylor expanded in a around 0
Applied rewrites84.5%
Taylor expanded in x around inf
Applied rewrites16.5%
if 1.0999999999999999e-199 < y < 6.6000000000000002e-98Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in a around inf
Applied rewrites16.4%
Taylor expanded in t around inf
Applied rewrites16.1%
if 6.6000000000000002e-98 < y < 2.7999999999999999e72Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in z around inf
Applied rewrites16.3%
if 2.7999999999999999e72 < y Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in y around inf
Applied rewrites24.7%
Applied rewrites24.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= y 6.6e-98) (* -1.0 (* -1.0 t)) (if (<= y 2.8e+72) (* -1.0 (* -1.0 z)) (* -1.0 (* i (- y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= 6.6e-98) {
tmp = -1.0 * (-1.0 * t);
} else if (y <= 2.8e+72) {
tmp = -1.0 * (-1.0 * z);
} else {
tmp = -1.0 * (i * -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, i)
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), intent (in) :: i
real(8) :: tmp
if (y <= 6.6d-98) then
tmp = (-1.0d0) * ((-1.0d0) * t)
else if (y <= 2.8d+72) then
tmp = (-1.0d0) * ((-1.0d0) * z)
else
tmp = (-1.0d0) * (i * -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 i) {
double tmp;
if (y <= 6.6e-98) {
tmp = -1.0 * (-1.0 * t);
} else if (y <= 2.8e+72) {
tmp = -1.0 * (-1.0 * z);
} else {
tmp = -1.0 * (i * -y);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if y <= 6.6e-98: tmp = -1.0 * (-1.0 * t) elif y <= 2.8e+72: tmp = -1.0 * (-1.0 * z) else: tmp = -1.0 * (i * -y) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (y <= 6.6e-98) tmp = Float64(-1.0 * Float64(-1.0 * t)); elseif (y <= 2.8e+72) tmp = Float64(-1.0 * Float64(-1.0 * z)); else tmp = Float64(-1.0 * Float64(i * Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (y <= 6.6e-98) tmp = -1.0 * (-1.0 * t); elseif (y <= 2.8e+72) tmp = -1.0 * (-1.0 * z); else tmp = -1.0 * (i * -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, 6.6e-98], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e+72], N[(-1.0 * N[(-1.0 * z), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(i * (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.6 \cdot 10^{-98}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+72}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(i \cdot \left(-y\right)\right)\\
\end{array}
\end{array}
if y < 6.6000000000000002e-98Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in a around inf
Applied rewrites16.4%
Taylor expanded in t around inf
Applied rewrites16.1%
if 6.6000000000000002e-98 < y < 2.7999999999999999e72Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in z around inf
Applied rewrites16.3%
if 2.7999999999999999e72 < y Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in y around inf
Applied rewrites24.7%
Applied rewrites24.7%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (* -1.0 (* -1.0 z)))) (if (<= z -5.5e+103) t_1 (if (<= z 2.1e+152) (* -1.0 (* -1.0 t)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -1.0 * (-1.0 * z);
double tmp;
if (z <= -5.5e+103) {
tmp = t_1;
} else if (z <= 2.1e+152) {
tmp = -1.0 * (-1.0 * t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (-1.0d0) * ((-1.0d0) * z)
if (z <= (-5.5d+103)) then
tmp = t_1
else if (z <= 2.1d+152) then
tmp = (-1.0d0) * ((-1.0d0) * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -1.0 * (-1.0 * z);
double tmp;
if (z <= -5.5e+103) {
tmp = t_1;
} else if (z <= 2.1e+152) {
tmp = -1.0 * (-1.0 * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = -1.0 * (-1.0 * z) tmp = 0 if z <= -5.5e+103: tmp = t_1 elif z <= 2.1e+152: tmp = -1.0 * (-1.0 * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(-1.0 * Float64(-1.0 * z)) tmp = 0.0 if (z <= -5.5e+103) tmp = t_1; elseif (z <= 2.1e+152) tmp = Float64(-1.0 * Float64(-1.0 * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = -1.0 * (-1.0 * z); tmp = 0.0; if (z <= -5.5e+103) tmp = t_1; elseif (z <= 2.1e+152) tmp = -1.0 * (-1.0 * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(-1.0 * N[(-1.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e+103], t$95$1, If[LessEqual[z, 2.1e+152], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \left(-1 \cdot z\right)\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+152}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.50000000000000001e103 or 2.1000000000000002e152 < z Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in z around inf
Applied rewrites16.3%
if -5.50000000000000001e103 < z < 2.1000000000000002e152Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in a around inf
Applied rewrites16.4%
Taylor expanded in t around inf
Applied rewrites16.1%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (* -1.0 (- a)))) (if (<= a -2.8e+104) t_1 (if (<= a 3.4e+133) (* -1.0 (* -1.0 t)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -1.0 * -a;
double tmp;
if (a <= -2.8e+104) {
tmp = t_1;
} else if (a <= 3.4e+133) {
tmp = -1.0 * (-1.0 * t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (-1.0d0) * -a
if (a <= (-2.8d+104)) then
tmp = t_1
else if (a <= 3.4d+133) then
tmp = (-1.0d0) * ((-1.0d0) * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -1.0 * -a;
double tmp;
if (a <= -2.8e+104) {
tmp = t_1;
} else if (a <= 3.4e+133) {
tmp = -1.0 * (-1.0 * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = -1.0 * -a tmp = 0 if a <= -2.8e+104: tmp = t_1 elif a <= 3.4e+133: tmp = -1.0 * (-1.0 * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(-1.0 * Float64(-a)) tmp = 0.0 if (a <= -2.8e+104) tmp = t_1; elseif (a <= 3.4e+133) tmp = Float64(-1.0 * Float64(-1.0 * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = -1.0 * -a; tmp = 0.0; if (a <= -2.8e+104) tmp = t_1; elseif (a <= 3.4e+133) tmp = -1.0 * (-1.0 * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(-1.0 * (-a)), $MachinePrecision]}, If[LessEqual[a, -2.8e+104], t$95$1, If[LessEqual[a, 3.4e+133], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \left(-a\right)\\
\mathbf{if}\;a \leq -2.8 \cdot 10^{+104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.4 \cdot 10^{+133}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.8e104 or 3.39999999999999987e133 < a Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in a around inf
Applied rewrites16.4%
Applied rewrites16.4%
if -2.8e104 < a < 3.39999999999999987e133Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in a around inf
Applied rewrites16.4%
Taylor expanded in t around inf
Applied rewrites16.1%
(FPCore (x y z t a b c i) :precision binary64 (* -1.0 (- a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return -1.0 * -a;
}
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, i)
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), intent (in) :: i
code = (-1.0d0) * -a
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return -1.0 * -a;
}
def code(x, y, z, t, a, b, c, i): return -1.0 * -a
function code(x, y, z, t, a, b, c, i) return Float64(-1.0 * Float64(-a)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = -1.0 * -a; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(-1.0 * (-a)), $MachinePrecision]
\begin{array}{l}
\\
-1 \cdot \left(-a\right)
\end{array}
Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in a around inf
Applied rewrites16.4%
Applied rewrites16.4%
(FPCore (x y z t a b c i) :precision binary64 (* -1.0 t))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return -1.0 * t;
}
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, i)
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), intent (in) :: i
code = (-1.0d0) * t
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return -1.0 * t;
}
def code(x, y, z, t, a, b, c, i): return -1.0 * t
function code(x, y, z, t, a, b, c, i) return Float64(-1.0 * t) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = -1.0 * t; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(-1.0 * t), $MachinePrecision]
\begin{array}{l}
\\
-1 \cdot t
\end{array}
Initial program 99.8%
Taylor expanded in i around -inf
Applied rewrites69.0%
Taylor expanded in a around inf
Applied rewrites16.4%
Applied rewrites16.4%
Taylor expanded in t around inf
Applied rewrites2.2%
herbie shell --seed 2025159
(FPCore (x y z t a b c i)
:name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, B"
:precision binary64
(+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))