
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
}
def code(x, y, z, t, a, b, c, i): return (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
}
def code(x, y, z, t, a, b, c, i): return (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (fma y i (fma (log c) (- b 0.5) (+ (+ a t) (fma (log y) x z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, fma(log(c), (b - 0.5), ((a + t) + fma(log(y), x, z))));
}
function code(x, y, z, t, a, b, c, i) return fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(a + t) + fma(log(y), x, z)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(a + t), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(a + t\right) + \mathsf{fma}\left(\log y, x, z\right)\right)\right)
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (fma (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) {
return ((fma(log(y), x, z) + a) + ((b - 0.5) * log(c))) + (y * i);
}
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(fma(log(y), x, z) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[Log[y], $MachinePrecision] * x + z), $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(\mathsf{fma}\left(\log y, x, z\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f6484.5
Applied rewrites84.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))
-50.0)
(+ (+ (fma i y (fma (log c) (- b 0.5) (* (log y) x))) z) t)
(+ (+ (fma i y (fma (log y) x (* (log c) (- b 0.5)))) t) a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i)) <= -50.0) {
tmp = (fma(i, y, fma(log(c), (b - 0.5), (log(y) * x))) + z) + t;
} else {
tmp = (fma(i, y, fma(log(y), x, (log(c) * (b - 0.5)))) + t) + a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) <= -50.0) tmp = Float64(Float64(fma(i, y, fma(log(c), Float64(b - 0.5), Float64(log(y) * x))) + z) + t); else tmp = Float64(Float64(fma(i, y, fma(log(y), x, Float64(log(c) * Float64(b - 0.5)))) + t) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision], -50.0], N[(N[(N[(i * y + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision], N[(N[(N[(i * y + N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] + 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:\\
\;\;\;\;\left(\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log c, b - 0.5, \log y \cdot x\right)\right) + z\right) + t\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, \log c \cdot \left(b - 0.5\right)\right)\right) + t\right) + 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.8%
Taylor expanded in a around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/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.f6484.8
Applied rewrites84.8%
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.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/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.f6484.8
Applied rewrites84.8%
lift--.f64N/A
lift-fma.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6484.8
Applied rewrites84.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma i y (fma (log c) (- b 0.5) (* (log y) x)))))
(if (<=
(+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i))
-50.0)
(+ (+ t_1 z) t)
(+ (+ t_1 t) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(i, y, fma(log(c), (b - 0.5), (log(y) * x)));
double tmp;
if (((((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i)) <= -50.0) {
tmp = (t_1 + z) + t;
} else {
tmp = (t_1 + t) + a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(i, y, fma(log(c), Float64(b - 0.5), Float64(log(y) * x))) 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 = Float64(Float64(t_1 + z) + t); else tmp = Float64(Float64(t_1 + t) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(i * y + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, 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[(N[(t$95$1 + z), $MachinePrecision] + t), $MachinePrecision], N[(N[(t$95$1 + t), $MachinePrecision] + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log c, b - 0.5, \log y \cdot x\right)\right)\\
\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:\\
\;\;\;\;\left(t\_1 + z\right) + t\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + t\right) + 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.8%
Taylor expanded in a around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/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.f6484.8
Applied rewrites84.8%
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.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/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.f6484.8
Applied rewrites84.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y i (+ (fma (- b 0.5) (log c) z) a))))
(if (<= b -6.8e+158)
t_1
(if (<= b 3.3e+160)
(fma y i (fma -0.5 (log c) (+ (fma x (log y) z) a)))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, i, (fma((b - 0.5), log(c), z) + a));
double tmp;
if (b <= -6.8e+158) {
tmp = t_1;
} else if (b <= 3.3e+160) {
tmp = fma(y, i, fma(-0.5, log(c), (fma(x, log(y), z) + a)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, i, Float64(fma(Float64(b - 0.5), log(c), z) + a)) tmp = 0.0 if (b <= -6.8e+158) tmp = t_1; elseif (b <= 3.3e+160) tmp = fma(y, i, fma(-0.5, log(c), Float64(fma(x, log(y), z) + a))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * i + N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + z), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -6.8e+158], t$95$1, If[LessEqual[b, 3.3e+160], N[(y * i + N[(-0.5 * N[Log[c], $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision] + z), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, i, \mathsf{fma}\left(b - 0.5, \log c, z\right) + a\right)\\
\mathbf{if}\;b \leq -6.8 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.3 \cdot 10^{+160}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(-0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -6.7999999999999998e158 or 3.2999999999999997e160 < b Initial program 99.8%
lift-*.f64N/A
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
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
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--.f6484.3
Applied rewrites84.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6469.3
Applied rewrites69.3%
if -6.7999999999999998e158 < b < 3.2999999999999997e160Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f6484.5
Applied rewrites84.5%
Taylor expanded in b around 0
Applied rewrites69.3%
lift-*.f64N/A
lift-+.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6469.3
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift-log.f64N/A
Applied rewrites69.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= x 4.5e+230) (fma y i (+ (fma (- b 0.5) (log c) z) a)) (+ (+ (fma (log c) (- b 0.5) (* (log y) x)) 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.5e+230) {
tmp = fma(y, i, (fma((b - 0.5), log(c), z) + a));
} else {
tmp = (fma(log(c), (b - 0.5), (log(y) * x)) + t) + a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= 4.5e+230) tmp = fma(y, i, Float64(fma(Float64(b - 0.5), log(c), z) + a)); else tmp = Float64(Float64(fma(log(c), Float64(b - 0.5), Float64(log(y) * x)) + t) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, 4.5e+230], N[(y * i + N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + z), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{+230}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(b - 0.5, \log c, z\right) + a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\log c, b - 0.5, \log y \cdot x\right) + t\right) + a\\
\end{array}
\end{array}
if x < 4.4999999999999999e230Initial program 99.8%
lift-*.f64N/A
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
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
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--.f6484.3
Applied rewrites84.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6469.3
Applied rewrites69.3%
if 4.4999999999999999e230 < x Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/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.f6484.8
Applied rewrites84.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-log.f64N/A
*-commutativeN/A
lift-log.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift--.f6461.9
Applied rewrites61.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= x 4.5e+230) (fma y i (+ (fma (- b 0.5) (log c) z) a)) (+ (fma (log c) -0.5 (fma x (log y) 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.5e+230) {
tmp = fma(y, i, (fma((b - 0.5), log(c), z) + a));
} else {
tmp = fma(log(c), -0.5, fma(x, log(y), t)) + a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= 4.5e+230) tmp = fma(y, i, Float64(fma(Float64(b - 0.5), log(c), z) + a)); else tmp = Float64(fma(log(c), -0.5, fma(x, log(y), t)) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, 4.5e+230], N[(y * i + N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + z), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[c], $MachinePrecision] * -0.5 + N[(x * N[Log[y], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{+230}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(b - 0.5, \log c, z\right) + a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log c, -0.5, \mathsf{fma}\left(x, \log y, t\right)\right) + a\\
\end{array}
\end{array}
if x < 4.4999999999999999e230Initial program 99.8%
lift-*.f64N/A
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
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
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--.f6484.3
Applied rewrites84.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6469.3
Applied rewrites69.3%
if 4.4999999999999999e230 < x Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/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.f6484.8
Applied rewrites84.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-log.f64N/A
*-commutativeN/A
lift-log.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift--.f6461.9
Applied rewrites61.9%
Taylor expanded in b around 0
Applied rewrites46.8%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l+N/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f6446.8
Applied rewrites46.8%
(FPCore (x y z t a b c i) :precision binary64 (fma y i (+ (fma (- b 0.5) (log c) z) a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, (fma((b - 0.5), log(c), z) + a));
}
function code(x, y, z, t, a, b, c, i) return fma(y, i, Float64(fma(Float64(b - 0.5), log(c), z) + a)) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + z), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, i, \mathsf{fma}\left(b - 0.5, \log c, z\right) + a\right)
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
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--.f6484.3
Applied rewrites84.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6469.3
Applied rewrites69.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y i (fma (- b 0.5) (log c) a))))
(if (<= (- b 0.5) -1e+206)
t_1
(if (<= (- b 0.5) 5e+203) (fma y i (+ (fma -0.5 (log c) z) a)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, i, fma((b - 0.5), log(c), a));
double tmp;
if ((b - 0.5) <= -1e+206) {
tmp = t_1;
} else if ((b - 0.5) <= 5e+203) {
tmp = fma(y, i, (fma(-0.5, log(c), z) + a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, i, fma(Float64(b - 0.5), log(c), a)) tmp = 0.0 if (Float64(b - 0.5) <= -1e+206) tmp = t_1; elseif (Float64(b - 0.5) <= 5e+203) tmp = fma(y, i, Float64(fma(-0.5, log(c), z) + a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * i + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b - 0.5), $MachinePrecision], -1e+206], t$95$1, If[LessEqual[N[(b - 0.5), $MachinePrecision], 5e+203], N[(y * i + N[(N[(-0.5 * N[Log[c], $MachinePrecision] + z), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, i, \mathsf{fma}\left(b - 0.5, \log c, a\right)\right)\\
\mathbf{if}\;b - 0.5 \leq -1 \cdot 10^{+206}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b - 0.5 \leq 5 \cdot 10^{+203}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(-0.5, \log c, z\right) + a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 b #s(literal 1/2 binary64)) < -1e206 or 4.99999999999999994e203 < (-.f64 b #s(literal 1/2 binary64)) Initial program 99.8%
lift-*.f64N/A
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
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
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--.f6484.3
Applied rewrites84.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6469.3
Applied rewrites69.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6454.8
Applied rewrites54.8%
if -1e206 < (-.f64 b #s(literal 1/2 binary64)) < 4.99999999999999994e203Initial program 99.8%
lift-*.f64N/A
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
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
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--.f6484.3
Applied rewrites84.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6469.3
Applied rewrites69.3%
Taylor expanded in b around 0
+-commutativeN/A
lower-fma.f64N/A
lift-log.f6454.4
Applied rewrites54.4%
(FPCore (x y z t a b c i) :precision binary64 (fma y i (fma (- b 0.5) (log c) a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, fma((b - 0.5), log(c), a));
}
function code(x, y, z, t, a, b, c, i) return fma(y, i, fma(Float64(b - 0.5), log(c), a)) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, i, \mathsf{fma}\left(b - 0.5, \log c, a\right)\right)
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
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--.f6484.3
Applied rewrites84.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6469.3
Applied rewrites69.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6454.8
Applied rewrites54.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(+
(+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c)))
(* y i))))
(if (<= t_1 -4e+307)
(* i y)
(if (<= t_1 1e+308) (+ (fma (- b 0.5) (log c) t) 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 <= -4e+307) {
tmp = i * y;
} else if (t_1 <= 1e+308) {
tmp = fma((b - 0.5), log(c), t) + 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 <= -4e+307) tmp = Float64(i * y); elseif (t_1 <= 1e+308) tmp = Float64(fma(Float64(b - 0.5), log(c), t) + a); else tmp = Float64(i * y); 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, -4e+307], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, 1e+308], N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision], 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 -4 \cdot 10^{+307}:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq 10^{+308}:\\
\;\;\;\;\mathsf{fma}\left(b - 0.5, \log c, t\right) + 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)) < -3.99999999999999994e307 or 1e308 < (+.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%
lift-*.f64N/A
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
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
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--.f6484.3
Applied rewrites84.3%
Taylor expanded in y around inf
lower-*.f6424.8
Applied rewrites24.8%
if -3.99999999999999994e307 < (+.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)) < 1e308Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/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.f6484.8
Applied rewrites84.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-log.f64N/A
*-commutativeN/A
lift-log.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift--.f6461.9
Applied rewrites61.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6446.7
Applied rewrites46.7%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (* (log c) b))) (if (<= (- b 0.5) -8e+158) t_1 (if (<= (- b 0.5) 5e+205) (* i y) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(c) * b;
double tmp;
if ((b - 0.5) <= -8e+158) {
tmp = t_1;
} else if ((b - 0.5) <= 5e+205) {
tmp = i * y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = log(c) * b
if ((b - 0.5d0) <= (-8d+158)) then
tmp = t_1
else if ((b - 0.5d0) <= 5d+205) then
tmp = i * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = Math.log(c) * b;
double tmp;
if ((b - 0.5) <= -8e+158) {
tmp = t_1;
} else if ((b - 0.5) <= 5e+205) {
tmp = i * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = math.log(c) * b tmp = 0 if (b - 0.5) <= -8e+158: tmp = t_1 elif (b - 0.5) <= 5e+205: tmp = i * y else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(c) * b) tmp = 0.0 if (Float64(b - 0.5) <= -8e+158) tmp = t_1; elseif (Float64(b - 0.5) <= 5e+205) tmp = Float64(i * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = log(c) * b; tmp = 0.0; if ((b - 0.5) <= -8e+158) tmp = t_1; elseif ((b - 0.5) <= 5e+205) tmp = i * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[N[(b - 0.5), $MachinePrecision], -8e+158], t$95$1, If[LessEqual[N[(b - 0.5), $MachinePrecision], 5e+205], N[(i * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log c \cdot b\\
\mathbf{if}\;b - 0.5 \leq -8 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b - 0.5 \leq 5 \cdot 10^{+205}:\\
\;\;\;\;i \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 b #s(literal 1/2 binary64)) < -7.99999999999999962e158 or 5.0000000000000002e205 < (-.f64 b #s(literal 1/2 binary64)) Initial program 99.8%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6416.6
Applied rewrites16.6%
if -7.99999999999999962e158 < (-.f64 b #s(literal 1/2 binary64)) < 5.0000000000000002e205Initial program 99.8%
lift-*.f64N/A
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
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
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--.f6484.3
Applied rewrites84.3%
Taylor expanded in y around inf
lower-*.f6424.8
Applied rewrites24.8%
(FPCore (x y z t a b c i) :precision binary64 (* i y))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return i * y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, 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 = i * y
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return i * y;
}
def code(x, y, z, t, a, b, c, i): return i * y
function code(x, y, z, t, a, b, c, i) return Float64(i * y) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = i * y; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(i * y), $MachinePrecision]
\begin{array}{l}
\\
i \cdot y
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
Applied rewrites99.8%
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--.f6484.3
Applied rewrites84.3%
Taylor expanded in y around inf
lower-*.f6424.8
Applied rewrites24.8%
herbie shell --seed 2025134
(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)))