
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (- (log1p (* (- y) y)) (log1p y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * (log1p((-y * y)) - log1p(y)))) - t;
}
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * (Math.log1p((-y * y)) - Math.log1p(y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * (math.log1p((-y * y)) - math.log1p(y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * Float64(log1p(Float64(Float64(-y) * y)) - log1p(y)))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[(N[Log[1 + N[((-y) * y), $MachinePrecision]], $MachinePrecision] - N[Log[1 + y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left(\left(-y\right) \cdot y\right) - \mathsf{log1p}\left(y\right)\right)\right) - t
\end{array}
Initial program 90.8%
lift-log.f64N/A
lift--.f64N/A
flip--N/A
log-divN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-log1p.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-log1p.f6499.8
Applied rewrites99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (log y) x) t))
(t_2 (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y))))))
(if (<= t_2 -1e+48)
t_1
(if (<= t_2 150.0)
(- (fma (- y) z y) t)
(if (<= t_2 665.0) (- (- (log y)) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - t;
double t_2 = ((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)));
double tmp;
if (t_2 <= -1e+48) {
tmp = t_1;
} else if (t_2 <= 150.0) {
tmp = fma(-y, z, y) - t;
} else if (t_2 <= 665.0) {
tmp = -log(y) - t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - t) t_2 = Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) tmp = 0.0 if (t_2 <= -1e+48) tmp = t_1; elseif (t_2 <= 150.0) tmp = Float64(fma(Float64(-y), z, y) - t); elseif (t_2 <= 665.0) tmp = Float64(Float64(-log(y)) - t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+48], t$95$1, If[LessEqual[t$95$2, 150.0], N[(N[((-y) * z + y), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 665.0], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - t\\
t_2 := \left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 150:\\
\;\;\;\;\mathsf{fma}\left(-y, z, y\right) - t\\
\mathbf{elif}\;t\_2 \leq 665:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -1.00000000000000004e48 or 665 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) Initial program 97.0%
Taylor expanded in x around inf
*-commutativeN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f6492.7
Applied rewrites92.7%
if -1.00000000000000004e48 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 150Initial program 68.4%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites75.8%
Taylor expanded in y around inf
Applied rewrites76.4%
Taylor expanded in z around 0
Applied rewrites76.4%
if 150 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 665Initial program 89.4%
lift-log.f64N/A
lift--.f64N/A
flip--N/A
log-divN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-log1p.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-log1p.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
remove-double-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
lower-*.f64N/A
log-recN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
remove-double-negN/A
lower-log.f64N/A
lower--.f6489.4
Applied rewrites89.4%
Taylor expanded in x around 0
Applied rewrites89.4%
Taylor expanded in x around 0
Applied rewrites89.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x))
(t_2 (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y))))))
(if (<= t_2 -1e+102)
t_1
(if (<= t_2 150.0)
(- (* (* (- (* -0.5 y) 1.0) z) y) t)
(if (<= t_2 1e+142) (- (- (log y)) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double t_2 = ((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)));
double tmp;
if (t_2 <= -1e+102) {
tmp = t_1;
} else if (t_2 <= 150.0) {
tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
} else if (t_2 <= 1e+142) {
tmp = -log(y) - t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = log(y) * x
t_2 = ((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))
if (t_2 <= (-1d+102)) then
tmp = t_1
else if (t_2 <= 150.0d0) then
tmp = (((((-0.5d0) * y) - 1.0d0) * z) * y) - t
else if (t_2 <= 1d+142) then
tmp = -log(y) - t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * x;
double t_2 = ((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)));
double tmp;
if (t_2 <= -1e+102) {
tmp = t_1;
} else if (t_2 <= 150.0) {
tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
} else if (t_2 <= 1e+142) {
tmp = -Math.log(y) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x t_2 = ((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y))) tmp = 0 if t_2 <= -1e+102: tmp = t_1 elif t_2 <= 150.0: tmp = ((((-0.5 * y) - 1.0) * z) * y) - t elif t_2 <= 1e+142: tmp = -math.log(y) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) t_2 = Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) tmp = 0.0 if (t_2 <= -1e+102) tmp = t_1; elseif (t_2 <= 150.0) tmp = Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * z) * y) - t); elseif (t_2 <= 1e+142) tmp = Float64(Float64(-log(y)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; t_2 = ((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y))); tmp = 0.0; if (t_2 <= -1e+102) tmp = t_1; elseif (t_2 <= 150.0) tmp = ((((-0.5 * y) - 1.0) * z) * y) - t; elseif (t_2 <= 1e+142) tmp = -log(y) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+102], t$95$1, If[LessEqual[t$95$2, 150.0], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 1e+142], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
t_2 := \left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 150:\\
\;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t\\
\mathbf{elif}\;t\_2 \leq 10^{+142}:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -9.99999999999999977e101 or 1.00000000000000005e142 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) Initial program 95.6%
lift-log.f64N/A
lift--.f64N/A
flip--N/A
log-divN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-log1p.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-log1p.f6499.5
Applied rewrites99.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.5%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
Applied rewrites99.5%
Taylor expanded in x around inf
*-commutativeN/A
remove-double-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
lower-*.f64N/A
log-recN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
remove-double-negN/A
lower-log.f6476.8
Applied rewrites76.8%
if -9.99999999999999977e101 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 150Initial program 78.0%
lift-log.f64N/A
lift--.f64N/A
flip--N/A
log-divN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-log1p.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-log1p.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower--.f64N/A
lower-fma.f64N/A
remove-double-negN/A
mul-1-negN/A
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites71.9%
if 150 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 1.00000000000000005e142Initial program 92.6%
lift-log.f64N/A
lift--.f64N/A
flip--N/A
log-divN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-log1p.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-log1p.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
remove-double-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
lower-*.f64N/A
log-recN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
remove-double-negN/A
lower-log.f64N/A
lower--.f6492.6
Applied rewrites92.6%
Taylor expanded in x around 0
Applied rewrites81.5%
Taylor expanded in x around 0
Applied rewrites81.5%
(FPCore (x y z t)
:precision binary64
(fma
(-
(*
(*
(fma
(* (fma (* y y) (fma (* -0.25 y) y -0.3333333333333333) -0.5) y)
y
-1.0)
y)
y)
(log1p y))
(- z 1.0)
(- (* (log y) (- x 1.0)) t)))
double code(double x, double y, double z, double t) {
return fma((((fma((fma((y * y), fma((-0.25 * y), y, -0.3333333333333333), -0.5) * y), y, -1.0) * y) * y) - log1p(y)), (z - 1.0), ((log(y) * (x - 1.0)) - t));
}
function code(x, y, z, t) return fma(Float64(Float64(Float64(fma(Float64(fma(Float64(y * y), fma(Float64(-0.25 * y), y, -0.3333333333333333), -0.5) * y), y, -1.0) * y) * y) - log1p(y)), Float64(z - 1.0), Float64(Float64(log(y) * Float64(x - 1.0)) - t)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * N[(N[(-0.25 * y), $MachinePrecision] * y + -0.3333333333333333), $MachinePrecision] + -0.5), $MachinePrecision] * y), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] - N[Log[1 + y], $MachinePrecision]), $MachinePrecision] * N[(z - 1.0), $MachinePrecision] + N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(-0.25 \cdot y, y, -0.3333333333333333\right), -0.5\right) \cdot y, y, -1\right) \cdot y\right) \cdot y - \mathsf{log1p}\left(y\right), z - 1, \log y \cdot \left(x - 1\right) - t\right)
\end{array}
Initial program 90.8%
lift-log.f64N/A
lift--.f64N/A
flip--N/A
log-divN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-log1p.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-log1p.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
Applied rewrites99.8%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (- x 1.0) (log y))
(*
(- z 1.0)
(* (fma (fma (fma -0.25 y -0.3333333333333333) y -0.5) y -1.0) y)))
t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * (fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y))) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * Float64(fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * y + -0.5), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right), y, -1\right) \cdot y\right)\right) - t
\end{array}
Initial program 90.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.7%
(FPCore (x y z t) :precision binary64 (- (fma (log y) (- x 1.0) (* (fma (* (- z 1.0) (fma -0.3333333333333333 y -0.5)) y (- (- z 1.0))) y)) t))
double code(double x, double y, double z, double t) {
return fma(log(y), (x - 1.0), (fma(((z - 1.0) * fma(-0.3333333333333333, y, -0.5)), y, -(z - 1.0)) * y)) - t;
}
function code(x, y, z, t) return Float64(fma(log(y), Float64(x - 1.0), Float64(fma(Float64(Float64(z - 1.0) * fma(-0.3333333333333333, y, -0.5)), y, Float64(-Float64(z - 1.0))) * y)) - t) end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + N[(N[(N[(N[(z - 1.0), $MachinePrecision] * N[(-0.3333333333333333 * y + -0.5), $MachinePrecision]), $MachinePrecision] * y + (-N[(z - 1.0), $MachinePrecision])), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x - 1, \mathsf{fma}\left(\left(z - 1\right) \cdot \mathsf{fma}\left(-0.3333333333333333, y, -0.5\right), y, -\left(z - 1\right)\right) \cdot y\right) - t
\end{array}
Initial program 90.8%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
log-recN/A
lower-fma.f64N/A
Applied rewrites99.6%
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (* (fma (fma -0.3333333333333333 y -0.5) y -1.0) y))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * (fma(fma(-0.3333333333333333, y, -0.5), y, -1.0) * y))) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * Float64(fma(fma(-0.3333333333333333, y, -0.5), y, -1.0) * y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right), y, -1\right) \cdot y\right)\right) - t
\end{array}
Initial program 90.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f6499.5
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (- (fma (* (- z 1.0) (fma -0.5 y -1.0)) y (* (log y) (- x 1.0))) t))
double code(double x, double y, double z, double t) {
return fma(((z - 1.0) * fma(-0.5, y, -1.0)), y, (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(Float64(z - 1.0) * fma(-0.5, y, -1.0)), y, Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(z - 1.0), $MachinePrecision] * N[(-0.5 * y + -1.0), $MachinePrecision]), $MachinePrecision] * y + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(z - 1\right) \cdot \mathsf{fma}\left(-0.5, y, -1\right), y, \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 90.8%
lift-log.f64N/A
lift--.f64N/A
flip--N/A
log-divN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-log1p.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-log1p.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower--.f64N/A
lower-fma.f64N/A
remove-double-negN/A
mul-1-negN/A
Applied rewrites99.3%
(FPCore (x y z t) :precision binary64 (- (fma (log y) (- x 1.0) (* (* (- z 1.0) y) (fma -0.5 y -1.0))) t))
double code(double x, double y, double z, double t) {
return fma(log(y), (x - 1.0), (((z - 1.0) * y) * fma(-0.5, y, -1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(log(y), Float64(x - 1.0), Float64(Float64(Float64(z - 1.0) * y) * fma(-0.5, y, -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + N[(N[(N[(z - 1.0), $MachinePrecision] * y), $MachinePrecision] * N[(-0.5 * y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x - 1, \left(\left(z - 1\right) \cdot y\right) \cdot \mathsf{fma}\left(-0.5, y, -1\right)\right) - t
\end{array}
Initial program 90.8%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
log-recN/A
lower-fma.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower--.f64N/A
Applied rewrites99.3%
(FPCore (x y z t)
:precision binary64
(if (<= x -1000.0)
(- (* (log y) (- x 1.0)) t)
(if (<= x 1.85e+39)
(- (- (fma (- z 1.0) y (log y))) t)
(- (* (log y) x) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1000.0) {
tmp = (log(y) * (x - 1.0)) - t;
} else if (x <= 1.85e+39) {
tmp = -fma((z - 1.0), y, log(y)) - t;
} else {
tmp = (log(y) * x) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -1000.0) tmp = Float64(Float64(log(y) * Float64(x - 1.0)) - t); elseif (x <= 1.85e+39) tmp = Float64(Float64(-fma(Float64(z - 1.0), y, log(y))) - t); else tmp = Float64(Float64(log(y) * x) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -1000.0], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 1.85e+39], N[((-N[(N[(z - 1.0), $MachinePrecision] * y + N[Log[y], $MachinePrecision]), $MachinePrecision]) - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1000:\\
\;\;\;\;\log y \cdot \left(x - 1\right) - t\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+39}:\\
\;\;\;\;\left(-\mathsf{fma}\left(z - 1, y, \log y\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot x - t\\
\end{array}
\end{array}
if x < -1e3Initial program 98.1%
Taylor expanded in y around 0
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower--.f6496.6
Applied rewrites96.6%
if -1e3 < x < 1.85000000000000006e39Initial program 83.7%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower--.f6498.4
Applied rewrites98.4%
Taylor expanded in x around 0
Applied rewrites94.8%
if 1.85000000000000006e39 < x Initial program 99.4%
Taylor expanded in x around inf
*-commutativeN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f6497.7
Applied rewrites97.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (- x 1.0) -4e+144) (not (<= (- x 1.0) 5e+98))) (* (log y) x) (- (* (* (- (* (fma -0.3333333333333333 y -0.5) y) 1.0) z) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x - 1.0) <= -4e+144) || !((x - 1.0) <= 5e+98)) {
tmp = log(y) * x;
} else {
tmp = ((((fma(-0.3333333333333333, y, -0.5) * y) - 1.0) * z) * y) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((Float64(x - 1.0) <= -4e+144) || !(Float64(x - 1.0) <= 5e+98)) tmp = Float64(log(y) * x); else tmp = Float64(Float64(Float64(Float64(Float64(fma(-0.3333333333333333, y, -0.5) * y) - 1.0) * z) * y) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x - 1.0), $MachinePrecision], -4e+144], N[Not[LessEqual[N[(x - 1.0), $MachinePrecision], 5e+98]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x - 1 \leq -4 \cdot 10^{+144} \lor \neg \left(x - 1 \leq 5 \cdot 10^{+98}\right):\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot y - 1\right) \cdot z\right) \cdot y - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -4.00000000000000009e144 or 4.9999999999999998e98 < (-.f64 x #s(literal 1 binary64)) Initial program 99.3%
lift-log.f64N/A
lift--.f64N/A
flip--N/A
log-divN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-log1p.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-log1p.f6499.6
Applied rewrites99.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.6%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
remove-double-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
lower-*.f64N/A
log-recN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
remove-double-negN/A
lower-log.f6483.8
Applied rewrites83.8%
if -4.00000000000000009e144 < (-.f64 x #s(literal 1 binary64)) < 4.9999999999999998e98Initial program 87.4%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
log-recN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites67.5%
Final simplification72.2%
(FPCore (x y z t) :precision binary64 (- (fma (log y) (- x 1.0) (* (- 1.0 z) y)) t))
double code(double x, double y, double z, double t) {
return fma(log(y), (x - 1.0), ((1.0 - z) * y)) - t;
}
function code(x, y, z, t) return Float64(fma(log(y), Float64(x - 1.0), Float64(Float64(1.0 - z) * y)) - t) end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x - 1, \left(1 - z\right) \cdot y\right) - t
\end{array}
Initial program 90.8%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
log-recN/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in y around 0
Applied rewrites98.5%
(FPCore (x y z t) :precision binary64 (if (<= z -2.5e+179) (- (* (* (- (* (fma -0.3333333333333333 y -0.5) y) 1.0) z) y) t) (- (fma (log y) (- x 1.0) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.5e+179) {
tmp = ((((fma(-0.3333333333333333, y, -0.5) * y) - 1.0) * z) * y) - t;
} else {
tmp = fma(log(y), (x - 1.0), y) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -2.5e+179) tmp = Float64(Float64(Float64(Float64(Float64(fma(-0.3333333333333333, y, -0.5) * y) - 1.0) * z) * y) - t); else tmp = Float64(fma(log(y), Float64(x - 1.0), y) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.5e+179], N[(N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+179}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot y - 1\right) \cdot z\right) \cdot y - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x - 1, y\right) - t\\
\end{array}
\end{array}
if z < -2.5e179Initial program 50.4%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
log-recN/A
lower-fma.f64N/A
Applied rewrites97.8%
Taylor expanded in z around inf
Applied rewrites76.9%
if -2.5e179 < z Initial program 95.6%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower--.f6499.0
Applied rewrites99.0%
Taylor expanded in z around 0
Applied rewrites94.4%
(FPCore (x y z t) :precision binary64 (if (<= z -2.5e+179) (- (* (* (- (* (fma -0.3333333333333333 y -0.5) y) 1.0) z) y) t) (- (* (log y) (- x 1.0)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.5e+179) {
tmp = ((((fma(-0.3333333333333333, y, -0.5) * y) - 1.0) * z) * y) - t;
} else {
tmp = (log(y) * (x - 1.0)) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -2.5e+179) tmp = Float64(Float64(Float64(Float64(Float64(fma(-0.3333333333333333, y, -0.5) * y) - 1.0) * z) * y) - t); else tmp = Float64(Float64(log(y) * Float64(x - 1.0)) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.5e+179], N[(N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+179}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot y - 1\right) \cdot z\right) \cdot y - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x - 1\right) - t\\
\end{array}
\end{array}
if z < -2.5e179Initial program 50.4%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
log-recN/A
lower-fma.f64N/A
Applied rewrites97.8%
Taylor expanded in z around inf
Applied rewrites76.9%
if -2.5e179 < z Initial program 95.6%
Taylor expanded in y around 0
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower--.f6494.0
Applied rewrites94.0%
(FPCore (x y z t) :precision binary64 (- (* (* (- (* (fma -0.3333333333333333 y -0.5) y) 1.0) z) y) t))
double code(double x, double y, double z, double t) {
return ((((fma(-0.3333333333333333, y, -0.5) * y) - 1.0) * z) * y) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(Float64(fma(-0.3333333333333333, y, -0.5) * y) - 1.0) * z) * y) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot y - 1\right) \cdot z\right) \cdot y - t
\end{array}
Initial program 90.8%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
log-recN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
log-recN/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in z around inf
Applied rewrites52.4%
(FPCore (x y z t) :precision binary64 (- (* (* (- (* -0.5 y) 1.0) z) y) t))
double code(double x, double y, double z, double t) {
return ((((-0.5 * y) - 1.0) * z) * y) - t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((((-0.5d0) * y) - 1.0d0) * z) * y) - t
end function
public static double code(double x, double y, double z, double t) {
return ((((-0.5 * y) - 1.0) * z) * y) - t;
}
def code(x, y, z, t): return ((((-0.5 * y) - 1.0) * z) * y) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * z) * y) - t) end
function tmp = code(x, y, z, t) tmp = ((((-0.5 * y) - 1.0) * z) * y) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t
\end{array}
Initial program 90.8%
lift-log.f64N/A
lift--.f64N/A
flip--N/A
log-divN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-log1p.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-log1p.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower--.f64N/A
lower-fma.f64N/A
remove-double-negN/A
mul-1-negN/A
Applied rewrites99.3%
Taylor expanded in z around inf
Applied rewrites52.2%
(FPCore (x y z t) :precision binary64 (- (fma (- y) z y) t))
double code(double x, double y, double z, double t) {
return fma(-y, z, y) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-y), z, y) - t) end
code[x_, y_, z_, t_] := N[(N[((-y) * z + y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z, y\right) - t
\end{array}
Initial program 90.8%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in z around inf
Applied rewrites51.4%
Taylor expanded in y around inf
Applied rewrites51.5%
Taylor expanded in z around 0
Applied rewrites51.5%
(FPCore (x y z t) :precision binary64 (- (* (- z) y) t))
double code(double x, double y, double z, double t) {
return (-z * y) - t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (-z * y) - t
end function
public static double code(double x, double y, double z, double t) {
return (-z * y) - t;
}
def code(x, y, z, t): return (-z * y) - t
function code(x, y, z, t) return Float64(Float64(Float64(-z) * y) - t) end
function tmp = code(x, y, z, t) tmp = (-z * y) - t; end
code[x_, y_, z_, t_] := N[(N[((-z) * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(-z\right) \cdot y - t
\end{array}
Initial program 90.8%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower--.f6498.5
Applied rewrites98.5%
Taylor expanded in z around inf
Applied rewrites51.4%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 90.8%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6441.8
Applied rewrites41.8%
herbie shell --seed 2025016
(FPCore (x y z t)
:name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
:precision binary64
(- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))