
(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}
Sampling outcomes in binary64 precision:
Herbie found 23 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.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%
(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 (- INFINITY))
(* i y)
(if (<= t_1 -50.0) z (if (<= t_1 5e+307) 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 <= -((double) INFINITY)) {
tmp = i * y;
} else if (t_1 <= -50.0) {
tmp = z;
} else if (t_1 <= 5e+307) {
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 <= -Double.POSITIVE_INFINITY) {
tmp = i * y;
} else if (t_1 <= -50.0) {
tmp = z;
} else if (t_1 <= 5e+307) {
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 <= -math.inf: tmp = i * y elif t_1 <= -50.0: tmp = z elif t_1 <= 5e+307: 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 <= Float64(-Inf)) tmp = Float64(i * y); elseif (t_1 <= -50.0) tmp = z; elseif (t_1 <= 5e+307) 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 <= -Inf) tmp = i * y; elseif (t_1 <= -50.0) tmp = z; elseif (t_1 <= 5e+307) 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, (-Infinity)], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -50.0], z, If[LessEqual[t$95$1, 5e+307], 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 -\infty:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq -50:\\
\;\;\;\;z\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;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)) < -inf.0 or 5e307 < (+.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 100.0%
Taylor expanded in y around inf
lower-*.f64100.0
Applied rewrites100.0%
if -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)) < -50Initial program 99.8%
Taylor expanded in z around inf
Applied rewrites18.6%
if -50 < (+.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)) < 5e307Initial program 99.9%
Taylor expanded in a around inf
Applied rewrites19.0%
(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 -1e+32)
(fma y i (fma (log c) b z))
(if (<= t_1 100.0)
(fma y i (fma (log c) -0.5 z))
(fma y i (fma (log c) b 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 <= -1e+32) {
tmp = fma(y, i, fma(log(c), b, z));
} else if (t_1 <= 100.0) {
tmp = fma(y, i, fma(log(c), -0.5, z));
} else {
tmp = fma(y, i, fma(log(c), b, 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 <= -1e+32) tmp = fma(y, i, fma(log(c), b, z)); elseif (t_1 <= 100.0) tmp = fma(y, i, fma(log(c), -0.5, z)); else tmp = fma(y, i, fma(log(c), b, 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, -1e+32], N[(y * i + N[(N[Log[c], $MachinePrecision] * b + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 100.0], N[(y * i + N[(N[Log[c], $MachinePrecision] * -0.5 + z), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[Log[c], $MachinePrecision] * b + a), $MachinePrecision]), $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 -1 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b, z\right)\right)\\
\mathbf{elif}\;t\_1 \leq 100:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, -0.5, z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b, 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)) < -1.00000000000000005e32Initial 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
Applied rewrites51.5%
Taylor expanded in b around inf
Applied rewrites51.5%
if -1.00000000000000005e32 < (+.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)) < 100Initial program 100.0%
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 rewrites100.0%
Taylor expanded in z around inf
Applied rewrites100.0%
Taylor expanded in b around 0
Applied rewrites100.0%
if 100 < (+.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.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 rewrites100.0%
Taylor expanded in a around inf
Applied rewrites55.6%
Taylor expanded in b around inf
Applied rewrites55.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 (- INFINITY)) (* i y) (if (<= t_1 -50.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 <= -((double) INFINITY)) {
tmp = i * y;
} else if (t_1 <= -50.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 <= Float64(-Inf)) tmp = Float64(i * y); elseif (t_1 <= -50.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, (-Infinity)], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -50.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 -\infty:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq -50:\\
\;\;\;\;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)) < -inf.0Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64100.0
Applied rewrites100.0%
if -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)) < -50Initial program 99.8%
Taylor expanded in z around inf
Applied rewrites18.6%
if -50 < (+.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.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 rewrites100.0%
Taylor expanded in a around inf
*-commutative44.1
+-commutative44.1
*-commutative44.1
+-commutative44.1
associate-+l+44.1
+-commutative44.1
Applied rewrites44.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (- b 0.5) (log c))))
(if (<= (+ (+ (+ (+ (+ (* x (log y)) z) t) a) t_1) (* y i)) -1e+32)
(fma y i (fma (log c) b z))
(+ (+ (+ t a) t_1) (* y i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (b - 0.5) * log(c);
double tmp;
if (((((((x * log(y)) + z) + t) + a) + t_1) + (y * i)) <= -1e+32) {
tmp = fma(y, i, fma(log(c), b, z));
} else {
tmp = ((t + a) + t_1) + (y * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(b - 0.5) * log(c)) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + t_1) + Float64(y * i)) <= -1e+32) tmp = fma(y, i, fma(log(c), b, z)); else tmp = Float64(Float64(Float64(t + a) + t_1) + Float64(y * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision], -1e+32], N[(y * i + N[(N[Log[c], $MachinePrecision] * b + z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + a), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - 0.5\right) \cdot \log c\\
\mathbf{if}\;\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + t\_1\right) + y \cdot i \leq -1 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b, z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t + a\right) + t\_1\right) + 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)) < -1.00000000000000005e32Initial 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
Applied rewrites51.5%
Taylor expanded in b around inf
Applied rewrites51.5%
if -1.00000000000000005e32 < (+.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.9%
Taylor expanded in t around inf
Applied rewrites74.0%
(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))
100.0)
(fma y i (fma (log c) (- b 0.5) z))
(fma y i (fma (log c) b 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)) <= 100.0) {
tmp = fma(y, i, fma(log(c), (b - 0.5), z));
} else {
tmp = fma(y, i, fma(log(c), b, 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)) <= 100.0) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), z)); else tmp = fma(y, i, fma(log(c), b, 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], 100.0], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[Log[c], $MachinePrecision] * b + 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 100:\\
\;\;\;\;\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, 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)) < 100Initial 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
Applied rewrites53.5%
if 100 < (+.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.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 rewrites100.0%
Taylor expanded in a around inf
Applied rewrites55.6%
Taylor expanded in b around inf
Applied rewrites55.5%
(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))
-1e+32)
(fma y i (fma (log c) b 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)) <= -1e+32) {
tmp = fma(y, i, fma(log(c), b, 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)) <= -1e+32) tmp = fma(y, i, fma(log(c), b, 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], -1e+32], N[(y * i + N[(N[Log[c], $MachinePrecision] * b + 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 -1 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b, 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)) < -1.00000000000000005e32Initial 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
Applied rewrites51.5%
Taylor expanded in b around inf
Applied rewrites51.5%
if -1.00000000000000005e32 < (+.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.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 rewrites100.0%
Taylor expanded in a around inf
Applied rewrites57.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (- b 0.5) (log c))))
(if (or (<= t_1 -1e+272) (not (<= t_1 2e+223)))
(* (log c) b)
(fma y i (+ (+ z t) a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (b - 0.5) * log(c);
double tmp;
if ((t_1 <= -1e+272) || !(t_1 <= 2e+223)) {
tmp = log(c) * b;
} else {
tmp = fma(y, i, ((z + t) + a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(b - 0.5) * log(c)) tmp = 0.0 if ((t_1 <= -1e+272) || !(t_1 <= 2e+223)) tmp = Float64(log(c) * b); else tmp = fma(y, i, Float64(Float64(z + t) + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+272], N[Not[LessEqual[t$95$1, 2e+223]], $MachinePrecision]], N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision], N[(y * i + N[(N[(z + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - 0.5\right) \cdot \log c\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+272} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+223}\right):\\
\;\;\;\;\log c \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \left(z + t\right) + a\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c)) < -1.0000000000000001e272 or 2.00000000000000009e223 < (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c)) Initial program 99.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6473.3
Applied rewrites73.3%
if -1.0000000000000001e272 < (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c)) < 2.00000000000000009e223Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6481.9
Applied rewrites81.9%
Taylor expanded in z around inf
Applied rewrites74.9%
lift-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f6474.9
Applied rewrites74.9%
Final simplification74.7%
(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))
-50.0)
(fma y i z)
(+ (+ t 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)) <= -50.0) {
tmp = fma(y, i, z);
} else {
tmp = (t + 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)) <= -50.0) tmp = fma(y, i, z); else tmp = Float64(Float64(t + 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], -50.0], N[(y * i + z), $MachinePrecision], N[(N[(t + a), $MachinePrecision] + 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 -50:\\
\;\;\;\;\mathsf{fma}\left(y, i, z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t + a\right) + 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)) < -50Initial 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
*-commutative34.7
+-commutative34.7
*-commutative34.7
+-commutative34.7
associate-+l+34.7
+-commutative34.7
Applied rewrites34.7%
if -50 < (+.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.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6483.7
Applied rewrites83.7%
Taylor expanded in t around inf
Applied rewrites60.7%
(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))
-50.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)) <= -50.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)) <= -50.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], -50.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 -50:\\
\;\;\;\;\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)) < -50Initial 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
*-commutative34.7
+-commutative34.7
*-commutative34.7
+-commutative34.7
associate-+l+34.7
+-commutative34.7
Applied rewrites34.7%
if -50 < (+.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.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 rewrites100.0%
Taylor expanded in a around inf
*-commutative44.1
+-commutative44.1
*-commutative44.1
+-commutative44.1
associate-+l+44.1
+-commutative44.1
Applied rewrites44.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))
-50.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)) <= -50.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)) <= (-50.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)) <= -50.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)) <= -50.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)) <= -50.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)) <= -50.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], -50.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 -50:\\
\;\;\;\;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)) < -50Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites16.9%
if -50 < (+.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.9%
Taylor expanded in a around inf
Applied rewrites16.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= a 3.3e+93) (+ (+ t z) (fma i y (fma (log c) (- b 0.5) (* (log y) x)))) (+ (+ (+ (fma (log c) (- b 0.5) z) t) a) (* y i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (a <= 3.3e+93) {
tmp = (t + z) + fma(i, y, fma(log(c), (b - 0.5), (log(y) * x)));
} else {
tmp = ((fma(log(c), (b - 0.5), z) + t) + a) + (y * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (a <= 3.3e+93) tmp = Float64(Float64(t + z) + fma(i, y, fma(log(c), Float64(b - 0.5), Float64(log(y) * x)))); else tmp = Float64(Float64(Float64(fma(log(c), Float64(b - 0.5), z) + t) + a) + Float64(y * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[a, 3.3e+93], 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], N[(N[(N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.3 \cdot 10^{+93}:\\
\;\;\;\;\left(t + z\right) + \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log c, b - 0.5, \log y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + a\right) + y \cdot i\\
\end{array}
\end{array}
if a < 3.30000000000000009e93Initial program 99.9%
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.3
Applied rewrites90.3%
if 3.30000000000000009e93 < a Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6490.6
Applied rewrites90.6%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= x -5.7e+128)
(+ (+ a t) (+ (fma (log y) x z) (* (log c) (- b 0.5))))
(if (<= x 3.4e+202)
(+ (+ (+ (fma (log c) (- b 0.5) z) t) a) (* y i))
(fma y i (fma (log c) b (* (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 <= -5.7e+128) {
tmp = (a + t) + (fma(log(y), x, z) + (log(c) * (b - 0.5)));
} else if (x <= 3.4e+202) {
tmp = ((fma(log(c), (b - 0.5), z) + t) + a) + (y * i);
} else {
tmp = fma(y, i, fma(log(c), b, (log(y) * x)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -5.7e+128) tmp = Float64(Float64(a + t) + Float64(fma(log(y), x, z) + Float64(log(c) * Float64(b - 0.5)))); elseif (x <= 3.4e+202) tmp = Float64(Float64(Float64(fma(log(c), Float64(b - 0.5), z) + t) + a) + Float64(y * i)); else tmp = fma(y, i, fma(log(c), b, Float64(log(y) * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -5.7e+128], 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.4e+202], N[(N[(N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[Log[c], $MachinePrecision] * b + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.7 \cdot 10^{+128}:\\
\;\;\;\;\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.4 \cdot 10^{+202}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + a\right) + y \cdot i\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b, \log y \cdot x\right)\right)\\
\end{array}
\end{array}
if x < -5.70000000000000024e128Initial program 99.8%
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--.f6485.1
Applied rewrites85.1%
if -5.70000000000000024e128 < x < 3.4e202Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6498.1
Applied rewrites98.1%
if 3.4e202 < 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
lift-log.f64N/A
lift-*.f6494.1
Applied rewrites94.1%
Taylor expanded in b around inf
Applied rewrites94.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= x -4.4e+137)
(+ (* (fma (/ a x) -1.0 (- (log y))) (- x)) (* y i))
(if (<= x 3.4e+202)
(+ (+ (+ (fma (log c) (- b 0.5) z) t) a) (* y i))
(fma y i (fma (log c) b (* (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 <= -4.4e+137) {
tmp = (fma((a / x), -1.0, -log(y)) * -x) + (y * i);
} else if (x <= 3.4e+202) {
tmp = ((fma(log(c), (b - 0.5), z) + t) + a) + (y * i);
} else {
tmp = fma(y, i, fma(log(c), b, (log(y) * x)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -4.4e+137) tmp = Float64(Float64(fma(Float64(a / x), -1.0, Float64(-log(y))) * Float64(-x)) + Float64(y * i)); elseif (x <= 3.4e+202) tmp = Float64(Float64(Float64(fma(log(c), Float64(b - 0.5), z) + t) + a) + Float64(y * i)); else tmp = fma(y, i, fma(log(c), b, Float64(log(y) * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -4.4e+137], N[(N[(N[(N[(a / x), $MachinePrecision] * -1.0 + (-N[Log[y], $MachinePrecision])), $MachinePrecision] * (-x)), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.4e+202], N[(N[(N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[Log[c], $MachinePrecision] * b + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{x}, -1, -\log y\right) \cdot \left(-x\right) + y \cdot i\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+202}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + a\right) + y \cdot i\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b, \log y \cdot x\right)\right)\\
\end{array}
\end{array}
if x < -4.40000000000000031e137Initial program 99.8%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.7%
Taylor expanded in a around inf
Applied rewrites72.6%
if -4.40000000000000031e137 < x < 3.4e202Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6498.1
Applied rewrites98.1%
if 3.4e202 < 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
lift-log.f64N/A
lift-*.f6494.1
Applied rewrites94.1%
Taylor expanded in b around inf
Applied rewrites94.1%
Final simplification93.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -4.4e+137) (not (<= x 1.55e+190))) (+ (* (fma (/ a x) -1.0 (- (log y))) (- x)) (* y i)) (+ (+ (+ (fma (log c) (- b 0.5) z) t) 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 <= -4.4e+137) || !(x <= 1.55e+190)) {
tmp = (fma((a / x), -1.0, -log(y)) * -x) + (y * i);
} else {
tmp = ((fma(log(c), (b - 0.5), z) + t) + a) + (y * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -4.4e+137) || !(x <= 1.55e+190)) tmp = Float64(Float64(fma(Float64(a / x), -1.0, Float64(-log(y))) * Float64(-x)) + Float64(y * i)); else tmp = Float64(Float64(Float64(fma(log(c), Float64(b - 0.5), z) + t) + a) + Float64(y * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -4.4e+137], N[Not[LessEqual[x, 1.55e+190]], $MachinePrecision]], N[(N[(N[(N[(a / x), $MachinePrecision] * -1.0 + (-N[Log[y], $MachinePrecision])), $MachinePrecision] * (-x)), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+137} \lor \neg \left(x \leq 1.55 \cdot 10^{+190}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{x}, -1, -\log y\right) \cdot \left(-x\right) + y \cdot i\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + a\right) + y \cdot i\\
\end{array}
\end{array}
if x < -4.40000000000000031e137 or 1.5500000000000001e190 < x Initial program 99.8%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in a around inf
Applied rewrites77.9%
if -4.40000000000000031e137 < x < 1.5500000000000001e190Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6498.6
Applied rewrites98.6%
Final simplification93.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (- (log y))))
(if (<= x -4.4e+137)
(+ (* (fma (/ a x) -1.0 t_1) (- x)) (* y i))
(if (<= x 3.4e+202)
(+ (+ (+ (fma (log c) (- b 0.5) z) t) a) (* y i))
(+ (* (fma (/ z x) -1.0 t_1) (- x)) (* y i))))))
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 <= -4.4e+137) {
tmp = (fma((a / x), -1.0, t_1) * -x) + (y * i);
} else if (x <= 3.4e+202) {
tmp = ((fma(log(c), (b - 0.5), z) + t) + a) + (y * i);
} else {
tmp = (fma((z / x), -1.0, t_1) * -x) + (y * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(-log(y)) tmp = 0.0 if (x <= -4.4e+137) tmp = Float64(Float64(fma(Float64(a / x), -1.0, t_1) * Float64(-x)) + Float64(y * i)); elseif (x <= 3.4e+202) tmp = Float64(Float64(Float64(fma(log(c), Float64(b - 0.5), z) + t) + a) + Float64(y * i)); else tmp = Float64(Float64(fma(Float64(z / x), -1.0, t_1) * Float64(-x)) + Float64(y * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = (-N[Log[y], $MachinePrecision])}, If[LessEqual[x, -4.4e+137], N[(N[(N[(N[(a / x), $MachinePrecision] * -1.0 + t$95$1), $MachinePrecision] * (-x)), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.4e+202], N[(N[(N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(z / x), $MachinePrecision] * -1.0 + t$95$1), $MachinePrecision] * (-x)), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\log y\\
\mathbf{if}\;x \leq -4.4 \cdot 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{x}, -1, t\_1\right) \cdot \left(-x\right) + y \cdot i\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+202}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + a\right) + y \cdot i\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{x}, -1, t\_1\right) \cdot \left(-x\right) + y \cdot i\\
\end{array}
\end{array}
if x < -4.40000000000000031e137Initial program 99.8%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.7%
Taylor expanded in a around inf
Applied rewrites72.6%
if -4.40000000000000031e137 < x < 3.4e202Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6498.1
Applied rewrites98.1%
if 3.4e202 < x Initial program 99.8%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites85.0%
Final simplification92.9%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -9.6e+181) (not (<= x 3.5e+202))) (fma y i (* (log y) x)) (+ (+ (+ (fma (log c) (- b 0.5) z) t) 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 <= -9.6e+181) || !(x <= 3.5e+202)) {
tmp = fma(y, i, (log(y) * x));
} else {
tmp = ((fma(log(c), (b - 0.5), z) + t) + a) + (y * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -9.6e+181) || !(x <= 3.5e+202)) tmp = fma(y, i, Float64(log(y) * x)); else tmp = Float64(Float64(Float64(fma(log(c), Float64(b - 0.5), z) + t) + a) + Float64(y * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -9.6e+181], N[Not[LessEqual[x, 3.5e+202]], $MachinePrecision]], N[(y * i + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.6 \cdot 10^{+181} \lor \neg \left(x \leq 3.5 \cdot 10^{+202}\right):\\
\;\;\;\;\mathsf{fma}\left(y, i, \log y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + a\right) + y \cdot i\\
\end{array}
\end{array}
if x < -9.60000000000000009e181 or 3.49999999999999987e202 < 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
*-commutativeN/A
lift-log.f64N/A
lift-*.f6477.7
Applied rewrites77.7%
if -9.60000000000000009e181 < x < 3.49999999999999987e202Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6496.6
Applied rewrites96.6%
Final simplification92.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -9.6e+181) (not (<= x 3.5e+202))) (fma y i (* (log y) x)) (+ (+ (+ z 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) {
double tmp;
if ((x <= -9.6e+181) || !(x <= 3.5e+202)) {
tmp = fma(y, i, (log(y) * x));
} else {
tmp = ((z + a) + ((b - 0.5) * log(c))) + (y * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -9.6e+181) || !(x <= 3.5e+202)) tmp = fma(y, i, Float64(log(y) * x)); else tmp = Float64(Float64(Float64(z + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -9.6e+181], N[Not[LessEqual[x, 3.5e+202]], $MachinePrecision]], N[(y * i + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.6 \cdot 10^{+181} \lor \neg \left(x \leq 3.5 \cdot 10^{+202}\right):\\
\;\;\;\;\mathsf{fma}\left(y, i, \log y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i\\
\end{array}
\end{array}
if x < -9.60000000000000009e181 or 3.49999999999999987e202 < 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
*-commutativeN/A
lift-log.f64N/A
lift-*.f6477.7
Applied rewrites77.7%
if -9.60000000000000009e181 < x < 3.49999999999999987e202Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites77.4%
Final simplification77.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -3.1e+140) (not (<= x 3.4e+202))) (fma y i (* (log y) x)) (fma y i (+ (+ z t) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -3.1e+140) || !(x <= 3.4e+202)) {
tmp = fma(y, i, (log(y) * x));
} else {
tmp = fma(y, i, ((z + t) + a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -3.1e+140) || !(x <= 3.4e+202)) tmp = fma(y, i, Float64(log(y) * x)); else tmp = fma(y, i, Float64(Float64(z + t) + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -3.1e+140], N[Not[LessEqual[x, 3.4e+202]], $MachinePrecision]], N[(y * i + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[(z + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+140} \lor \neg \left(x \leq 3.4 \cdot 10^{+202}\right):\\
\;\;\;\;\mathsf{fma}\left(y, i, \log y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \left(z + t\right) + a\right)\\
\end{array}
\end{array}
if x < -3.1e140 or 3.4e202 < 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
*-commutativeN/A
lift-log.f64N/A
lift-*.f6475.7
Applied rewrites75.7%
if -3.1e140 < x < 3.4e202Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6498.0
Applied rewrites98.0%
Taylor expanded in z around inf
Applied rewrites80.1%
lift-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f6480.1
Applied rewrites80.1%
Final simplification79.0%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -4.2e+221) (not (<= x 9e+202))) (* (log y) x) (fma y i (+ (+ z t) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -4.2e+221) || !(x <= 9e+202)) {
tmp = log(y) * x;
} else {
tmp = fma(y, i, ((z + t) + a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -4.2e+221) || !(x <= 9e+202)) tmp = Float64(log(y) * x); else tmp = fma(y, i, Float64(Float64(z + t) + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -4.2e+221], N[Not[LessEqual[x, 9e+202]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(y * i + N[(N[(z + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+221} \lor \neg \left(x \leq 9 \cdot 10^{+202}\right):\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \left(z + t\right) + a\right)\\
\end{array}
\end{array}
if x < -4.20000000000000004e221 or 8.99999999999999955e202 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6472.8
Applied rewrites72.8%
if -4.20000000000000004e221 < x < 8.99999999999999955e202Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6494.2
Applied rewrites94.2%
Taylor expanded in z around inf
Applied rewrites78.0%
lift-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f6478.0
Applied rewrites78.0%
Final simplification77.1%
(FPCore (x y z t a b c i) :precision binary64 (fma y i (+ (+ z t) a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, ((z + t) + a));
}
function code(x, y, z, t, a, b, c, i) return fma(y, i, Float64(Float64(z + t) + a)) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[(z + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, i, \left(z + t\right) + a\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6483.2
Applied rewrites83.2%
Taylor expanded in z around inf
Applied rewrites67.5%
lift-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f6467.5
Applied rewrites67.5%
(FPCore (x y z t a b c i) :precision binary64 (+ (+ z a) (* y i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (z + a) + (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 = (z + a) + (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 (z + a) + (y * i);
}
def code(x, y, z, t, a, b, c, i): return (z + a) + (y * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(z + a) + Float64(y * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (z + a) + (y * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(z + a), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z + a\right) + y \cdot i
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6483.2
Applied rewrites83.2%
Taylor expanded in z around inf
Applied rewrites51.6%
(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.9%
Taylor expanded in a around inf
Applied rewrites16.4%
herbie shell --seed 2025051
(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)))