
(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 19 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 -5.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 <= -((double) INFINITY)) {
tmp = i * y;
} else if (t_1 <= -5.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 <= -Double.POSITIVE_INFINITY) {
tmp = i * y;
} else if (t_1 <= -5.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 <= -math.inf: tmp = i * y elif t_1 <= -5.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 <= Float64(-Inf)) tmp = Float64(i * y); elseif (t_1 <= -5.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 <= -Inf) tmp = i * y; elseif (t_1 <= -5.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, (-Infinity)], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -5.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 -\infty:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq -5:\\
\;\;\;\;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)) < -inf.0 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 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)) < -5Initial program 99.8%
Taylor expanded in z around inf
Applied rewrites15.8%
if -5 < (+.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 rewrites14.6%
(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+40)
(fma y i (fma (log c) b z))
(if (<= t_1 1e+294) (+ (+ t a) (* (log c) b)) (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 <= 1e+40) {
tmp = fma(y, i, fma(log(c), b, z));
} else if (t_1 <= 1e+294) {
tmp = (t + a) + (log(c) * b);
} 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 <= 1e+40) tmp = fma(y, i, fma(log(c), b, z)); elseif (t_1 <= 1e+294) tmp = Float64(Float64(t + a) + Float64(log(c) * b)); 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, 1e+40], N[(y * i + N[(N[Log[c], $MachinePrecision] * b + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+294], N[(N[(t + a), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], 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 10^{+40}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b, z\right)\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+294}:\\
\;\;\;\;\left(t + a\right) + \log c \cdot b\\
\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.00000000000000003e40Initial program 99.8%
Taylor expanded in z around inf
Applied rewrites56.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6456.5
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--.f6456.5
Applied rewrites56.5%
Taylor expanded in b around inf
Applied rewrites52.8%
if 1.00000000000000003e40 < (+.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.00000000000000007e294Initial 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 y around 0
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites85.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6453.0
Applied rewrites53.0%
if 1.00000000000000007e294 < (+.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%
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
*-commutative70.3
+-commutative70.3
*-commutative70.3
+-commutative70.3
associate-+l+70.3
+-commutative70.3
Applied rewrites70.3%
(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+18)
(fma y i (fma (log c) -0.5 z))
(if (<= t_1 1e+294) (+ (+ t a) (* (log c) b)) (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+18) {
tmp = fma(y, i, fma(log(c), -0.5, z));
} else if (t_1 <= 1e+294) {
tmp = (t + a) + (log(c) * b);
} 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+18) tmp = fma(y, i, fma(log(c), -0.5, z)); elseif (t_1 <= 1e+294) tmp = Float64(Float64(t + a) + Float64(log(c) * b)); 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+18], N[(y * i + N[(N[Log[c], $MachinePrecision] * -0.5 + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+294], N[(N[(t + a), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], 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^{+18}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, -0.5, z\right)\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+294}:\\
\;\;\;\;\left(t + a\right) + \log c \cdot b\\
\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)) < 2e18Initial program 99.8%
Taylor expanded in z around inf
Applied rewrites56.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6456.8
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--.f6456.8
Applied rewrites56.8%
Taylor expanded in b around 0
Applied rewrites45.4%
if 2e18 < (+.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.00000000000000007e294Initial 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 y around 0
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites85.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6452.6
Applied rewrites52.6%
if 1.00000000000000007e294 < (+.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%
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
*-commutative70.3
+-commutative70.3
*-commutative70.3
+-commutative70.3
associate-+l+70.3
+-commutative70.3
Applied rewrites70.3%
(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+18)
(fma y i z)
(if (<= t_1 1e+294) (+ (+ t a) (* (log c) b)) (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+18) {
tmp = fma(y, i, z);
} else if (t_1 <= 1e+294) {
tmp = (t + a) + (log(c) * b);
} 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+18) tmp = fma(y, i, z); elseif (t_1 <= 1e+294) tmp = Float64(Float64(t + a) + Float64(log(c) * b)); 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+18], N[(y * i + z), $MachinePrecision], If[LessEqual[t$95$1, 1e+294], N[(N[(t + a), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], 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^{+18}:\\
\;\;\;\;\mathsf{fma}\left(y, i, z\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+294}:\\
\;\;\;\;\left(t + a\right) + \log c \cdot b\\
\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)) < 2e18Initial 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.9%
Taylor expanded in z around inf
*-commutative42.3
+-commutative42.3
*-commutative42.3
+-commutative42.3
associate-+l+42.3
+-commutative42.3
Applied rewrites42.3%
if 2e18 < (+.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.00000000000000007e294Initial 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 y around 0
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites85.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6452.6
Applied rewrites52.6%
if 1.00000000000000007e294 < (+.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%
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
*-commutative70.3
+-commutative70.3
*-commutative70.3
+-commutative70.3
associate-+l+70.3
+-commutative70.3
Applied rewrites70.3%
(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 (or (<= t_1 -2e+307) (not (<= t_1 INFINITY))) (* i y) (+ (+ t a) z))))
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+307) || !(t_1 <= ((double) INFINITY))) {
tmp = i * y;
} else {
tmp = (t + a) + z;
}
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+307) || !(t_1 <= Double.POSITIVE_INFINITY)) {
tmp = i * y;
} else {
tmp = (t + a) + z;
}
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+307) or not (t_1 <= math.inf): tmp = i * y else: tmp = (t + a) + z 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+307) || !(t_1 <= Inf)) tmp = Float64(i * y); else tmp = Float64(Float64(t + a) + z); 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+307) || ~((t_1 <= Inf))) tmp = i * y; else tmp = (t + a) + z; 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[Or[LessEqual[t$95$1, -2e+307], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]], N[(i * y), $MachinePrecision], N[(N[(t + a), $MachinePrecision] + z), $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^{+307} \lor \neg \left(t\_1 \leq \infty\right):\\
\;\;\;\;i \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(t + a\right) + z\\
\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.99999999999999997e307 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.8%
Taylor expanded in y around inf
lower-*.f6489.6
Applied rewrites89.6%
if -1.99999999999999997e307 < (+.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%
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 y around 0
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites76.4%
Taylor expanded in z around inf
Applied rewrites45.8%
Final simplification49.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))
-5e+16)
(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+16) {
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+16) 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+16], 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^{+16}:\\
\;\;\;\;\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)) < -5e16Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites55.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6455.0
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--.f6455.0
Applied rewrites55.0%
if -5e16 < (+.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 rewrites99.9%
Taylor expanded in a around inf
+-commutative58.4
*-commutative58.4
+-commutative58.4
associate-+l+58.4
Applied rewrites58.4%
(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))
-2000000000000.0)
(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)) <= -2000000000000.0) {
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)) <= -2000000000000.0) 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], -2000000000000.0], 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 -2000000000000:\\
\;\;\;\;\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)) < -2e12Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites54.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6454.6
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--.f6454.6
Applied rewrites54.6%
Taylor expanded in b around inf
Applied rewrites54.5%
if -2e12 < (+.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 rewrites99.9%
Taylor expanded in a around inf
+-commutative58.8
*-commutative58.8
+-commutative58.8
associate-+l+58.8
Applied rewrites58.8%
(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))
40.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)) <= 40.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)) <= 40.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], 40.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 40:\\
\;\;\;\;\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)) < 40Initial 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.9%
Taylor expanded in z around inf
*-commutative41.8
+-commutative41.8
*-commutative41.8
+-commutative41.8
associate-+l+41.8
+-commutative41.8
Applied rewrites41.8%
if 40 < (+.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 rewrites99.9%
Taylor expanded in a around inf
*-commutative41.5
+-commutative41.5
*-commutative41.5
+-commutative41.5
associate-+l+41.5
+-commutative41.5
Applied rewrites41.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))
-5.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)) <= -5.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)) <= (-5.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)) <= -5.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)) <= -5.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)) <= -5.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)) <= -5.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], -5.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 -5:\\
\;\;\;\;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)) < -5Initial program 99.8%
Taylor expanded in z around inf
Applied rewrites13.8%
if -5 < (+.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 rewrites14.6%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -2.8e+174) (not (<= x 1.22e+177))) (+ (+ t z) (fma i y (fma (log c) (- b 0.5) (* (log y) x)))) (fma y i (fma (log c) (- b 0.5) (+ (+ a t) z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -2.8e+174) || !(x <= 1.22e+177)) {
tmp = (t + z) + fma(i, y, fma(log(c), (b - 0.5), (log(y) * x)));
} else {
tmp = fma(y, i, fma(log(c), (b - 0.5), ((a + t) + z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -2.8e+174) || !(x <= 1.22e+177)) tmp = Float64(Float64(t + z) + fma(i, y, fma(log(c), Float64(b - 0.5), Float64(log(y) * x)))); else tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(a + t) + z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -2.8e+174], N[Not[LessEqual[x, 1.22e+177]], $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], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(a + t), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+174} \lor \neg \left(x \leq 1.22 \cdot 10^{+177}\right):\\
\;\;\;\;\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}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(a + t\right) + z\right)\right)\\
\end{array}
\end{array}
if x < -2.7999999999999999e174 or 1.21999999999999999e177 < 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.f6494.4
Applied rewrites94.4%
if -2.7999999999999999e174 < x < 1.21999999999999999e177Initial 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 x around 0
Applied rewrites96.7%
Final simplification96.2%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -2.8e+199) (not (<= x 1.25e+191))) (fma y i (fma (log c) (- b 0.5) (* (log y) x))) (fma y i (fma (log c) (- b 0.5) (+ (+ a t) z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -2.8e+199) || !(x <= 1.25e+191)) {
tmp = fma(y, i, fma(log(c), (b - 0.5), (log(y) * x)));
} else {
tmp = fma(y, i, fma(log(c), (b - 0.5), ((a + t) + z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -2.8e+199) || !(x <= 1.25e+191)) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(log(y) * x))); else tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(a + t) + z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -2.8e+199], N[Not[LessEqual[x, 1.25e+191]], $MachinePrecision]], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(a + t), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+199} \lor \neg \left(x \leq 1.25 \cdot 10^{+191}\right):\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \log y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(a + t\right) + z\right)\right)\\
\end{array}
\end{array}
if x < -2.8000000000000001e199 or 1.25000000000000005e191 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6487.2
Applied rewrites87.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.2
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites87.2%
if -2.8000000000000001e199 < x < 1.25000000000000005e191Initial 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 x around 0
Applied rewrites96.0%
Final simplification94.4%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= x -2.6e+198)
(+ (+ t a) (fma (log y) x (+ z (* b (log c)))))
(if (<= x 7.5e+158)
(fma y i (fma (log c) (- b 0.5) (+ (+ a t) z)))
(+ (+ t a) (+ (fma (log y) x z) (* (log c) b))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (x <= -2.6e+198) {
tmp = (t + a) + fma(log(y), x, (z + (b * log(c))));
} else if (x <= 7.5e+158) {
tmp = fma(y, i, fma(log(c), (b - 0.5), ((a + t) + z)));
} else {
tmp = (t + a) + (fma(log(y), x, z) + (log(c) * b));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -2.6e+198) tmp = Float64(Float64(t + a) + fma(log(y), x, Float64(z + Float64(b * log(c))))); elseif (x <= 7.5e+158) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(a + t) + z))); else tmp = Float64(Float64(t + a) + Float64(fma(log(y), x, z) + Float64(log(c) * b))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -2.6e+198], N[(N[(t + a), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x + N[(z + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e+158], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(a + t), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t + a), $MachinePrecision] + N[(N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+198}:\\
\;\;\;\;\left(t + a\right) + \mathsf{fma}\left(\log y, x, z + b \cdot \log c\right)\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(a + t\right) + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t + a\right) + \left(\mathsf{fma}\left(\log y, x, z\right) + \log c \cdot b\right)\\
\end{array}
\end{array}
if x < -2.59999999999999981e198Initial 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 y around 0
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites84.5%
Taylor expanded in b around inf
Applied rewrites84.5%
lift-+.f64N/A
lift-log.f64N/A
lift-fma.f64N/A
associate-+l+N/A
lower-fma.f64N/A
lift-log.f64N/A
lower-+.f6484.5
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f6484.5
Applied rewrites84.5%
if -2.59999999999999981e198 < x < 7.5000000000000004e158Initial 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 x around 0
Applied rewrites96.3%
if 7.5000000000000004e158 < 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 y around 0
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites83.5%
Taylor expanded in b around inf
Applied rewrites83.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (fma (log y) x z) (* (log c) b))))
(if (<= x -2.6e+199)
(+ t t_1)
(if (<= x 7.5e+158)
(fma y i (fma (log c) (- b 0.5) (+ (+ a t) 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(log(y), x, z) + (log(c) * b);
double tmp;
if (x <= -2.6e+199) {
tmp = t + t_1;
} else if (x <= 7.5e+158) {
tmp = fma(y, i, fma(log(c), (b - 0.5), ((a + t) + z)));
} else {
tmp = (t + a) + t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(fma(log(y), x, z) + Float64(log(c) * b)) tmp = 0.0 if (x <= -2.6e+199) tmp = Float64(t + t_1); elseif (x <= 7.5e+158) tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(a + t) + z))); else tmp = Float64(Float64(t + a) + t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.6e+199], N[(t + t$95$1), $MachinePrecision], If[LessEqual[x, 7.5e+158], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(a + t), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t + a), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\log y, x, z\right) + \log c \cdot b\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{+199}:\\
\;\;\;\;t + t\_1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(a + t\right) + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t + a\right) + t\_1\\
\end{array}
\end{array}
if x < -2.6000000000000001e199Initial 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 y around 0
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites84.5%
Taylor expanded in b around inf
Applied rewrites84.5%
Taylor expanded in t around inf
Applied rewrites79.9%
if -2.6000000000000001e199 < x < 7.5000000000000004e158Initial 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 x around 0
Applied rewrites96.3%
if 7.5000000000000004e158 < 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 y around 0
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites83.5%
Taylor expanded in b around inf
Applied rewrites83.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -2.6e+199) (not (<= x 6.2e+177))) (+ t (+ (fma (log y) x z) (* (log c) b))) (fma y i (fma (log c) (- b 0.5) (+ (+ a t) z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -2.6e+199) || !(x <= 6.2e+177)) {
tmp = t + (fma(log(y), x, z) + (log(c) * b));
} else {
tmp = fma(y, i, fma(log(c), (b - 0.5), ((a + t) + z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -2.6e+199) || !(x <= 6.2e+177)) tmp = Float64(t + Float64(fma(log(y), x, z) + Float64(log(c) * b))); else tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(a + t) + z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -2.6e+199], N[Not[LessEqual[x, 6.2e+177]], $MachinePrecision]], N[(t + N[(N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(a + t), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+199} \lor \neg \left(x \leq 6.2 \cdot 10^{+177}\right):\\
\;\;\;\;t + \left(\mathsf{fma}\left(\log y, x, z\right) + \log c \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(a + t\right) + z\right)\right)\\
\end{array}
\end{array}
if x < -2.6000000000000001e199 or 6.1999999999999998e177 < 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 y around 0
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites82.9%
Taylor expanded in b around inf
Applied rewrites82.9%
Taylor expanded in t around inf
Applied rewrites78.9%
if -2.6000000000000001e199 < x < 6.1999999999999998e177Initial 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 x around 0
Applied rewrites96.4%
Final simplification93.1%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -3.7e+199) (not (<= x 2e+191))) (fma y i (* (log y) x)) (fma y i (fma (log c) (- b 0.5) (+ (+ a t) z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -3.7e+199) || !(x <= 2e+191)) {
tmp = fma(y, i, (log(y) * x));
} else {
tmp = fma(y, i, fma(log(c), (b - 0.5), ((a + t) + z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -3.7e+199) || !(x <= 2e+191)) tmp = fma(y, i, Float64(log(y) * x)); else tmp = fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(a + t) + z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -3.7e+199], N[Not[LessEqual[x, 2e+191]], $MachinePrecision]], N[(y * i + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(a + t), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{+199} \lor \neg \left(x \leq 2 \cdot 10^{+191}\right):\\
\;\;\;\;\mathsf{fma}\left(y, i, \log y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(a + t\right) + z\right)\right)\\
\end{array}
\end{array}
if x < -3.70000000000000021e199 or 2.00000000000000015e191 < 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-*.f6476.6
Applied rewrites76.6%
if -3.70000000000000021e199 < x < 2.00000000000000015e191Initial 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 x around 0
Applied rewrites96.0%
Final simplification92.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= z -9e+15) (fma y i (* (+ (+ 1.0 (/ a z)) (/ t z)) 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 (z <= -9e+15) {
tmp = fma(y, i, (((1.0 + (a / z)) + (t / z)) * z));
} else {
tmp = fma(y, i, a);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (z <= -9e+15) tmp = fma(y, i, Float64(Float64(Float64(1.0 + Float64(a / z)) + Float64(t / z)) * z)); else tmp = fma(y, i, a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -9e+15], N[(y * i + N[(N[(N[(1.0 + N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(t / z), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(y * i + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \left(\left(1 + \frac{a}{z}\right) + \frac{t}{z}\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, a\right)\\
\end{array}
\end{array}
if z < -9e15Initial 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 z around inf
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in t around inf
lower-/.f6474.0
Applied rewrites74.0%
if -9e15 < z 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%
Taylor expanded in a around inf
*-commutative43.6
+-commutative43.6
*-commutative43.6
+-commutative43.6
associate-+l+43.6
+-commutative43.6
Applied rewrites43.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= z -3.8e+161) (+ (+ t a) 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 (z <= -3.8e+161) {
tmp = (t + a) + z;
} else {
tmp = fma(y, i, a);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (z <= -3.8e+161) tmp = Float64(Float64(t + a) + z); else tmp = fma(y, i, a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -3.8e+161], N[(N[(t + a), $MachinePrecision] + z), $MachinePrecision], N[(y * i + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+161}:\\
\;\;\;\;\left(t + a\right) + z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, a\right)\\
\end{array}
\end{array}
if z < -3.8000000000000002e161Initial 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 y around 0
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites82.9%
Taylor expanded in z around inf
Applied rewrites70.7%
if -3.8000000000000002e161 < z 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%
Taylor expanded in a around inf
*-commutative43.8
+-commutative43.8
*-commutative43.8
+-commutative43.8
associate-+l+43.8
+-commutative43.8
Applied rewrites43.8%
(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 rewrites15.7%
herbie shell --seed 2025038
(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)))