
(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}
Herbie found 26 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
(fma
(- x 1.0)
(log y)
(-
(*
(- z 1.0)
(* (- (* (- (* (- (* -0.25 y) 0.3333333333333333) y) 0.5) y) 1.0) y))
t)))
double code(double x, double y, double z, double t) {
return fma((x - 1.0), log(y), (((z - 1.0) * (((((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) - 1.0) * y)) - t));
}
function code(x, y, z, t) return fma(Float64(x - 1.0), log(y), Float64(Float64(Float64(z - 1.0) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) - 1.0) * y)) - t)) end
code[x_, y_, z_, t_] := N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(N[(z - 1.0), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(-0.25 * y), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * y), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \left(\left(\left(\left(-0.25 \cdot y - 0.3333333333333333\right) \cdot y - 0.5\right) \cdot y - 1\right) \cdot y\right) - t\right)
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f64N/A
lower--.f6499.6
Applied rewrites99.6%
(FPCore (x y z t) :precision binary64 (fma (- x 1.0) (log y) (- (* (- z 1.0) (* (- (* (- (* -0.3333333333333333 y) 0.5) y) 1.0) y)) t)))
double code(double x, double y, double z, double t) {
return fma((x - 1.0), log(y), (((z - 1.0) * (((((-0.3333333333333333 * y) - 0.5) * y) - 1.0) * y)) - t));
}
function code(x, y, z, t) return fma(Float64(x - 1.0), log(y), Float64(Float64(Float64(z - 1.0) * Float64(Float64(Float64(Float64(Float64(-0.3333333333333333 * y) - 0.5) * y) - 1.0) * y)) - t)) end
code[x_, y_, z_, t_] := N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(N[(z - 1.0), $MachinePrecision] * N[(N[(N[(N[(N[(-0.3333333333333333 * y), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot y - 0.5\right) \cdot y - 1\right) \cdot y\right) - t\right)
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in y around 0
Applied rewrites99.6%
(FPCore (x y z t) :precision binary64 (fma (- (fma (* -0.5 y) (- z 1.0) 1.0) z) y (- (* (log y) (- x 1.0)) t)))
double code(double x, double y, double z, double t) {
return fma((fma((-0.5 * y), (z - 1.0), 1.0) - z), y, ((log(y) * (x - 1.0)) - t));
}
function code(x, y, z, t) return fma(Float64(fma(Float64(-0.5 * y), Float64(z - 1.0), 1.0) - z), y, Float64(Float64(log(y) * Float64(x - 1.0)) - t)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-0.5 * y), $MachinePrecision] * N[(z - 1.0), $MachinePrecision] + 1.0), $MachinePrecision] - z), $MachinePrecision] * y + N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z - 1, 1\right) - z, y, \log y \cdot \left(x - 1\right) - t\right)
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lift-*.f64N/A
lift--.f6499.5
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (fma (fma (* -0.5 y) z (- (- z 1.0))) y (- (* (log y) (- x 1.0)) t)))
double code(double x, double y, double z, double t) {
return fma(fma((-0.5 * y), z, -(z - 1.0)), y, ((log(y) * (x - 1.0)) - t));
}
function code(x, y, z, t) return fma(fma(Float64(-0.5 * y), z, Float64(-Float64(z - 1.0))), y, Float64(Float64(log(y) * Float64(x - 1.0)) - t)) end
code[x_, y_, z_, t_] := N[(N[(N[(-0.5 * y), $MachinePrecision] * z + (-N[(z - 1.0), $MachinePrecision])), $MachinePrecision] * y + N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, -\left(z - 1\right)\right), y, \log y \cdot \left(x - 1\right) - t\right)
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in z around inf
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (fma (* (- (* -0.5 y) 1.0) z) y (- (* (log y) (- x 1.0)) t)))
double code(double x, double y, double z, double t) {
return fma((((-0.5 * y) - 1.0) * z), y, ((log(y) * (x - 1.0)) - t));
}
function code(x, y, z, t) return fma(Float64(Float64(Float64(-0.5 * y) - 1.0) * z), y, Float64(Float64(log(y) * Float64(x - 1.0)) - t)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y + N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(-0.5 \cdot y - 1\right) \cdot z, y, \log y \cdot \left(x - 1\right) - t\right)
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lift-*.f6499.4
Applied rewrites99.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (fma (- y) z (* (log y) x)) t)))
(if (<= x -9000000.0)
t_1
(if (<= x 2.2e-6) (- (fma (- 1.0 z) y (- (log y))) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(-y, z, (log(y) * x)) - t;
double tmp;
if (x <= -9000000.0) {
tmp = t_1;
} else if (x <= 2.2e-6) {
tmp = fma((1.0 - z), y, -log(y)) - t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(Float64(-y), z, Float64(log(y) * x)) - t) tmp = 0.0 if (x <= -9000000.0) tmp = t_1; elseif (x <= 2.2e-6) tmp = Float64(fma(Float64(1.0 - z), y, Float64(-log(y))) - t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[((-y) * z + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -9000000.0], t$95$1, If[LessEqual[x, 2.2e-6], N[(N[(N[(1.0 - z), $MachinePrecision] * y + (-N[Log[y], $MachinePrecision])), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-y, z, \log y \cdot x\right) - t\\
\mathbf{if}\;x \leq -9000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(1 - z, y, -\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9e6 or 2.2000000000000001e-6 < x Initial program 93.8%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.4
Applied rewrites99.4%
Taylor expanded in z around inf
Applied rewrites99.4%
Taylor expanded in x around inf
Applied rewrites98.5%
if -9e6 < x < 2.2000000000000001e-6Initial program 83.4%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.4
Applied rewrites99.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-subN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6410.9
Applied rewrites10.9%
Taylor expanded in x around 0
lower--.f64N/A
Applied rewrites98.2%
Taylor expanded in y around 0
Applied rewrites97.8%
(FPCore (x y z t)
:precision binary64
(if (<= x -15500000.0)
(- (* (log y) x) t)
(if (<= x 15000000000000.0)
(- (fma (- 1.0 z) y (- (log y))) t)
(- (* (log y) (- x 1.0)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -15500000.0) {
tmp = (log(y) * x) - t;
} else if (x <= 15000000000000.0) {
tmp = fma((1.0 - z), y, -log(y)) - t;
} else {
tmp = (log(y) * (x - 1.0)) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -15500000.0) tmp = Float64(Float64(log(y) * x) - t); elseif (x <= 15000000000000.0) tmp = Float64(fma(Float64(1.0 - z), y, Float64(-log(y))) - t); else tmp = Float64(Float64(log(y) * Float64(x - 1.0)) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -15500000.0], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 15000000000000.0], N[(N[(N[(1.0 - z), $MachinePrecision] * y + (-N[Log[y], $MachinePrecision])), $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}\;x \leq -15500000:\\
\;\;\;\;\log y \cdot x - t\\
\mathbf{elif}\;x \leq 15000000000000:\\
\;\;\;\;\mathsf{fma}\left(1 - z, y, -\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x - 1\right) - t\\
\end{array}
\end{array}
if x < -1.55e7Initial program 93.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6492.8
Applied rewrites92.8%
if -1.55e7 < x < 1.5e13Initial program 83.4%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.4
Applied rewrites99.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-subN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6410.8
Applied rewrites10.8%
Taylor expanded in x around 0
lower--.f64N/A
Applied rewrites97.2%
Taylor expanded in y around 0
Applied rewrites96.9%
if 1.5e13 < x Initial program 94.6%
Taylor expanded in y around 0
lower-*.f64N/A
lift-log.f64N/A
lift--.f6494.0
Applied rewrites94.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -15500000.0)
(- (* (log y) x) t)
(if (<= x 15000000000000.0)
(- (fma (- y) z (- (log y))) t)
(- (* (log y) (- x 1.0)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -15500000.0) {
tmp = (log(y) * x) - t;
} else if (x <= 15000000000000.0) {
tmp = fma(-y, z, -log(y)) - t;
} else {
tmp = (log(y) * (x - 1.0)) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -15500000.0) tmp = Float64(Float64(log(y) * x) - t); elseif (x <= 15000000000000.0) tmp = Float64(fma(Float64(-y), z, Float64(-log(y))) - t); else tmp = Float64(Float64(log(y) * Float64(x - 1.0)) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -15500000.0], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 15000000000000.0], N[(N[((-y) * z + (-N[Log[y], $MachinePrecision])), $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}\;x \leq -15500000:\\
\;\;\;\;\log y \cdot x - t\\
\mathbf{elif}\;x \leq 15000000000000:\\
\;\;\;\;\mathsf{fma}\left(-y, z, -\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x - 1\right) - t\\
\end{array}
\end{array}
if x < -1.55e7Initial program 93.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6492.8
Applied rewrites92.8%
if -1.55e7 < x < 1.5e13Initial program 83.4%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.0
Applied rewrites99.0%
Taylor expanded in z around inf
Applied rewrites98.9%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f64N/A
lift-log.f6496.7
Applied rewrites96.7%
if 1.5e13 < x Initial program 94.6%
Taylor expanded in y around 0
lower-*.f64N/A
lift-log.f64N/A
lift--.f6494.0
Applied rewrites94.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -9e+70)
t_1
(if (<= x 6.6e-22)
(- (- y (log y)) t)
(if (<= x 1.3e+67)
(fma (fma (* -0.5 y) z (- (- z 1.0))) y (- t))
t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -9e+70) {
tmp = t_1;
} else if (x <= 6.6e-22) {
tmp = (y - log(y)) - t;
} else if (x <= 1.3e+67) {
tmp = fma(fma((-0.5 * y), z, -(z - 1.0)), y, -t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -9e+70) tmp = t_1; elseif (x <= 6.6e-22) tmp = Float64(Float64(y - log(y)) - t); elseif (x <= 1.3e+67) tmp = fma(fma(Float64(-0.5 * y), z, Float64(-Float64(z - 1.0))), y, Float64(-t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -9e+70], t$95$1, If[LessEqual[x, 6.6e-22], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 1.3e+67], N[(N[(N[(-0.5 * y), $MachinePrecision] * z + (-N[(z - 1.0), $MachinePrecision])), $MachinePrecision] * y + (-t)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -9 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-22}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, -\left(z - 1\right)\right), y, -t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.9999999999999999e70 or 1.3e67 < x Initial program 96.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6476.6
Applied rewrites76.6%
if -8.9999999999999999e70 < x < 6.6000000000000002e-22Initial program 83.6%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.1
Applied rewrites99.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6482.4
Applied rewrites82.4%
Taylor expanded in x around 0
fp-cancel-sign-sub-invN/A
metadata-evalN/A
log-pow-revN/A
unpow1N/A
lower--.f64N/A
lift-log.f6477.5
Applied rewrites77.5%
if 6.6000000000000002e-22 < x < 1.3e67Initial program 86.2%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.4
Applied rewrites99.4%
Taylor expanded in z around inf
Applied rewrites99.3%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6454.8
Applied rewrites54.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -9e+70)
t_1
(if (<= x 6.6e-22)
(- (- (log y)) t)
(if (<= x 1.3e+67)
(fma (fma (* -0.5 y) z (- (- z 1.0))) y (- t))
t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -9e+70) {
tmp = t_1;
} else if (x <= 6.6e-22) {
tmp = -log(y) - t;
} else if (x <= 1.3e+67) {
tmp = fma(fma((-0.5 * y), z, -(z - 1.0)), y, -t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -9e+70) tmp = t_1; elseif (x <= 6.6e-22) tmp = Float64(Float64(-log(y)) - t); elseif (x <= 1.3e+67) tmp = fma(fma(Float64(-0.5 * y), z, Float64(-Float64(z - 1.0))), y, Float64(-t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -9e+70], t$95$1, If[LessEqual[x, 6.6e-22], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], If[LessEqual[x, 1.3e+67], N[(N[(N[(-0.5 * y), $MachinePrecision] * z + (-N[(z - 1.0), $MachinePrecision])), $MachinePrecision] * y + (-t)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -9 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-22}:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, -\left(z - 1\right)\right), y, -t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.9999999999999999e70 or 1.3e67 < x Initial program 96.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6476.6
Applied rewrites76.6%
if -8.9999999999999999e70 < x < 6.6000000000000002e-22Initial program 83.6%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-subN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6410.7
Applied rewrites10.7%
Taylor expanded in x around 0
lower--.f64N/A
Applied rewrites94.4%
Taylor expanded in y around 0
mul-1-negN/A
lift-log.f64N/A
lift-neg.f6477.4
Applied rewrites77.4%
if 6.6000000000000002e-22 < x < 1.3e67Initial program 86.2%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.4
Applied rewrites99.4%
Taylor expanded in z around inf
Applied rewrites99.3%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6454.8
Applied rewrites54.8%
(FPCore (x y z t)
:precision binary64
(if (<= (- z 1.0) -1e+121)
(- (* (- y) z) t)
(if (<= (- z 1.0) 1e+178)
(- (- (log y)) t)
(fma (fma (* -0.5 y) z (- z)) y (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z - 1.0) <= -1e+121) {
tmp = (-y * z) - t;
} else if ((z - 1.0) <= 1e+178) {
tmp = -log(y) - t;
} else {
tmp = fma(fma((-0.5 * y), z, -z), y, -t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z - 1.0) <= -1e+121) tmp = Float64(Float64(Float64(-y) * z) - t); elseif (Float64(z - 1.0) <= 1e+178) tmp = Float64(Float64(-log(y)) - t); else tmp = fma(fma(Float64(-0.5 * y), z, Float64(-z)), y, Float64(-t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z - 1.0), $MachinePrecision], -1e+121], N[(N[((-y) * z), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(z - 1.0), $MachinePrecision], 1e+178], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], N[(N[(N[(-0.5 * y), $MachinePrecision] * z + (-z)), $MachinePrecision] * y + (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - 1 \leq -1 \cdot 10^{+121}:\\
\;\;\;\;\left(-y\right) \cdot z - t\\
\mathbf{elif}\;z - 1 \leq 10^{+178}:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, -z\right), y, -t\right)\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < -1.00000000000000004e121Initial program 67.0%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6498.6
Applied rewrites98.6%
Taylor expanded in z around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f6462.6
Applied rewrites62.6%
if -1.00000000000000004e121 < (-.f64 z #s(literal 1 binary64)) < 1.0000000000000001e178Initial program 97.2%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.6
Applied rewrites99.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-subN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f645.1
Applied rewrites5.1%
Taylor expanded in x around 0
lower--.f64N/A
Applied rewrites62.9%
Taylor expanded in y around 0
mul-1-negN/A
lift-log.f64N/A
lift-neg.f6459.9
Applied rewrites59.9%
if 1.0000000000000001e178 < (-.f64 z #s(literal 1 binary64)) Initial program 60.4%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.1
Applied rewrites99.1%
Taylor expanded in z around inf
Applied rewrites99.1%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6467.3
Applied rewrites67.3%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6467.3
Applied rewrites67.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* (log y) x) t))) (if (<= x -9000000.0) t_1 (if (<= x 2.2e-6) (- (- y (log y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - t;
double tmp;
if (x <= -9000000.0) {
tmp = t_1;
} else if (x <= 2.2e-6) {
tmp = (y - 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) :: tmp
t_1 = (log(y) * x) - t
if (x <= (-9000000.0d0)) then
tmp = t_1
else if (x <= 2.2d-6) then
tmp = (y - 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) - t;
double tmp;
if (x <= -9000000.0) {
tmp = t_1;
} else if (x <= 2.2e-6) {
tmp = (y - Math.log(y)) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(y) * x) - t tmp = 0 if x <= -9000000.0: tmp = t_1 elif x <= 2.2e-6: tmp = (y - math.log(y)) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - t) tmp = 0.0 if (x <= -9000000.0) tmp = t_1; elseif (x <= 2.2e-6) tmp = Float64(Float64(y - 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; tmp = 0.0; if (x <= -9000000.0) tmp = t_1; elseif (x <= 2.2e-6) tmp = (y - log(y)) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -9000000.0], t$95$1, If[LessEqual[x, 2.2e-6], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - t\\
\mathbf{if}\;x \leq -9000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9e6 or 2.2000000000000001e-6 < x Initial program 93.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6492.4
Applied rewrites92.4%
if -9e6 < x < 2.2000000000000001e-6Initial program 83.4%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.0
Applied rewrites99.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6482.0
Applied rewrites82.0%
Taylor expanded in x around 0
fp-cancel-sign-sub-invN/A
metadata-evalN/A
log-pow-revN/A
unpow1N/A
lower--.f64N/A
lift-log.f6480.8
Applied rewrites80.8%
(FPCore (x y z t) :precision binary64 (fma (- 1.0 z) y (- (* (log y) (- x 1.0)) t)))
double code(double x, double y, double z, double t) {
return fma((1.0 - z), y, ((log(y) * (x - 1.0)) - t));
}
function code(x, y, z, t) return fma(Float64(1.0 - z), y, Float64(Float64(log(y) * Float64(x - 1.0)) - t)) end
code[x_, y_, z_, t_] := N[(N[(1.0 - z), $MachinePrecision] * y + N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 - z, y, \log y \cdot \left(x - 1\right) - t\right)
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in y around 0
lower--.f6499.2
Applied rewrites99.2%
(FPCore (x y z t) :precision binary64 (- (fma (- y) z (* (log y) (- x 1.0))) t))
double code(double x, double y, double z, double t) {
return fma(-y, z, (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-y), z, Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[((-y) * z + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z, \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.2
Applied rewrites99.2%
Taylor expanded in z around inf
Applied rewrites99.1%
(FPCore (x y z t) :precision binary64 (- (fma (log y) (- x 1.0) y) t))
double code(double x, double y, double z, double t) {
return fma(log(y), (x - 1.0), y) - t;
}
function code(x, y, z, t) return Float64(fma(log(y), Float64(x - 1.0), y) - t) end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x - 1, y\right) - t
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.2
Applied rewrites99.2%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6487.5
Applied rewrites87.5%
(FPCore (x y z t) :precision binary64 (- (* (log y) (- x 1.0)) t))
double code(double x, double y, double z, double t) {
return (log(y) * (x - 1.0)) - 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 = (log(y) * (x - 1.0d0)) - t
end function
public static double code(double x, double y, double z, double t) {
return (Math.log(y) * (x - 1.0)) - t;
}
def code(x, y, z, t): return (math.log(y) * (x - 1.0)) - t
function code(x, y, z, t) return Float64(Float64(log(y) * Float64(x - 1.0)) - t) end
function tmp = code(x, y, z, t) tmp = (log(y) * (x - 1.0)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log y \cdot \left(x - 1\right) - t
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
lower-*.f64N/A
lift-log.f64N/A
lift--.f6487.4
Applied rewrites87.4%
(FPCore (x y z t) :precision binary64 (fma (fma (* (- z 1.0) y) -0.5 (- 1.0 z)) y (- t)))
double code(double x, double y, double z, double t) {
return fma(fma(((z - 1.0) * y), -0.5, (1.0 - z)), y, -t);
}
function code(x, y, z, t) return fma(fma(Float64(Float64(z - 1.0) * y), -0.5, Float64(1.0 - z)), y, Float64(-t)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(z - 1.0), $MachinePrecision] * y), $MachinePrecision] * -0.5 + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * y + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(\left(z - 1\right) \cdot y, -0.5, 1 - z\right), y, -t\right)
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in z around inf
Applied rewrites99.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6447.0
Applied rewrites47.0%
Taylor expanded in y around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate--l+N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
lift--.f6447.0
Applied rewrites47.0%
(FPCore (x y z t) :precision binary64 (fma (fma (* -0.5 y) z (- (- z 1.0))) y (- t)))
double code(double x, double y, double z, double t) {
return fma(fma((-0.5 * y), z, -(z - 1.0)), y, -t);
}
function code(x, y, z, t) return fma(fma(Float64(-0.5 * y), z, Float64(-Float64(z - 1.0))), y, Float64(-t)) end
code[x_, y_, z_, t_] := N[(N[(N[(-0.5 * y), $MachinePrecision] * z + (-N[(z - 1.0), $MachinePrecision])), $MachinePrecision] * y + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, -\left(z - 1\right)\right), y, -t\right)
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in z around inf
Applied rewrites99.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6447.0
Applied rewrites47.0%
(FPCore (x y z t) :precision binary64 (fma (fma (* -0.5 y) z (- z)) y (- t)))
double code(double x, double y, double z, double t) {
return fma(fma((-0.5 * y), z, -z), y, -t);
}
function code(x, y, z, t) return fma(fma(Float64(-0.5 * y), z, Float64(-z)), y, Float64(-t)) end
code[x_, y_, z_, t_] := N[(N[(N[(-0.5 * y), $MachinePrecision] * z + (-z)), $MachinePrecision] * y + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, -z\right), y, -t\right)
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in z around inf
Applied rewrites99.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6447.0
Applied rewrites47.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6446.9
Applied rewrites46.9%
(FPCore (x y z t) :precision binary64 (if (<= t -11000000.0) (- t) (if (<= t 1920000.0) (fma (- y) z y) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -11000000.0) {
tmp = -t;
} else if (t <= 1920000.0) {
tmp = fma(-y, z, y);
} else {
tmp = -t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= -11000000.0) tmp = Float64(-t); elseif (t <= 1920000.0) tmp = fma(Float64(-y), z, y); else tmp = Float64(-t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, -11000000.0], (-t), If[LessEqual[t, 1920000.0], N[((-y) * z + y), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -11000000:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1920000:\\
\;\;\;\;\mathsf{fma}\left(-y, z, y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -1.1e7 or 1.92e6 < t Initial program 93.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6469.7
Applied rewrites69.7%
if -1.1e7 < t < 1.92e6Initial program 83.7%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.3
Applied rewrites99.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-subN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6410.9
Applied rewrites10.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6418.6
Applied rewrites18.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6418.6
Applied rewrites18.6%
(FPCore (x y z t) :precision binary64 (if (<= t -11000000.0) (- t) (if (<= t 1920000.0) (* (- z) y) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -11000000.0) {
tmp = -t;
} else if (t <= 1920000.0) {
tmp = -z * y;
} else {
tmp = -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 (t <= (-11000000.0d0)) then
tmp = -t
else if (t <= 1920000.0d0) then
tmp = -z * y
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -11000000.0) {
tmp = -t;
} else if (t <= 1920000.0) {
tmp = -z * y;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -11000000.0: tmp = -t elif t <= 1920000.0: tmp = -z * y else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -11000000.0) tmp = Float64(-t); elseif (t <= 1920000.0) tmp = Float64(Float64(-z) * y); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -11000000.0) tmp = -t; elseif (t <= 1920000.0) tmp = -z * y; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -11000000.0], (-t), If[LessEqual[t, 1920000.0], N[((-z) * y), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -11000000:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1920000:\\
\;\;\;\;\left(-z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -1.1e7 or 1.92e6 < t Initial program 93.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6469.7
Applied rewrites69.7%
if -1.1e7 < t < 1.92e6Initial program 83.7%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.3
Applied rewrites99.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-subN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6410.9
Applied rewrites10.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6418.6
Applied rewrites18.6%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6418.1
Applied rewrites18.1%
(FPCore (x y z t) :precision binary64 (fma (- 1.0 z) y (- t)))
double code(double x, double y, double z, double t) {
return fma((1.0 - z), y, -t);
}
function code(x, y, z, t) return fma(Float64(1.0 - z), y, Float64(-t)) end
code[x_, y_, z_, t_] := N[(N[(1.0 - z), $MachinePrecision] * y + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 - z, y, -t\right)
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in z around inf
Applied rewrites99.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6447.0
Applied rewrites47.0%
Taylor expanded in y around 0
lift--.f6446.8
Applied rewrites46.8%
(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 88.5%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.2
Applied rewrites99.2%
Taylor expanded in z around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f6446.6
Applied rewrites46.6%
(FPCore (x y z t) :precision binary64 (- y t))
double code(double x, double y, double z, double t) {
return 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 = y - t
end function
public static double code(double x, double y, double z, double t) {
return y - t;
}
def code(x, y, z, t): return y - t
function code(x, y, z, t) return Float64(y - t) end
function tmp = code(x, y, z, t) tmp = y - t; end
code[x_, y_, z_, t_] := N[(y - t), $MachinePrecision]
\begin{array}{l}
\\
y - t
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.2
Applied rewrites99.2%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6487.5
Applied rewrites87.5%
Taylor expanded in y around inf
Applied rewrites35.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 88.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6435.6
Applied rewrites35.6%
(FPCore (x y z t) :precision binary64 y)
double code(double x, double y, double z, double t) {
return 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)
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
end function
public static double code(double x, double y, double z, double t) {
return y;
}
def code(x, y, z, t): return y
function code(x, y, z, t) return y end
function tmp = code(x, y, z, t) tmp = y; end
code[x_, y_, z_, t_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 88.5%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.5
Applied rewrites99.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-subN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f648.1
Applied rewrites8.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6413.7
Applied rewrites13.7%
Taylor expanded in z around 0
Applied rewrites2.9%
herbie shell --seed 2025088
(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))