
(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 (fma y i (fma (log c) (- b 0.5) (+ (+ a t) (fma (log y) x z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, fma(log(c), (b - 0.5), ((a + t) + fma(log(y), x, z))));
}
function code(x, y, z, t, a, b, c, i) return fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(a + t) + fma(log(y), x, z)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(a + t), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(a + t\right) + \mathsf{fma}\left(\log y, x, z\right)\right)\right)
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(+
(+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c)))
(* y i))))
(if (<= t_1 -2e+304)
(* i y)
(if (<= t_1 -10000000.0) z (if (<= t_1 INFINITY) a (* i y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
double tmp;
if (t_1 <= -2e+304) {
tmp = i * y;
} else if (t_1 <= -10000000.0) {
tmp = z;
} else if (t_1 <= ((double) INFINITY)) {
tmp = a;
} else {
tmp = i * y;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
double tmp;
if (t_1 <= -2e+304) {
tmp = i * y;
} else if (t_1 <= -10000000.0) {
tmp = z;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = a;
} else {
tmp = i * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i) tmp = 0 if t_1 <= -2e+304: tmp = i * y elif t_1 <= -10000000.0: tmp = z elif t_1 <= math.inf: tmp = a else: tmp = i * y return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) tmp = 0.0 if (t_1 <= -2e+304) tmp = Float64(i * y); elseif (t_1 <= -10000000.0) tmp = z; elseif (t_1 <= Inf) tmp = a; else tmp = Float64(i * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i); tmp = 0.0; if (t_1 <= -2e+304) tmp = i * y; elseif (t_1 <= -10000000.0) tmp = z; elseif (t_1 <= Inf) tmp = a; else tmp = i * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -2e+304], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -10000000.0], z, If[LessEqual[t$95$1, Infinity], a, N[(i * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \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\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+304}:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq -10000000:\\
\;\;\;\;z\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;i \cdot y\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -1.9999999999999999e304 or +inf.0 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) Initial program 99.0%
Taylor expanded in y around inf
lower-*.f6474.0
Applied rewrites74.0%
if -1.9999999999999999e304 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -1e7Initial program 99.8%
Taylor expanded in z around inf
Applied rewrites18.2%
if -1e7 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < +inf.0Initial program 99.9%
Taylor expanded in a around inf
Applied rewrites16.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(+
(+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c)))
(* y i))))
(if (<= t_1 -2e+304) (* i y) (if (<= t_1 -10000000.0) z (fma y i a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
double tmp;
if (t_1 <= -2e+304) {
tmp = i * y;
} else if (t_1 <= -10000000.0) {
tmp = z;
} else {
tmp = fma(y, i, a);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) tmp = 0.0 if (t_1 <= -2e+304) tmp = Float64(i * y); elseif (t_1 <= -10000000.0) tmp = z; else tmp = fma(y, i, a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -2e+304], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -10000000.0], z, N[(y * i + a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \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\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+304}:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq -10000000:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, a\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -1.9999999999999999e304Initial program 100.0%
Taylor expanded in y around inf
lower-*.f6473.7
Applied rewrites73.7%
if -1.9999999999999999e304 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -1e7Initial program 99.8%
Taylor expanded in z around inf
Applied rewrites18.2%
if -1e7 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) Initial program 99.7%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.7%
Taylor expanded in a around inf
+-commutative39.1
+-commutative39.1
*-commutative39.1
+-commutative39.1
associate-+l+39.1
*-commutative39.1
Applied rewrites39.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i))
-5e+25)
(fma y i (fma (log c) (- b 0.5) z))
(fma y i (fma (log c) (- b 0.5) (+ t a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i)) <= -5e+25) {
tmp = fma(y, i, fma(log(c), (b - 0.5), z));
} else {
tmp = fma(y, i, fma(log(c), (b - 0.5), (t + a)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) <= -5e+25) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), z)); else tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(t + a))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[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], -5e+25], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(t + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, t + a\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -5.00000000000000024e25Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around inf
+-commutative53.5
*-commutative53.5
+-commutative53.5
associate-+l+53.5
Applied rewrites53.5%
if -5.00000000000000024e25 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) Initial program 99.7%
Taylor expanded in t around inf
Applied rewrites68.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.9
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6468.9
Applied rewrites68.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i))
-5e+25)
(fma y i (fma (log c) (- b 0.5) z))
(fma y i (fma (log c) (- b 0.5) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i)) <= -5e+25) {
tmp = fma(y, i, fma(log(c), (b - 0.5), z));
} else {
tmp = fma(y, i, fma(log(c), (b - 0.5), a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) <= -5e+25) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), z)); else tmp = fma(y, i, fma(log(c), Float64(b - 0.5), a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[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], -5e+25], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, a\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -5.00000000000000024e25Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around inf
+-commutative53.5
*-commutative53.5
+-commutative53.5
associate-+l+53.5
Applied rewrites53.5%
if -5.00000000000000024e25 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) Initial program 99.7%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.7%
Taylor expanded in a around inf
+-commutative56.1
*-commutative56.1
+-commutative56.1
associate-+l+56.1
Applied rewrites56.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i))
-5e+25)
(fma y i z)
(fma y i (fma (log c) (- b 0.5) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i)) <= -5e+25) {
tmp = fma(y, i, z);
} else {
tmp = fma(y, i, fma(log(c), (b - 0.5), a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) <= -5e+25) tmp = fma(y, i, z); else tmp = fma(y, i, fma(log(c), Float64(b - 0.5), a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[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], -5e+25], N[(y * i + z), $MachinePrecision], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(y, i, z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, a\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -5.00000000000000024e25Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around inf
+-commutative38.1
+-commutative38.1
*-commutative38.1
+-commutative38.1
associate-+l+38.1
*-commutative38.1
Applied rewrites38.1%
if -5.00000000000000024e25 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) Initial program 99.7%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.7%
Taylor expanded in a around inf
+-commutative56.1
*-commutative56.1
+-commutative56.1
associate-+l+56.1
Applied rewrites56.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i))
200.0)
(fma y i (fma (log c) -0.5 z))
(+ a (* y i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i)) <= 200.0) {
tmp = fma(y, i, fma(log(c), -0.5, z));
} else {
tmp = a + (y * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) <= 200.0) tmp = fma(y, i, fma(log(c), -0.5, z)); else tmp = Float64(a + Float64(y * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[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], 200.0], N[(y * i + N[(N[Log[c], $MachinePrecision] * -0.5 + z), $MachinePrecision]), $MachinePrecision], N[(a + N[(y * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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 \leq 200:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, -0.5, z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a + y \cdot i\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < 200Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around inf
+-commutative54.5
*-commutative54.5
+-commutative54.5
associate-+l+54.5
Applied rewrites54.5%
Taylor expanded in b around 0
Applied rewrites39.5%
if 200 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) Initial program 99.7%
Taylor expanded in a around inf
Applied rewrites40.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i))
-10000000.0)
(fma y i z)
(+ a (* y i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i)) <= -10000000.0) {
tmp = fma(y, i, z);
} else {
tmp = a + (y * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) <= -10000000.0) tmp = fma(y, i, z); else tmp = Float64(a + Float64(y * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[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], -10000000.0], N[(y * i + z), $MachinePrecision], N[(a + N[(y * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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 \leq -10000000:\\
\;\;\;\;\mathsf{fma}\left(y, i, z\right)\\
\mathbf{else}:\\
\;\;\;\;a + y \cdot i\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -1e7Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around inf
+-commutative38.0
+-commutative38.0
*-commutative38.0
+-commutative38.0
associate-+l+38.0
*-commutative38.0
Applied rewrites38.0%
if -1e7 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) Initial program 99.7%
Taylor expanded in a around inf
Applied rewrites39.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i))
-10000000.0)
(fma y i z)
(fma y i a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i)) <= -10000000.0) {
tmp = fma(y, i, z);
} else {
tmp = fma(y, i, a);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) <= -10000000.0) tmp = fma(y, i, z); else tmp = fma(y, i, a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[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], -10000000.0], N[(y * i + z), $MachinePrecision], N[(y * i + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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 \leq -10000000:\\
\;\;\;\;\mathsf{fma}\left(y, i, z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, a\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -1e7Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around inf
+-commutative38.0
+-commutative38.0
*-commutative38.0
+-commutative38.0
associate-+l+38.0
*-commutative38.0
Applied rewrites38.0%
if -1e7 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) Initial program 99.7%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.7%
Taylor expanded in a around inf
+-commutative39.1
+-commutative39.1
*-commutative39.1
+-commutative39.1
associate-+l+39.1
*-commutative39.1
Applied rewrites39.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i))
-10000000.0)
z
a))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i)) <= -10000000.0) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, 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 (((((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)) <= (-10000000.0d0)) then
tmp = z
else
tmp = a
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 (((((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i)) <= -10000000.0) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i)) <= -10000000.0: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) <= -10000000.0) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i)) <= -10000000.0) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[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], -10000000.0], z, a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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 \leq -10000000:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -1e7Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites16.3%
if -1e7 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) Initial program 99.7%
Taylor expanded in a around inf
Applied rewrites16.5%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= x -1.85e+118)
(+ (+ a t) (+ (fma (log y) x z) (* (log c) (- b 0.5))))
(if (<= x 7.2e+128)
(fma y i (fma (log c) (- b 0.5) (+ (+ z t) a)))
(+ (+ t z) (fma i y (fma (log c) (- b 0.5) (* (log y) x)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (x <= -1.85e+118) {
tmp = (a + t) + (fma(log(y), x, z) + (log(c) * (b - 0.5)));
} else if (x <= 7.2e+128) {
tmp = fma(y, i, fma(log(c), (b - 0.5), ((z + t) + a)));
} else {
tmp = (t + z) + fma(i, y, fma(log(c), (b - 0.5), (log(y) * x)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -1.85e+118) tmp = Float64(Float64(a + t) + Float64(fma(log(y), x, z) + Float64(log(c) * Float64(b - 0.5)))); elseif (x <= 7.2e+128) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(z + t) + a))); else tmp = Float64(Float64(t + z) + fma(i, y, fma(log(c), Float64(b - 0.5), Float64(log(y) * x)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -1.85e+118], N[(N[(a + t), $MachinePrecision] + N[(N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e+128], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(z + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t + z), $MachinePrecision] + N[(i * y + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+118}:\\
\;\;\;\;\left(a + t\right) + \left(\mathsf{fma}\left(\log y, x, z\right) + \log c \cdot \left(b - 0.5\right)\right)\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(z + t\right) + a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t + z\right) + \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log c, b - 0.5, \log y \cdot x\right)\right)\\
\end{array}
\end{array}
if x < -1.84999999999999993e118Initial program 99.6%
Taylor expanded in y around 0
associate-+r+N/A
lower-+.f64N/A
lower-+.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6482.3
Applied rewrites82.3%
if -1.84999999999999993e118 < x < 7.20000000000000054e128Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6497.2
Applied rewrites97.2%
if 7.20000000000000054e128 < x Initial program 99.8%
Taylor expanded in a around 0
associate-+r+N/A
lower-+.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f6490.5
Applied rewrites90.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (+ z t) a)))
(if (<= x -1.85e+118)
(+ (+ a t) (+ (fma (log y) x z) (* (log c) (- b 0.5))))
(if (<= x 3.9e+179)
(fma y i (fma (log c) (- b 0.5) t_1))
(fma y i (- (* (fma (/ t_1 x) -1.0 (- (log y))) x)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (z + t) + a;
double tmp;
if (x <= -1.85e+118) {
tmp = (a + t) + (fma(log(y), x, z) + (log(c) * (b - 0.5)));
} else if (x <= 3.9e+179) {
tmp = fma(y, i, fma(log(c), (b - 0.5), t_1));
} else {
tmp = fma(y, i, -(fma((t_1 / x), -1.0, -log(y)) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(z + t) + a) tmp = 0.0 if (x <= -1.85e+118) tmp = Float64(Float64(a + t) + Float64(fma(log(y), x, z) + Float64(log(c) * Float64(b - 0.5)))); elseif (x <= 3.9e+179) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), t_1)); else tmp = fma(y, i, Float64(-Float64(fma(Float64(t_1 / x), -1.0, Float64(-log(y))) * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(z + t), $MachinePrecision] + a), $MachinePrecision]}, If[LessEqual[x, -1.85e+118], N[(N[(a + t), $MachinePrecision] + N[(N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.9e+179], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(y * i + (-N[(N[(N[(t$95$1 / x), $MachinePrecision] * -1.0 + (-N[Log[y], $MachinePrecision])), $MachinePrecision] * x), $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z + t\right) + a\\
\mathbf{if}\;x \leq -1.85 \cdot 10^{+118}:\\
\;\;\;\;\left(a + t\right) + \left(\mathsf{fma}\left(\log y, x, z\right) + \log c \cdot \left(b - 0.5\right)\right)\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+179}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, -\mathsf{fma}\left(\frac{t\_1}{x}, -1, -\log y\right) \cdot x\right)\\
\end{array}
\end{array}
if x < -1.84999999999999993e118Initial program 99.6%
Taylor expanded in y around 0
associate-+r+N/A
lower-+.f64N/A
lower-+.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6482.3
Applied rewrites82.3%
if -1.84999999999999993e118 < x < 3.89999999999999974e179Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6496.0
Applied rewrites96.0%
if 3.89999999999999974e179 < x Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in x around -inf
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
Applied rewrites99.7%
Taylor expanded in z around inf
Applied rewrites92.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (+ z t) a))
(t_2 (fma y i (- (* (fma (/ t_1 x) -1.0 (- (log y))) x)))))
(if (<= x -4.2e+118)
t_2
(if (<= x 3.9e+179) (fma y i (fma (log c) (- b 0.5) 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 = (z + t) + a;
double t_2 = fma(y, i, -(fma((t_1 / x), -1.0, -log(y)) * x));
double tmp;
if (x <= -4.2e+118) {
tmp = t_2;
} else if (x <= 3.9e+179) {
tmp = fma(y, i, fma(log(c), (b - 0.5), t_1));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(z + t) + a) t_2 = fma(y, i, Float64(-Float64(fma(Float64(t_1 / x), -1.0, Float64(-log(y))) * x))) tmp = 0.0 if (x <= -4.2e+118) tmp = t_2; elseif (x <= 3.9e+179) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), 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[(z + t), $MachinePrecision] + a), $MachinePrecision]}, Block[{t$95$2 = N[(y * i + (-N[(N[(N[(t$95$1 / x), $MachinePrecision] * -1.0 + (-N[Log[y], $MachinePrecision])), $MachinePrecision] * x), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[x, -4.2e+118], t$95$2, If[LessEqual[x, 3.9e+179], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z + t\right) + a\\
t_2 := \mathsf{fma}\left(y, i, -\mathsf{fma}\left(\frac{t\_1}{x}, -1, -\log y\right) \cdot x\right)\\
\mathbf{if}\;x \leq -4.2 \cdot 10^{+118}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+179}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -4.2e118 or 3.89999999999999974e179 < x Initial program 99.7%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.7%
Taylor expanded in x around -inf
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in z around inf
Applied rewrites90.9%
if -4.2e118 < x < 3.89999999999999974e179Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6496.0
Applied rewrites96.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (- (log y))))
(if (<= x -1.7e+196)
(fma y i (- (* (fma (/ a x) -1.0 t_1) x)))
(if (<= x 3.2e+180)
(fma y i (fma (log c) (- b 0.5) (+ (+ z t) a)))
(fma y i (- (* (fma (/ z x) -1.0 t_1) x)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -log(y);
double tmp;
if (x <= -1.7e+196) {
tmp = fma(y, i, -(fma((a / x), -1.0, t_1) * x));
} else if (x <= 3.2e+180) {
tmp = fma(y, i, fma(log(c), (b - 0.5), ((z + t) + a)));
} else {
tmp = fma(y, i, -(fma((z / x), -1.0, t_1) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(-log(y)) tmp = 0.0 if (x <= -1.7e+196) tmp = fma(y, i, Float64(-Float64(fma(Float64(a / x), -1.0, t_1) * x))); elseif (x <= 3.2e+180) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(z + t) + a))); else tmp = fma(y, i, Float64(-Float64(fma(Float64(z / x), -1.0, t_1) * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = (-N[Log[y], $MachinePrecision])}, If[LessEqual[x, -1.7e+196], N[(y * i + (-N[(N[(N[(a / x), $MachinePrecision] * -1.0 + t$95$1), $MachinePrecision] * x), $MachinePrecision])), $MachinePrecision], If[LessEqual[x, 3.2e+180], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(z + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * i + (-N[(N[(N[(z / x), $MachinePrecision] * -1.0 + t$95$1), $MachinePrecision] * x), $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\log y\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+196}:\\
\;\;\;\;\mathsf{fma}\left(y, i, -\mathsf{fma}\left(\frac{a}{x}, -1, t\_1\right) \cdot x\right)\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+180}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(z + t\right) + a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, -\mathsf{fma}\left(\frac{z}{x}, -1, t\_1\right) \cdot x\right)\\
\end{array}
\end{array}
if x < -1.7e196Initial program 99.5%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.5%
Taylor expanded in x around -inf
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
Applied rewrites99.4%
Taylor expanded in a around inf
Applied rewrites79.2%
if -1.7e196 < x < 3.19999999999999994e180Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6493.9
Applied rewrites93.9%
if 3.19999999999999994e180 < x Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in x around -inf
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
Applied rewrites99.7%
Taylor expanded in z around inf
Applied rewrites77.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y i (- (* (fma (/ a x) -1.0 (- (log y))) x)))))
(if (<= x -1.7e+196)
t_1
(if (<= x 2.05e+180)
(fma y i (fma (log c) (- b 0.5) (+ (+ z t) a)))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, i, -(fma((a / x), -1.0, -log(y)) * x));
double tmp;
if (x <= -1.7e+196) {
tmp = t_1;
} else if (x <= 2.05e+180) {
tmp = fma(y, i, fma(log(c), (b - 0.5), ((z + t) + a)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, i, Float64(-Float64(fma(Float64(a / x), -1.0, Float64(-log(y))) * x))) tmp = 0.0 if (x <= -1.7e+196) tmp = t_1; elseif (x <= 2.05e+180) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(z + t) + a))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * i + (-N[(N[(N[(a / x), $MachinePrecision] * -1.0 + (-N[Log[y], $MachinePrecision])), $MachinePrecision] * x), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[x, -1.7e+196], t$95$1, If[LessEqual[x, 2.05e+180], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(z + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, i, -\mathsf{fma}\left(\frac{a}{x}, -1, -\log y\right) \cdot x\right)\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+180}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(z + t\right) + a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.7e196 or 2.05e180 < x Initial program 99.6%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in x around -inf
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in a around inf
Applied rewrites78.8%
if -1.7e196 < x < 2.05e180Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6493.9
Applied rewrites93.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -1.9e+223)
t_1
(if (<= x 3.1e+203)
(fma y i (fma (log c) (- b 0.5) (+ (+ z t) a)))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(y) * x;
double tmp;
if (x <= -1.9e+223) {
tmp = t_1;
} else if (x <= 3.1e+203) {
tmp = fma(y, i, fma(log(c), (b - 0.5), ((z + t) + a)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -1.9e+223) tmp = t_1; elseif (x <= 3.1e+203) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(z + t) + a))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.9e+223], t$95$1, If[LessEqual[x, 3.1e+203], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(z + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+223}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+203}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(z + t\right) + a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.9e223 or 3.1e203 < x Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6462.8
Applied rewrites62.8%
if -1.9e223 < x < 3.1e203Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6492.2
Applied rewrites92.2%
(FPCore (x y z t a b c i) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 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 = a
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a;
}
def code(x, y, z, t, a, b, c, i): return a
function code(x, y, z, t, a, b, c, i) return a end
function tmp = code(x, y, z, t, a, b, c, i) tmp = a; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 99.8%
Taylor expanded in a around inf
Applied rewrites16.8%
herbie shell --seed 2025091
(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)))