
(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 11 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 (- (fma (- -0.5 y) (log y) y) (- z x)))
double code(double x, double y, double z) {
return fma((-0.5 - y), log(y), y) - (z - x);
}
function code(x, y, z) return Float64(fma(Float64(-0.5 - y), log(y), y) - Float64(z - x)) end
code[x_, y_, z_] := N[(N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + y), $MachinePrecision] - N[(z - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.5 - y, \log y, y\right) - \left(z - x\right)
\end{array}
Initial program 99.8%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
add-flipN/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate--l+N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
add-flip-revN/A
lower-fma.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
lower--.f64N/A
metadata-evalN/A
lower--.f6499.9
Applied rewrites99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (- x (log (sqrt y))) z)))
(if (<= z -4.6e+44)
t_0
(if (<= z 9e+29) (- y (- (* (log y) (+ 0.5 y)) x)) t_0))))
double code(double x, double y, double z) {
double t_0 = (x - log(sqrt(y))) - z;
double tmp;
if (z <= -4.6e+44) {
tmp = t_0;
} else if (z <= 9e+29) {
tmp = y - ((log(y) * (0.5 + y)) - x);
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
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 - log(sqrt(y))) - z
if (z <= (-4.6d+44)) then
tmp = t_0
else if (z <= 9d+29) then
tmp = y - ((log(y) * (0.5d0 + y)) - x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x - Math.log(Math.sqrt(y))) - z;
double tmp;
if (z <= -4.6e+44) {
tmp = t_0;
} else if (z <= 9e+29) {
tmp = y - ((Math.log(y) * (0.5 + y)) - x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x - math.log(math.sqrt(y))) - z tmp = 0 if z <= -4.6e+44: tmp = t_0 elif z <= 9e+29: tmp = y - ((math.log(y) * (0.5 + y)) - x) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x - log(sqrt(y))) - z) tmp = 0.0 if (z <= -4.6e+44) tmp = t_0; elseif (z <= 9e+29) tmp = Float64(y - Float64(Float64(log(y) * Float64(0.5 + y)) - x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x - log(sqrt(y))) - z; tmp = 0.0; if (z <= -4.6e+44) tmp = t_0; elseif (z <= 9e+29) tmp = y - ((log(y) * (0.5 + y)) - x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[z, -4.6e+44], t$95$0, If[LessEqual[z, 9e+29], N[(y - N[(N[(N[Log[y], $MachinePrecision] * N[(0.5 + y), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x - \log \left(\sqrt{y}\right)\right) - z\\
\mathbf{if}\;z \leq -4.6 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+29}:\\
\;\;\;\;y - \left(\log y \cdot \left(0.5 + y\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.60000000000000009e44 or 9.0000000000000005e29 < z Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6470.7
Applied rewrites70.7%
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6470.7
Applied rewrites70.7%
if -4.60000000000000009e44 < z < 9.0000000000000005e29Initial program 99.8%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
add-flipN/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate--l+N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
add-flip-revN/A
lower-fma.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
lower--.f64N/A
metadata-evalN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites70.3%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lift--.f64N/A
sub-negate-revN/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate--l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6470.2
Applied rewrites70.2%
Taylor expanded in z around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6471.3
Applied rewrites71.3%
(FPCore (x y z) :precision binary64 (if (<= y 1600000.0) (- (- x (log (sqrt y))) z) (- (fma (- -0.5 y) (log y) y) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1600000.0) {
tmp = (x - log(sqrt(y))) - z;
} else {
tmp = fma((-0.5 - y), log(y), y) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 1600000.0) tmp = Float64(Float64(x - log(sqrt(y))) - z); else tmp = Float64(fma(Float64(-0.5 - y), log(y), y) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 1600000.0], N[(N[(x - N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1600000:\\
\;\;\;\;\left(x - \log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, y\right) - z\\
\end{array}
\end{array}
if y < 1.6e6Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6470.7
Applied rewrites70.7%
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6470.7
Applied rewrites70.7%
if 1.6e6 < y Initial program 99.8%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
add-flipN/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate--l+N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
add-flip-revN/A
lower-fma.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
lower--.f64N/A
metadata-evalN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites70.3%
(FPCore (x y z) :precision binary64 (if (<= y 1600000.0) (- (- 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 <= 1600000.0) {
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 <= 1600000.0) 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, 1600000.0], 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 1600000:\\
\;\;\;\;\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 < 1.6e6Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6470.7
Applied rewrites70.7%
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6470.7
Applied rewrites70.7%
if 1.6e6 < y Initial program 99.8%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
add-flipN/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate--l+N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
add-flip-revN/A
lower-fma.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
lower--.f64N/A
metadata-evalN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites70.3%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lift--.f64N/A
sub-negate-revN/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate--l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6470.2
Applied rewrites70.2%
(FPCore (x y z) :precision binary64 (if (<= y 1.1e+72) (- (- x (log (sqrt y))) z) (* y (+ 1.0 (log (/ 1.0 y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.1e+72) {
tmp = (x - log(sqrt(y))) - z;
} else {
tmp = y * (1.0 + log((1.0 / 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 <= 1.1d+72) then
tmp = (x - log(sqrt(y))) - z
else
tmp = y * (1.0d0 + log((1.0d0 / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.1e+72) {
tmp = (x - Math.log(Math.sqrt(y))) - z;
} else {
tmp = y * (1.0 + Math.log((1.0 / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.1e+72: tmp = (x - math.log(math.sqrt(y))) - z else: tmp = y * (1.0 + math.log((1.0 / y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.1e+72) tmp = Float64(Float64(x - log(sqrt(y))) - z); else tmp = Float64(y * Float64(1.0 + log(Float64(1.0 / y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.1e+72) tmp = (x - log(sqrt(y))) - z; else tmp = y * (1.0 + log((1.0 / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.1e+72], N[(N[(x - N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(y * N[(1.0 + N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{+72}:\\
\;\;\;\;\left(x - \log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right)\\
\end{array}
\end{array}
if y < 1.1e72Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6470.7
Applied rewrites70.7%
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6470.7
Applied rewrites70.7%
if 1.1e72 < y Initial program 99.8%
Taylor expanded in y around -inf
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-/.f6430.7
Applied rewrites30.7%
(FPCore (x y z) :precision binary64 (if (<= y 1.1e+72) (- (- x (log (sqrt y))) z) (* (- 1.0 (log y)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.1e+72) {
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 <= 1.1d+72) 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 <= 1.1e+72) {
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 <= 1.1e+72: 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 <= 1.1e+72) tmp = Float64(Float64(x - log(sqrt(y))) - z); else tmp = Float64(Float64(1.0 - log(y)) * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.1e+72) 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, 1.1e+72], 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 1.1 \cdot 10^{+72}:\\
\;\;\;\;\left(x - \log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\
\end{array}
\end{array}
if y < 1.1e72Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6470.7
Applied rewrites70.7%
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6470.7
Applied rewrites70.7%
if 1.1e72 < y Initial program 99.8%
Taylor expanded in y around -inf
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-/.f6430.7
Applied rewrites30.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6430.7
lift-+.f64N/A
lift-log.f64N/A
lift-/.f64N/A
log-recN/A
lift-log.f64N/A
sub-flip-reverseN/A
lower--.f6430.7
Applied rewrites30.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma (/ 1.0 z) (* x z) (- z)))
(t_1 (+ (- x (* (+ y 0.5) (log y))) y))
(t_2 (* (- 1.0 (log y)) y)))
(if (<= t_1 -5e+63)
t_2
(if (<= t_1 -5e+33)
t_0
(if (<= t_1 -5000000000000.0)
t_2
(if (<= t_1 349.0) (- (- (log (sqrt y))) z) t_0))))))
double code(double x, double y, double z) {
double t_0 = fma((1.0 / z), (x * z), -z);
double t_1 = (x - ((y + 0.5) * log(y))) + y;
double t_2 = (1.0 - log(y)) * y;
double tmp;
if (t_1 <= -5e+63) {
tmp = t_2;
} else if (t_1 <= -5e+33) {
tmp = t_0;
} else if (t_1 <= -5000000000000.0) {
tmp = t_2;
} else if (t_1 <= 349.0) {
tmp = -log(sqrt(y)) - z;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(Float64(1.0 / z), Float64(x * z), Float64(-z)) t_1 = Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) t_2 = Float64(Float64(1.0 - log(y)) * y) tmp = 0.0 if (t_1 <= -5e+63) tmp = t_2; elseif (t_1 <= -5e+33) tmp = t_0; elseif (t_1 <= -5000000000000.0) tmp = t_2; elseif (t_1 <= 349.0) tmp = Float64(Float64(-log(sqrt(y))) - z); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 / z), $MachinePrecision] * N[(x * z), $MachinePrecision] + (-z)), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+63], t$95$2, If[LessEqual[t$95$1, -5e+33], t$95$0, If[LessEqual[t$95$1, -5000000000000.0], t$95$2, If[LessEqual[t$95$1, 349.0], N[((-N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]) - z), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{1}{z}, x \cdot z, -z\right)\\
t_1 := \left(x - \left(y + 0.5\right) \cdot \log y\right) + y\\
t_2 := \left(1 - \log y\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+63}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq -5000000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 349:\\
\;\;\;\;\left(-\log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -5.00000000000000011e63 or -4.99999999999999973e33 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -5e12Initial program 99.8%
Taylor expanded in y around -inf
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-/.f6430.7
Applied rewrites30.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6430.7
lift-+.f64N/A
lift-log.f64N/A
lift-/.f64N/A
log-recN/A
lift-log.f64N/A
sub-flip-reverseN/A
lower--.f6430.7
Applied rewrites30.7%
if -5.00000000000000011e63 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -4.99999999999999973e33 or 349 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) Initial program 99.8%
Taylor expanded in z around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6480.5
Applied rewrites80.5%
Applied rewrites79.9%
Taylor expanded in x around inf
lower-*.f6447.0
Applied rewrites47.0%
if -5e12 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 349Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6470.7
Applied rewrites70.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-log.f6441.9
Applied rewrites41.9%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-log.f64N/A
lower-neg.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6441.9
Applied rewrites41.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (- x (* (+ y 0.5) (log y))) y)))
(if (<= t_0 -5000000000000.0)
(* (- 1.0 (log y)) y)
(if (<= t_0 2e+185) (- (- (log (sqrt y))) z) (- (- x))))))
double code(double x, double y, double z) {
double t_0 = (x - ((y + 0.5) * log(y))) + y;
double tmp;
if (t_0 <= -5000000000000.0) {
tmp = (1.0 - log(y)) * y;
} else if (t_0 <= 2e+185) {
tmp = -log(sqrt(y)) - 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) :: t_0
real(8) :: tmp
t_0 = (x - ((y + 0.5d0) * log(y))) + y
if (t_0 <= (-5000000000000.0d0)) then
tmp = (1.0d0 - log(y)) * y
else if (t_0 <= 2d+185) then
tmp = -log(sqrt(y)) - z
else
tmp = -(-x)
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 <= -5000000000000.0) {
tmp = (1.0 - Math.log(y)) * y;
} else if (t_0 <= 2e+185) {
tmp = -Math.log(Math.sqrt(y)) - z;
} else {
tmp = -(-x);
}
return tmp;
}
def code(x, y, z): t_0 = (x - ((y + 0.5) * math.log(y))) + y tmp = 0 if t_0 <= -5000000000000.0: tmp = (1.0 - math.log(y)) * y elif t_0 <= 2e+185: tmp = -math.log(math.sqrt(y)) - z else: tmp = -(-x) 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 <= -5000000000000.0) tmp = Float64(Float64(1.0 - log(y)) * y); elseif (t_0 <= 2e+185) tmp = Float64(Float64(-log(sqrt(y))) - z); else tmp = Float64(-Float64(-x)); 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 <= -5000000000000.0) tmp = (1.0 - log(y)) * y; elseif (t_0 <= 2e+185) tmp = -log(sqrt(y)) - z; else tmp = -(-x); 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, -5000000000000.0], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 2e+185], N[((-N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]) - z), $MachinePrecision], (-(-x))]]]
\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 -5000000000000:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+185}:\\
\;\;\;\;\left(-\log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;-\left(-x\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -5e12Initial program 99.8%
Taylor expanded in y around -inf
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-/.f6430.7
Applied rewrites30.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6430.7
lift-+.f64N/A
lift-log.f64N/A
lift-/.f64N/A
log-recN/A
lift-log.f64N/A
sub-flip-reverseN/A
lower--.f6430.7
Applied rewrites30.7%
if -5e12 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 2e185Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6470.7
Applied rewrites70.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-log.f6441.9
Applied rewrites41.9%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-log.f64N/A
lower-neg.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6441.9
Applied rewrites41.9%
if 2e185 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) Initial program 99.8%
Taylor expanded in z around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6480.5
Applied rewrites80.5%
Taylor expanded in x around inf
lower-*.f6430.5
Applied rewrites30.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.5
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.5
Applied rewrites30.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (- x)))) (if (<= x -17000.0) t_0 (if (<= x 1.2e+185) (- (- (log (sqrt y))) z) t_0))))
double code(double x, double y, double z) {
double t_0 = -(-x);
double tmp;
if (x <= -17000.0) {
tmp = t_0;
} else if (x <= 1.2e+185) {
tmp = -log(sqrt(y)) - z;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
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)
if (x <= (-17000.0d0)) then
tmp = t_0
else if (x <= 1.2d+185) then
tmp = -log(sqrt(y)) - z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -(-x);
double tmp;
if (x <= -17000.0) {
tmp = t_0;
} else if (x <= 1.2e+185) {
tmp = -Math.log(Math.sqrt(y)) - z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -(-x) tmp = 0 if x <= -17000.0: tmp = t_0 elif x <= 1.2e+185: tmp = -math.log(math.sqrt(y)) - z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-Float64(-x)) tmp = 0.0 if (x <= -17000.0) tmp = t_0; elseif (x <= 1.2e+185) tmp = Float64(Float64(-log(sqrt(y))) - z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -(-x); tmp = 0.0; if (x <= -17000.0) tmp = t_0; elseif (x <= 1.2e+185) tmp = -log(sqrt(y)) - z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = (-(-x))}, If[LessEqual[x, -17000.0], t$95$0, If[LessEqual[x, 1.2e+185], N[((-N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]) - z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\left(-x\right)\\
\mathbf{if}\;x \leq -17000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+185}:\\
\;\;\;\;\left(-\log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -17000 or 1.19999999999999995e185 < x Initial program 99.8%
Taylor expanded in z around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6480.5
Applied rewrites80.5%
Taylor expanded in x around inf
lower-*.f6430.5
Applied rewrites30.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.5
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.5
Applied rewrites30.5%
if -17000 < x < 1.19999999999999995e185Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6470.7
Applied rewrites70.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-log.f6441.9
Applied rewrites41.9%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lift-log.f64N/A
lower-neg.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6441.9
Applied rewrites41.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.18e+39) (- z) (if (<= z 2.8e+91) (- (- x)) (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.18e+39) {
tmp = -z;
} else if (z <= 2.8e+91) {
tmp = -(-x);
} else {
tmp = -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 (z <= (-1.18d+39)) then
tmp = -z
else if (z <= 2.8d+91) then
tmp = -(-x)
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.18e+39) {
tmp = -z;
} else if (z <= 2.8e+91) {
tmp = -(-x);
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.18e+39: tmp = -z elif z <= 2.8e+91: tmp = -(-x) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.18e+39) tmp = Float64(-z); elseif (z <= 2.8e+91) tmp = Float64(-Float64(-x)); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.18e+39) tmp = -z; elseif (z <= 2.8e+91) tmp = -(-x); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.18e+39], (-z), If[LessEqual[z, 2.8e+91], (-(-x)), (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.18 \cdot 10^{+39}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+91}:\\
\;\;\;\;-\left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -1.17999999999999996e39 or 2.7999999999999999e91 < z Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6429.7
Applied rewrites29.7%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6429.7
Applied rewrites29.7%
if -1.17999999999999996e39 < z < 2.7999999999999999e91Initial program 99.8%
Taylor expanded in z around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6480.5
Applied rewrites80.5%
Taylor expanded in x around inf
lower-*.f6430.5
Applied rewrites30.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.5
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.5
Applied rewrites30.5%
(FPCore (x y z) :precision binary64 (- z))
double code(double x, double y, double z) {
return -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 = -z
end function
public static double code(double x, double y, double z) {
return -z;
}
def code(x, y, z): return -z
function code(x, y, z) return Float64(-z) end
function tmp = code(x, y, z) tmp = -z; end
code[x_, y_, z_] := (-z)
\begin{array}{l}
\\
-z
\end{array}
Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6429.7
Applied rewrites29.7%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6429.7
Applied rewrites29.7%
herbie shell --seed 2025149
(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))