
(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 13 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 (- y) (- z 1.0) (* (log y) (- x 1.0))) t))
double code(double x, double y, double z, double t) {
return fma(-y, (z - 1.0), (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-y), Float64(z - 1.0), Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[((-y) * N[(z - 1.0), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z - 1, \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 89.3%
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%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (fma (- y) z (* (log y) x)) t)))
(if (<= x -17500.0)
t_1
(if (<= x 4.2e-8) (- (fma (- y) (- z 1.0) (- (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 <= -17500.0) {
tmp = t_1;
} else if (x <= 4.2e-8) {
tmp = fma(-y, (z - 1.0), -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 <= -17500.0) tmp = t_1; elseif (x <= 4.2e-8) tmp = Float64(fma(Float64(-y), Float64(z - 1.0), 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, -17500.0], t$95$1, If[LessEqual[x, 4.2e-8], N[(N[((-y) * N[(z - 1.0), $MachinePrecision] + (-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 -17500:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(-y, z - 1, -\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -17500 or 4.19999999999999989e-8 < 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.3
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites98.1%
Taylor expanded in z around inf
Applied rewrites98.1%
if -17500 < x < 4.19999999999999989e-8Initial program 84.9%
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 x around 0
mul-1-negN/A
lower-neg.f64N/A
lift-log.f6498.4
Applied rewrites98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (fma (- y) z (* (log y) x)) t)))
(if (<= z -7.8e+167)
t_1
(if (<= z 3.9e+123) (- (fma (log y) (- x 1.0) 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 (z <= -7.8e+167) {
tmp = t_1;
} else if (z <= 3.9e+123) {
tmp = fma(log(y), (x - 1.0), 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 (z <= -7.8e+167) tmp = t_1; elseif (z <= 3.9e+123) tmp = Float64(fma(log(y), Float64(x - 1.0), 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[z, -7.8e+167], t$95$1, If[LessEqual[z, 3.9e+123], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + y), $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}\;z \leq -7.8 \cdot 10^{+167}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+123}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x - 1, y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.7999999999999996e167 or 3.89999999999999993e123 < z Initial program 66.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--.f6498.2
Applied rewrites98.2%
Taylor expanded in x around inf
Applied rewrites90.6%
Taylor expanded in z around inf
Applied rewrites90.6%
if -7.7999999999999996e167 < z < 3.89999999999999993e123Initial program 97.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.5
Applied rewrites99.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6496.9
Applied rewrites96.9%
(FPCore (x y z t) :precision binary64 (if (<= z -7.2e+199) (- (* (- y) z) t) (- (fma (log y) (- x 1.0) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e+199) {
tmp = (-y * z) - t;
} else {
tmp = fma(log(y), (x - 1.0), y) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -7.2e+199) tmp = Float64(Float64(Float64(-y) * z) - t); else tmp = Float64(fma(log(y), Float64(x - 1.0), y) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.2e+199], N[(N[((-y) * z), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+199}:\\
\;\;\;\;\left(-y\right) \cdot z - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x - 1, y\right) - t\\
\end{array}
\end{array}
if z < -7.20000000000000002e199Initial program 59.1%
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.1
Applied rewrites98.1%
Taylor expanded in z around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f6467.0
Applied rewrites67.0%
if -7.20000000000000002e199 < z Initial program 92.2%
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.3
Applied rewrites99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6491.4
Applied rewrites91.4%
(FPCore (x y z t) :precision binary64 (if (<= z -7.2e+199) (- (* (- y) z) t) (- (* (log y) (- x 1.0)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e+199) {
tmp = (-y * z) - t;
} else {
tmp = (log(y) * (x - 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 (z <= (-7.2d+199)) then
tmp = (-y * z) - t
else
tmp = (log(y) * (x - 1.0d0)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e+199) {
tmp = (-y * z) - t;
} else {
tmp = (Math.log(y) * (x - 1.0)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.2e+199: tmp = (-y * z) - t else: tmp = (math.log(y) * (x - 1.0)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.2e+199) tmp = Float64(Float64(Float64(-y) * z) - t); else tmp = Float64(Float64(log(y) * Float64(x - 1.0)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.2e+199) tmp = (-y * z) - t; else tmp = (log(y) * (x - 1.0)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.2e+199], N[(N[((-y) * z), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+199}:\\
\;\;\;\;\left(-y\right) \cdot z - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x - 1\right) - t\\
\end{array}
\end{array}
if z < -7.20000000000000002e199Initial program 59.1%
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.1
Applied rewrites98.1%
Taylor expanded in z around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lift-neg.f6467.0
Applied rewrites67.0%
if -7.20000000000000002e199 < z Initial program 92.2%
Taylor expanded in y around 0
lower-*.f64N/A
lift-log.f64N/A
lift--.f6491.3
Applied rewrites91.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* (log y) x) t))) (if (<= x -17500.0) t_1 (if (<= x 4.2e-8) (- (- 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 <= -17500.0) {
tmp = t_1;
} else if (x <= 4.2e-8) {
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 <= (-17500.0d0)) then
tmp = t_1
else if (x <= 4.2d-8) 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 <= -17500.0) {
tmp = t_1;
} else if (x <= 4.2e-8) {
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 <= -17500.0: tmp = t_1 elif x <= 4.2e-8: 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 <= -17500.0) tmp = t_1; elseif (x <= 4.2e-8) 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 <= -17500.0) tmp = t_1; elseif (x <= 4.2e-8) 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, -17500.0], t$95$1, If[LessEqual[x, 4.2e-8], 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 -17500:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-8}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -17500 or 4.19999999999999989e-8 < x Initial program 93.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6492.0
Applied rewrites92.0%
if -17500 < x < 4.19999999999999989e-8Initial program 84.9%
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--.f6483.5
Applied rewrites83.5%
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.f6482.9
Applied rewrites82.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x))
(t_2 (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y))))))
(if (<= t_2 -5e+122)
t_1
(if (<= t_2 100.0)
(- (* (- y) (- z 1.0)) t)
(if (<= t_2 1e+46) (- (- (log y)) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double t_2 = ((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)));
double tmp;
if (t_2 <= -5e+122) {
tmp = t_1;
} else if (t_2 <= 100.0) {
tmp = (-y * (z - 1.0)) - t;
} else if (t_2 <= 1e+46) {
tmp = -log(y) - t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = log(y) * x
t_2 = ((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))
if (t_2 <= (-5d+122)) then
tmp = t_1
else if (t_2 <= 100.0d0) then
tmp = (-y * (z - 1.0d0)) - t
else if (t_2 <= 1d+46) then
tmp = -log(y) - t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * x;
double t_2 = ((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)));
double tmp;
if (t_2 <= -5e+122) {
tmp = t_1;
} else if (t_2 <= 100.0) {
tmp = (-y * (z - 1.0)) - t;
} else if (t_2 <= 1e+46) {
tmp = -Math.log(y) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x t_2 = ((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y))) tmp = 0 if t_2 <= -5e+122: tmp = t_1 elif t_2 <= 100.0: tmp = (-y * (z - 1.0)) - t elif t_2 <= 1e+46: tmp = -math.log(y) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) t_2 = Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) tmp = 0.0 if (t_2 <= -5e+122) tmp = t_1; elseif (t_2 <= 100.0) tmp = Float64(Float64(Float64(-y) * Float64(z - 1.0)) - t); elseif (t_2 <= 1e+46) tmp = Float64(Float64(-log(y)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; t_2 = ((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y))); tmp = 0.0; if (t_2 <= -5e+122) tmp = t_1; elseif (t_2 <= 100.0) tmp = (-y * (z - 1.0)) - t; elseif (t_2 <= 1e+46) tmp = -log(y) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+122], t$95$1, If[LessEqual[t$95$2, 100.0], N[(N[((-y) * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 1e+46], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
t_2 := \left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 100:\\
\;\;\;\;\left(-y\right) \cdot \left(z - 1\right) - t\\
\mathbf{elif}\;t\_2 \leq 10^{+46}:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -4.99999999999999989e122 or 9.9999999999999999e45 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) Initial program 95.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6474.2
Applied rewrites74.2%
if -4.99999999999999989e122 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 100Initial program 83.7%
Taylor expanded in y around 0
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6498.9
Applied rewrites98.9%
Taylor expanded in y around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f64N/A
lift--.f6455.1
Applied rewrites55.1%
if 100 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 9.9999999999999999e45Initial program 86.7%
Taylor expanded in y around 0
lower-*.f64N/A
lift-log.f64N/A
lift--.f6486.7
Applied rewrites86.7%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f64N/A
lift-log.f6483.1
Applied rewrites83.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* (- y) (- z 1.0)) t))) (if (<= t -4.6e-45) t_1 (if (<= t 235000000000.0) (* (log y) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (-y * (z - 1.0)) - t;
double tmp;
if (t <= -4.6e-45) {
tmp = t_1;
} else if (t <= 235000000000.0) {
tmp = log(y) * x;
} 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 = (-y * (z - 1.0d0)) - t
if (t <= (-4.6d-45)) then
tmp = t_1
else if (t <= 235000000000.0d0) then
tmp = log(y) * x
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 = (-y * (z - 1.0)) - t;
double tmp;
if (t <= -4.6e-45) {
tmp = t_1;
} else if (t <= 235000000000.0) {
tmp = Math.log(y) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-y * (z - 1.0)) - t tmp = 0 if t <= -4.6e-45: tmp = t_1 elif t <= 235000000000.0: tmp = math.log(y) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(-y) * Float64(z - 1.0)) - t) tmp = 0.0 if (t <= -4.6e-45) tmp = t_1; elseif (t <= 235000000000.0) tmp = Float64(log(y) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (-y * (z - 1.0)) - t; tmp = 0.0; if (t <= -4.6e-45) tmp = t_1; elseif (t <= 235000000000.0) tmp = log(y) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[((-y) * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t, -4.6e-45], t$95$1, If[LessEqual[t, 235000000000.0], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot \left(z - 1\right) - t\\
\mathbf{if}\;t \leq -4.6 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 235000000000:\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.59999999999999983e-45 or 2.35e11 < t 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.5
Applied rewrites99.5%
Taylor expanded in y around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f64N/A
lift--.f6472.2
Applied rewrites72.2%
if -4.59999999999999983e-45 < t < 2.35e11Initial program 84.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6446.8
Applied rewrites46.8%
(FPCore (x y z t) :precision binary64 (- (* (- y) (- z 1.0)) t))
double code(double x, double y, double z, double t) {
return (-y * (z - 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 = (-y * (z - 1.0d0)) - t
end function
public static double code(double x, double y, double z, double t) {
return (-y * (z - 1.0)) - t;
}
def code(x, y, z, t): return (-y * (z - 1.0)) - t
function code(x, y, z, t) return Float64(Float64(Float64(-y) * Float64(z - 1.0)) - t) end
function tmp = code(x, y, z, t) tmp = (-y * (z - 1.0)) - t; end
code[x_, y_, z_, t_] := N[(N[((-y) * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(-y\right) \cdot \left(z - 1\right) - t
\end{array}
Initial program 89.3%
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 y around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f64N/A
lift--.f6446.7
Applied rewrites46.7%
(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 89.3%
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.5
Applied rewrites46.5%
(FPCore (x y z t) :precision binary64 (if (<= t -440000000000.0) (- t) (if (<= t 6.4e+16) (* (- y) z) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -440000000000.0) {
tmp = -t;
} else if (t <= 6.4e+16) {
tmp = -y * z;
} 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 <= (-440000000000.0d0)) then
tmp = -t
else if (t <= 6.4d+16) then
tmp = -y * z
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 <= -440000000000.0) {
tmp = -t;
} else if (t <= 6.4e+16) {
tmp = -y * z;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -440000000000.0: tmp = -t elif t <= 6.4e+16: tmp = -y * z else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -440000000000.0) tmp = Float64(-t); elseif (t <= 6.4e+16) tmp = Float64(Float64(-y) * z); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -440000000000.0) tmp = -t; elseif (t <= 6.4e+16) tmp = -y * z; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -440000000000.0], (-t), If[LessEqual[t, 6.4e+16], N[((-y) * z), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -440000000000:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 6.4 \cdot 10^{+16}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -4.4e11 or 6.4e16 < t Initial program 94.8%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6472.2
Applied rewrites72.2%
if -4.4e11 < t < 6.4e16Initial program 84.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f643.9
Applied rewrites3.9%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6417.4
Applied rewrites17.4%
(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 89.3%
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--.f6488.3
Applied rewrites88.3%
Taylor expanded in y around inf
Applied rewrites36.7%
(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 89.3%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6436.4
Applied rewrites36.4%
herbie shell --seed 2025101
(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))