
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + y) - z;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + y) - z;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
(FPCore (x y z) :precision binary64 (- (- x (- (* (log y) (- y -0.5)) y)) z))
double code(double x, double y, double z) {
return (x - ((log(y) * (y - -0.5)) - y)) - z;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x - ((log(y) * (y - (-0.5d0))) - y)) - z
end function
public static double code(double x, double y, double z) {
return (x - ((Math.log(y) * (y - -0.5)) - y)) - z;
}
def code(x, y, z): return (x - ((math.log(y) * (y - -0.5)) - y)) - z
function code(x, y, z) return Float64(Float64(x - Float64(Float64(log(y) * Float64(y - -0.5)) - y)) - z) end
function tmp = code(x, y, z) tmp = (x - ((log(y) * (y - -0.5)) - y)) - z; end
code[x_, y_, z_] := N[(N[(x - N[(N[(N[Log[y], $MachinePrecision] * N[(y - -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \left(\log y \cdot \left(y - -0.5\right) - y\right)\right) - z
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
*-commutativeN/A
+-commutativeN/A
lower--.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6499.8
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (if (<= y 0.000122) (- (+ (- x (log (sqrt y))) y) z) (- (- x (- (* (log y) y) y)) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.000122) {
tmp = ((x - log(sqrt(y))) + y) - z;
} else {
tmp = (x - ((log(y) * y) - y)) - z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 0.000122d0) then
tmp = ((x - log(sqrt(y))) + y) - z
else
tmp = (x - ((log(y) * y) - y)) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.000122) {
tmp = ((x - Math.log(Math.sqrt(y))) + y) - z;
} else {
tmp = (x - ((Math.log(y) * y) - y)) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.000122: tmp = ((x - math.log(math.sqrt(y))) + y) - z else: tmp = (x - ((math.log(y) * y) - y)) - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.000122) tmp = Float64(Float64(Float64(x - log(sqrt(y))) + y) - z); else tmp = Float64(Float64(x - Float64(Float64(log(y) * y) - y)) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.000122) tmp = ((x - log(sqrt(y))) + y) - z; else tmp = (x - ((log(y) * y) - y)) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.000122], N[(N[(N[(x - N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision], N[(N[(x - N[(N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.000122:\\
\;\;\;\;\left(\left(x - \log \left(\sqrt{y}\right)\right) + y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(x - \left(\log y \cdot y - y\right)\right) - z\\
\end{array}
\end{array}
if y < 1.21999999999999997e-4Initial program 100.0%
Taylor expanded in y around 0
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6499.6
Applied rewrites99.6%
if 1.21999999999999997e-4 < y Initial program 99.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
*-commutativeN/A
+-commutativeN/A
lower--.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6499.7
Applied rewrites99.7%
Taylor expanded in y around inf
Applied rewrites98.8%
(FPCore (x y z) :precision binary64 (if (<= y 5.8e+122) (- (- x (log (sqrt y))) z) (- y (fma (log y) y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.8e+122) {
tmp = (x - log(sqrt(y))) - z;
} else {
tmp = y - fma(log(y), y, z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 5.8e+122) tmp = Float64(Float64(x - log(sqrt(y))) - z); else tmp = Float64(y - fma(log(y), y, z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 5.8e+122], N[(N[(x - N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(y - N[(N[Log[y], $MachinePrecision] * y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.8 \cdot 10^{+122}:\\
\;\;\;\;\left(x - \log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;y - \mathsf{fma}\left(\log y, y, z\right)\\
\end{array}
\end{array}
if y < 5.8000000000000002e122Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6489.5
Applied rewrites89.5%
if 5.8000000000000002e122 < y Initial program 99.6%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6486.7
Applied rewrites86.7%
Taylor expanded in y around inf
Applied rewrites86.7%
(FPCore (x y z) :precision binary64 (if (<= y 5.8e+122) (- (- x (log (sqrt y))) z) (- y (fma (log y) (- y -0.5) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.8e+122) {
tmp = (x - log(sqrt(y))) - z;
} else {
tmp = y - fma(log(y), (y - -0.5), z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 5.8e+122) tmp = Float64(Float64(x - log(sqrt(y))) - z); else tmp = Float64(y - fma(log(y), Float64(y - -0.5), z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 5.8e+122], N[(N[(x - N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(y - N[(N[Log[y], $MachinePrecision] * N[(y - -0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.8 \cdot 10^{+122}:\\
\;\;\;\;\left(x - \log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;y - \mathsf{fma}\left(\log y, y - -0.5, z\right)\\
\end{array}
\end{array}
if y < 5.8000000000000002e122Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6489.5
Applied rewrites89.5%
if 5.8000000000000002e122 < y Initial program 99.6%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6486.7
Applied rewrites86.7%
(FPCore (x y z) :precision binary64 (if (<= y 7e+128) (- (- x (log (sqrt y))) z) (* (- 1.0 (- (- (log y)))) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 7e+128) {
tmp = (x - log(sqrt(y))) - z;
} else {
tmp = (1.0 - -(-log(y))) * y;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 7d+128) then
tmp = (x - log(sqrt(y))) - z
else
tmp = (1.0d0 - -(-log(y))) * y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 7e+128) {
tmp = (x - Math.log(Math.sqrt(y))) - z;
} else {
tmp = (1.0 - -(-Math.log(y))) * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 7e+128: tmp = (x - math.log(math.sqrt(y))) - z else: tmp = (1.0 - -(-math.log(y))) * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 7e+128) tmp = Float64(Float64(x - log(sqrt(y))) - z); else tmp = Float64(Float64(1.0 - Float64(-Float64(-log(y)))) * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 7e+128) tmp = (x - log(sqrt(y))) - z; else tmp = (1.0 - -(-log(y))) * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 7e+128], N[(N[(x - N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(1.0 - (-(-N[Log[y], $MachinePrecision]))), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7 \cdot 10^{+128}:\\
\;\;\;\;\left(x - \log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \left(-\left(-\log y\right)\right)\right) \cdot y\\
\end{array}
\end{array}
if y < 6.99999999999999937e128Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6489.0
Applied rewrites89.0%
if 6.99999999999999937e128 < y Initial program 99.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
log-recN/A
lower-neg.f64N/A
lift-log.f6473.6
Applied rewrites73.6%
(FPCore (x y z) :precision binary64 (if (<= y 7e+128) (- (- x (log (sqrt y))) z) (- y (* y (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 7e+128) {
tmp = (x - log(sqrt(y))) - z;
} else {
tmp = y - (y * log(y));
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 7d+128) then
tmp = (x - log(sqrt(y))) - z
else
tmp = y - (y * log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 7e+128) {
tmp = (x - Math.log(Math.sqrt(y))) - z;
} else {
tmp = y - (y * Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 7e+128: tmp = (x - math.log(math.sqrt(y))) - z else: tmp = y - (y * math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 7e+128) tmp = Float64(Float64(x - log(sqrt(y))) - z); else tmp = Float64(y - Float64(y * log(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 7e+128) tmp = (x - log(sqrt(y))) - z; else tmp = y - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 7e+128], N[(N[(x - N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7 \cdot 10^{+128}:\\
\;\;\;\;\left(x - \log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot \log y\\
\end{array}
\end{array}
if y < 6.99999999999999937e128Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6489.0
Applied rewrites89.0%
if 6.99999999999999937e128 < y Initial program 99.6%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6487.0
Applied rewrites87.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
lift-log.f6473.5
Applied rewrites73.5%
Taylor expanded in y around inf
Applied rewrites73.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (- x (* (+ y 0.5) (log y))) y)))
(if (<= t_0 -2e+122)
(- y (* y (log y)))
(if (<= t_0 -100000000.0)
(- x z)
(if (<= t_0 350.0) (- (- (log (sqrt y))) z) (- x z))))))
double code(double x, double y, double z) {
double t_0 = (x - ((y + 0.5) * log(y))) + y;
double tmp;
if (t_0 <= -2e+122) {
tmp = y - (y * log(y));
} else if (t_0 <= -100000000.0) {
tmp = x - z;
} else if (t_0 <= 350.0) {
tmp = -log(sqrt(y)) - z;
} else {
tmp = x - z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x - ((y + 0.5d0) * log(y))) + y
if (t_0 <= (-2d+122)) then
tmp = y - (y * log(y))
else if (t_0 <= (-100000000.0d0)) then
tmp = x - z
else if (t_0 <= 350.0d0) then
tmp = -log(sqrt(y)) - z
else
tmp = x - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x - ((y + 0.5) * Math.log(y))) + y;
double tmp;
if (t_0 <= -2e+122) {
tmp = y - (y * Math.log(y));
} else if (t_0 <= -100000000.0) {
tmp = x - z;
} else if (t_0 <= 350.0) {
tmp = -Math.log(Math.sqrt(y)) - z;
} else {
tmp = x - z;
}
return tmp;
}
def code(x, y, z): t_0 = (x - ((y + 0.5) * math.log(y))) + y tmp = 0 if t_0 <= -2e+122: tmp = y - (y * math.log(y)) elif t_0 <= -100000000.0: tmp = x - z elif t_0 <= 350.0: tmp = -math.log(math.sqrt(y)) - z else: tmp = x - z return tmp
function code(x, y, z) t_0 = Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) tmp = 0.0 if (t_0 <= -2e+122) tmp = Float64(y - Float64(y * log(y))); elseif (t_0 <= -100000000.0) tmp = Float64(x - z); elseif (t_0 <= 350.0) tmp = Float64(Float64(-log(sqrt(y))) - z); else tmp = Float64(x - z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x - ((y + 0.5) * log(y))) + y; tmp = 0.0; if (t_0 <= -2e+122) tmp = y - (y * log(y)); elseif (t_0 <= -100000000.0) tmp = x - z; elseif (t_0 <= 350.0) tmp = -log(sqrt(y)) - z; else tmp = x - z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+122], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -100000000.0], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 350.0], N[((-N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]) - z), $MachinePrecision], N[(x - z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x - \left(y + 0.5\right) \cdot \log y\right) + y\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+122}:\\
\;\;\;\;y - y \cdot \log y\\
\mathbf{elif}\;t\_0 \leq -100000000:\\
\;\;\;\;x - z\\
\mathbf{elif}\;t\_0 \leq 350:\\
\;\;\;\;\left(-\log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -2.00000000000000003e122Initial program 99.7%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6472.6
Applied rewrites72.6%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
lift-log.f6458.1
Applied rewrites58.1%
Taylor expanded in y around inf
Applied rewrites58.1%
if -2.00000000000000003e122 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -1e8 or 350 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites80.2%
if -1e8 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 350Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6497.5
Applied rewrites97.5%
Taylor expanded in x around 0
mul-1-negN/A
pow1/2N/A
log-pow-revN/A
lower-neg.f64N/A
log-pow-revN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-log.f6496.2
Applied rewrites96.2%
(FPCore (x y z) :precision binary64 (if (<= x -210.0) (- x z) (if (<= x 0.235) (- (- (log (sqrt y))) z) (- x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -210.0) {
tmp = x - z;
} else if (x <= 0.235) {
tmp = -log(sqrt(y)) - z;
} else {
tmp = x - z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-210.0d0)) then
tmp = x - z
else if (x <= 0.235d0) then
tmp = -log(sqrt(y)) - z
else
tmp = x - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -210.0) {
tmp = x - z;
} else if (x <= 0.235) {
tmp = -Math.log(Math.sqrt(y)) - z;
} else {
tmp = x - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -210.0: tmp = x - z elif x <= 0.235: tmp = -math.log(math.sqrt(y)) - z else: tmp = x - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -210.0) tmp = Float64(x - z); elseif (x <= 0.235) tmp = Float64(Float64(-log(sqrt(y))) - z); else tmp = Float64(x - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -210.0) tmp = x - z; elseif (x <= 0.235) tmp = -log(sqrt(y)) - z; else tmp = x - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -210.0], N[(x - z), $MachinePrecision], If[LessEqual[x, 0.235], N[((-N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]) - z), $MachinePrecision], N[(x - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -210:\\
\;\;\;\;x - z\\
\mathbf{elif}\;x \leq 0.235:\\
\;\;\;\;\left(-\log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if x < -210 or 0.23499999999999999 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites76.7%
if -210 < x < 0.23499999999999999Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6463.7
Applied rewrites63.7%
Taylor expanded in x around 0
mul-1-negN/A
pow1/2N/A
log-pow-revN/A
lower-neg.f64N/A
log-pow-revN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-log.f6463.3
Applied rewrites63.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ (- x (* (+ y 0.5) (log y))) y) z)))
(if (<= t_0 -20000000.0)
(- x z)
(if (<= t_0 500.0) (- y (log (sqrt y))) (- x z)))))
double code(double x, double y, double z) {
double t_0 = ((x - ((y + 0.5) * log(y))) + y) - z;
double tmp;
if (t_0 <= -20000000.0) {
tmp = x - z;
} else if (t_0 <= 500.0) {
tmp = y - log(sqrt(y));
} else {
tmp = x - z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((x - ((y + 0.5d0) * log(y))) + y) - z
if (t_0 <= (-20000000.0d0)) then
tmp = x - z
else if (t_0 <= 500.0d0) then
tmp = y - log(sqrt(y))
else
tmp = x - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((x - ((y + 0.5) * Math.log(y))) + y) - z;
double tmp;
if (t_0 <= -20000000.0) {
tmp = x - z;
} else if (t_0 <= 500.0) {
tmp = y - Math.log(Math.sqrt(y));
} else {
tmp = x - z;
}
return tmp;
}
def code(x, y, z): t_0 = ((x - ((y + 0.5) * math.log(y))) + y) - z tmp = 0 if t_0 <= -20000000.0: tmp = x - z elif t_0 <= 500.0: tmp = y - math.log(math.sqrt(y)) else: tmp = x - z return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) tmp = 0.0 if (t_0 <= -20000000.0) tmp = Float64(x - z); elseif (t_0 <= 500.0) tmp = Float64(y - log(sqrt(y))); else tmp = Float64(x - z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((x - ((y + 0.5) * log(y))) + y) - z; tmp = 0.0; if (t_0 <= -20000000.0) tmp = x - z; elseif (t_0 <= 500.0) tmp = y - log(sqrt(y)); else tmp = x - z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$0, -20000000.0], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 500.0], N[(y - N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x - z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\\
\mathbf{if}\;t\_0 \leq -20000000:\\
\;\;\;\;x - z\\
\mathbf{elif}\;t\_0 \leq 500:\\
\;\;\;\;y - \log \left(\sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < -2e7 or 500 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites66.1%
if -2e7 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < 500Initial program 99.9%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6497.2
Applied rewrites97.2%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
log-pow-revN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-log.f6492.4
Applied rewrites92.4%
Taylor expanded in z around 0
lift-sqrt.f64N/A
lift-log.f6489.5
Applied rewrites89.5%
(FPCore (x y z) :precision binary64 (- x z))
double code(double x, double y, double z) {
return x - z;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - z
end function
public static double code(double x, double y, double z) {
return x - z;
}
def code(x, y, z): return x - z
function code(x, y, z) return Float64(x - z) end
function tmp = code(x, y, z) tmp = x - z; end
code[x_, y_, z_] := N[(x - z), $MachinePrecision]
\begin{array}{l}
\\
x - z
\end{array}
Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites58.1%
(FPCore (x y z) :precision binary64 (if (<= x -2e+74) x (if (<= x 4.5e+79) (- z) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2e+74) {
tmp = x;
} else if (x <= 4.5e+79) {
tmp = -z;
} else {
tmp = x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2d+74)) then
tmp = x
else if (x <= 4.5d+79) then
tmp = -z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2e+74) {
tmp = x;
} else if (x <= 4.5e+79) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2e+74: tmp = x elif x <= 4.5e+79: tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2e+74) tmp = x; elseif (x <= 4.5e+79) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2e+74) tmp = x; elseif (x <= 4.5e+79) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2e+74], x, If[LessEqual[x, 4.5e+79], (-z), x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+74}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+79}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.9999999999999999e74 or 4.49999999999999994e79 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites65.4%
if -1.9999999999999999e74 < x < 4.49999999999999994e79Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6438.2
Applied rewrites38.2%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites29.6%
herbie shell --seed 2025120
(FPCore (x y z)
:name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
:precision binary64
(- (+ (- x (* (+ y 0.5) (log y))) y) z))