
(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 22 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.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.f6499.8
Applied rewrites99.8%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (- x 1.0) (log y))
(*
(fma
(* y y)
(* (- z 1.0) (fma -0.25 y -0.3333333333333333))
(* (- z 1.0) (fma -0.5 y -1.0)))
y))
t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + (fma((y * y), ((z - 1.0) * fma(-0.25, y, -0.3333333333333333)), ((z - 1.0) * fma(-0.5, y, -1.0))) * y)) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(fma(Float64(y * y), Float64(Float64(z - 1.0) * fma(-0.25, y, -0.3333333333333333)), Float64(Float64(z - 1.0) * fma(-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[(N[(y * y), $MachinePrecision] * N[(N[(z - 1.0), $MachinePrecision] * N[(-0.25 * y + -0.3333333333333333), $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[(-0.5 * y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(y \cdot y, \left(z - 1\right) \cdot \mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), \left(z - 1\right) \cdot \mathsf{fma}\left(-0.5, y, -1\right)\right) \cdot y\right) - t
\end{array}
Initial program 90.4%
Taylor expanded in y around 0
Applied rewrites99.3%
(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.4%
Taylor expanded in y around 0
Applied rewrites99.3%
(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.4%
Taylor expanded in y around 0
Applied rewrites99.2%
Final simplification99.2%
(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.4%
Taylor expanded in y around 0
Applied rewrites99.2%
(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.4%
Taylor expanded in y around 0
Applied rewrites99.0%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (fma (- y) (- z 1.0) (fma (log y) (- x 1.0) (- t))))
double code(double x, double y, double z, double t) {
return fma(-y, (z - 1.0), fma(log(y), (x - 1.0), -t));
}
function code(x, y, z, t) return fma(Float64(-y), Float64(z - 1.0), fma(log(y), Float64(x - 1.0), Float64(-t))) end
code[x_, y_, z_, t_] := N[((-y) * N[(z - 1.0), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z - 1, \mathsf{fma}\left(\log y, x - 1, -t\right)\right)
\end{array}
Initial program 90.4%
Taylor expanded in y around 0
Applied rewrites98.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (- (* (log y) x) t) (- (* (log y) -1.0) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (log(y) * x) - t;
} else {
tmp = (log(y) * -1.0) - t;
}
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) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (log(y) * x) - t
else
tmp = (log(y) * (-1.0d0)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (Math.log(y) * x) - t;
} else {
tmp = (Math.log(y) * -1.0) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = (math.log(y) * x) - t else: tmp = (math.log(y) * -1.0) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(Float64(log(y) * x) - t); else tmp = Float64(Float64(log(y) * -1.0) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = (log(y) * x) - t; else tmp = (log(y) * -1.0) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * -1.0), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\log y \cdot x - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot -1 - t\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 93.9%
Taylor expanded in x around inf
Applied rewrites90.3%
if -1 < x < 1Initial program 86.8%
Taylor expanded in y around 0
Applied rewrites85.2%
Taylor expanded in x around 0
Applied rewrites84.0%
Final simplification87.2%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -1.35e-31) (not (<= x 220.0)))
(- (* (log y) x) t)
(-
(*
(fma (fma (* (fma -0.25 y -0.3333333333333333) z) y (* -0.5 z)) y (- z))
y)
t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.35e-31) || !(x <= 220.0)) {
tmp = (log(y) * x) - t;
} else {
tmp = (fma(fma((fma(-0.25, y, -0.3333333333333333) * z), y, (-0.5 * z)), y, -z) * y) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.35e-31) || !(x <= 220.0)) tmp = Float64(Float64(log(y) * x) - t); else tmp = Float64(Float64(fma(fma(Float64(fma(-0.25, y, -0.3333333333333333) * z), y, Float64(-0.5 * z)), y, Float64(-z)) * y) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.35e-31], N[Not[LessEqual[x, 220.0]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * z), $MachinePrecision] * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-31} \lor \neg \left(x \leq 220\right):\\
\;\;\;\;\log y \cdot x - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right) \cdot z, y, -0.5 \cdot z\right), y, -z\right) \cdot y - t\\
\end{array}
\end{array}
if x < -1.35000000000000007e-31 or 220 < x Initial program 94.4%
Taylor expanded in x around inf
Applied rewrites87.9%
if -1.35000000000000007e-31 < x < 220Initial program 85.5%
Taylor expanded in z around inf
Applied rewrites44.9%
Taylor expanded in y around 0
Applied rewrites58.9%
Final simplification75.0%
(FPCore (x y z t)
:precision binary64
(if (<= z 1.8e+221)
(- (fma (log y) (- x 1.0) y) t)
(-
(*
(fma (fma (* (fma -0.25 y -0.3333333333333333) z) y (* -0.5 z)) y (- z))
y)
t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.8e+221) {
tmp = fma(log(y), (x - 1.0), y) - t;
} else {
tmp = (fma(fma((fma(-0.25, y, -0.3333333333333333) * z), y, (-0.5 * z)), y, -z) * y) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 1.8e+221) tmp = Float64(fma(log(y), Float64(x - 1.0), y) - t); else tmp = Float64(Float64(fma(fma(Float64(fma(-0.25, y, -0.3333333333333333) * z), y, Float64(-0.5 * z)), y, Float64(-z)) * y) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.8e+221], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * z), $MachinePrecision] * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.8 \cdot 10^{+221}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x - 1, y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right) \cdot z, y, -0.5 \cdot z\right), y, -z\right) \cdot y - t\\
\end{array}
\end{array}
if z < 1.80000000000000004e221Initial program 93.0%
Taylor expanded in y around 0
Applied rewrites98.9%
Taylor expanded in z around 0
Applied rewrites91.9%
if 1.80000000000000004e221 < z Initial program 54.7%
Taylor expanded in z around inf
Applied rewrites37.8%
Taylor expanded in y around 0
Applied rewrites82.8%
Final simplification91.3%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -1.9e+81) (not (<= x 4.5e+48)))
(* (log y) x)
(-
(*
(fma (fma (* (fma -0.25 y -0.3333333333333333) z) y (* -0.5 z)) y (- z))
y)
t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.9e+81) || !(x <= 4.5e+48)) {
tmp = log(y) * x;
} else {
tmp = (fma(fma((fma(-0.25, y, -0.3333333333333333) * z), y, (-0.5 * z)), y, -z) * y) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.9e+81) || !(x <= 4.5e+48)) tmp = Float64(log(y) * x); else tmp = Float64(Float64(fma(fma(Float64(fma(-0.25, y, -0.3333333333333333) * z), y, Float64(-0.5 * z)), y, Float64(-z)) * y) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.9e+81], N[Not[LessEqual[x, 4.5e+48]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * z), $MachinePrecision] * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+81} \lor \neg \left(x \leq 4.5 \cdot 10^{+48}\right):\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right) \cdot z, y, -0.5 \cdot z\right), y, -z\right) \cdot y - t\\
\end{array}
\end{array}
if x < -1.9e81 or 4.49999999999999995e48 < x Initial program 95.9%
Taylor expanded in x around inf
Applied rewrites80.3%
if -1.9e81 < x < 4.49999999999999995e48Initial program 86.9%
Taylor expanded in z around inf
Applied rewrites45.8%
Taylor expanded in y around 0
Applied rewrites58.1%
Final simplification66.8%
(FPCore (x y z t)
:precision binary64
(if (<= z 1.8e+221)
(- (* (log y) (- x 1.0)) t)
(-
(*
(fma (fma (* (fma -0.25 y -0.3333333333333333) z) y (* -0.5 z)) y (- z))
y)
t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.8e+221) {
tmp = (log(y) * (x - 1.0)) - t;
} else {
tmp = (fma(fma((fma(-0.25, y, -0.3333333333333333) * z), y, (-0.5 * z)), y, -z) * y) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 1.8e+221) tmp = Float64(Float64(log(y) * Float64(x - 1.0)) - t); else tmp = Float64(Float64(fma(fma(Float64(fma(-0.25, y, -0.3333333333333333) * z), y, Float64(-0.5 * z)), y, Float64(-z)) * y) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.8e+221], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * z), $MachinePrecision] * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.8 \cdot 10^{+221}:\\
\;\;\;\;\log y \cdot \left(x - 1\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right) \cdot z, y, -0.5 \cdot z\right), y, -z\right) \cdot y - t\\
\end{array}
\end{array}
if z < 1.80000000000000004e221Initial program 93.0%
Taylor expanded in y around 0
Applied rewrites91.8%
if 1.80000000000000004e221 < z Initial program 54.7%
Taylor expanded in z around inf
Applied rewrites37.8%
Taylor expanded in y around 0
Applied rewrites82.8%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (- (* (fma (fma (* (fma -0.25 y -0.3333333333333333) z) y (* -0.5 z)) y (- z)) y) t))
double code(double x, double y, double z, double t) {
return (fma(fma((fma(-0.25, y, -0.3333333333333333) * z), y, (-0.5 * z)), y, -z) * y) - t;
}
function code(x, y, z, t) return Float64(Float64(fma(fma(Float64(fma(-0.25, y, -0.3333333333333333) * z), y, Float64(-0.5 * z)), y, Float64(-z)) * y) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * z), $MachinePrecision] * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right) \cdot z, y, -0.5 \cdot z\right), y, -z\right) \cdot y - t
\end{array}
Initial program 90.4%
Taylor expanded in z around inf
Applied rewrites34.5%
Taylor expanded in y around 0
Applied rewrites43.4%
Final simplification43.4%
(FPCore (x y z t) :precision binary64 (- (* (* (fma (fma (fma -0.25 y -0.3333333333333333) y -0.5) y -1.0) y) z) t))
double code(double x, double y, double z, double t) {
return ((fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y) * z) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y) * z) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * y + -0.5), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\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) \cdot z - t
\end{array}
Initial program 90.4%
Taylor expanded in z around inf
Applied rewrites34.5%
Taylor expanded in y around 0
Applied rewrites43.4%
Applied rewrites43.4%
(FPCore (x y z t) :precision binary64 (- (* (fma (* z (fma -0.3333333333333333 y -0.5)) y (- z)) y) t))
double code(double x, double y, double z, double t) {
return (fma((z * fma(-0.3333333333333333, y, -0.5)), y, -z) * y) - t;
}
function code(x, y, z, t) return Float64(Float64(fma(Float64(z * fma(-0.3333333333333333, y, -0.5)), y, Float64(-z)) * y) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(z * N[(-0.3333333333333333 * y + -0.5), $MachinePrecision]), $MachinePrecision] * y + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z \cdot \mathsf{fma}\left(-0.3333333333333333, y, -0.5\right), y, -z\right) \cdot y - t
\end{array}
Initial program 90.4%
Taylor expanded in z around inf
Applied rewrites34.5%
Taylor expanded in y around 0
Applied rewrites43.3%
Final simplification43.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -13800000.0) (not (<= t 2.35e+20))) (- t) (* (- y) (- z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -13800000.0) || !(t <= 2.35e+20)) {
tmp = -t;
} else {
tmp = -y * (z - 1.0);
}
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) :: tmp
if ((t <= (-13800000.0d0)) .or. (.not. (t <= 2.35d+20))) then
tmp = -t
else
tmp = -y * (z - 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -13800000.0) || !(t <= 2.35e+20)) {
tmp = -t;
} else {
tmp = -y * (z - 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -13800000.0) or not (t <= 2.35e+20): tmp = -t else: tmp = -y * (z - 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -13800000.0) || !(t <= 2.35e+20)) tmp = Float64(-t); else tmp = Float64(Float64(-y) * Float64(z - 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -13800000.0) || ~((t <= 2.35e+20))) tmp = -t; else tmp = -y * (z - 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -13800000.0], N[Not[LessEqual[t, 2.35e+20]], $MachinePrecision]], (-t), N[((-y) * N[(z - 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -13800000 \lor \neg \left(t \leq 2.35 \cdot 10^{+20}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot \left(z - 1\right)\\
\end{array}
\end{array}
if t < -1.38e7 or 2.35e20 < t Initial program 92.8%
Taylor expanded in t around inf
Applied rewrites68.5%
if -1.38e7 < t < 2.35e20Initial program 88.5%
Taylor expanded in y around 0
Applied rewrites98.8%
Taylor expanded in y around inf
Applied rewrites14.8%
Final simplification39.5%
(FPCore (x y z t) :precision binary64 (- (* (* (- (* -0.5 y) 1.0) y) z) t))
double code(double x, double y, double z, double t) {
return ((((-0.5 * y) - 1.0) * y) * z) - 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) * y) * z) - t
end function
public static double code(double x, double y, double z, double t) {
return ((((-0.5 * y) - 1.0) * y) * z) - t;
}
def code(x, y, z, t): return ((((-0.5 * y) - 1.0) * y) * z) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * y) * z) - t) end
function tmp = code(x, y, z, t) tmp = ((((-0.5 * y) - 1.0) * y) * z) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-0.5 \cdot y - 1\right) \cdot y\right) \cdot z - t
\end{array}
Initial program 90.4%
Taylor expanded in z around inf
Applied rewrites34.5%
Taylor expanded in y around 0
Applied rewrites43.0%
Final simplification43.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -25000000000000.0) (not (<= t 2.35e+20))) (- t) (* (- y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -25000000000000.0) || !(t <= 2.35e+20)) {
tmp = -t;
} else {
tmp = -y * z;
}
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) :: tmp
if ((t <= (-25000000000000.0d0)) .or. (.not. (t <= 2.35d+20))) then
tmp = -t
else
tmp = -y * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -25000000000000.0) || !(t <= 2.35e+20)) {
tmp = -t;
} else {
tmp = -y * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -25000000000000.0) or not (t <= 2.35e+20): tmp = -t else: tmp = -y * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -25000000000000.0) || !(t <= 2.35e+20)) tmp = Float64(-t); else tmp = Float64(Float64(-y) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -25000000000000.0) || ~((t <= 2.35e+20))) tmp = -t; else tmp = -y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -25000000000000.0], N[Not[LessEqual[t, 2.35e+20]], $MachinePrecision]], (-t), N[((-y) * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -25000000000000 \lor \neg \left(t \leq 2.35 \cdot 10^{+20}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\end{array}
\end{array}
if t < -2.5e13 or 2.35e20 < t Initial program 92.6%
Taylor expanded in t around inf
Applied rewrites69.6%
if -2.5e13 < t < 2.35e20Initial program 88.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.7
Applied rewrites99.7%
Taylor expanded in z around inf
Applied rewrites15.1%
Taylor expanded in y around 0
Applied rewrites14.2%
Final simplification39.3%
(FPCore (x y z t) :precision binary64 (- (* (* z (fma -0.5 y -1.0)) y) t))
double code(double x, double y, double z, double t) {
return ((z * fma(-0.5, y, -1.0)) * y) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(z * fma(-0.5, y, -1.0)) * y) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(z * N[(-0.5 * y + -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(z \cdot \mathsf{fma}\left(-0.5, y, -1\right)\right) \cdot y - t
\end{array}
Initial program 90.4%
Taylor expanded in z around inf
Applied rewrites34.5%
Taylor expanded in y around 0
Applied rewrites43.0%
Final simplification43.0%
(FPCore (x y z t) :precision binary64 (fma (- y) (- z 1.0) (- t)))
double code(double x, double y, double z, double t) {
return fma(-y, (z - 1.0), -t);
}
function code(x, y, z, t) return fma(Float64(-y), Float64(z - 1.0), Float64(-t)) end
code[x_, y_, z_, t_] := N[((-y) * N[(z - 1.0), $MachinePrecision] + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z - 1, -t\right)
\end{array}
Initial program 90.4%
Taylor expanded in y around 0
Applied rewrites98.8%
Taylor expanded in t around inf
Applied rewrites42.9%
(FPCore (x y z t) :precision binary64 (- (* (- y) z) t))
double code(double x, double y, double z, double t) {
return (-y * z) - 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 = (-y * z) - t
end function
public static double code(double x, double y, double z, double t) {
return (-y * z) - t;
}
def code(x, y, z, t): return (-y * z) - t
function code(x, y, z, t) return Float64(Float64(Float64(-y) * z) - t) end
function tmp = code(x, y, z, t) tmp = (-y * z) - t; end
code[x_, y_, z_, t_] := N[(N[((-y) * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(-y\right) \cdot z - t
\end{array}
Initial program 90.4%
Taylor expanded in z around inf
Applied rewrites34.5%
Taylor expanded in y around 0
Applied rewrites42.8%
Final simplification42.8%
(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.4%
Taylor expanded in t around inf
Applied rewrites33.1%
herbie shell --seed 2025019
(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))