
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
double code(double x, double y, double z) {
return (x * log((x / 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((x / y))) - z
end function
public static double code(double x, double y, double z) {
return (x * Math.log((x / y))) - z;
}
def code(x, y, z): return (x * math.log((x / y))) - z
function code(x, y, z) return Float64(Float64(x * log(Float64(x / y))) - z) end
function tmp = code(x, y, z) tmp = (x * log((x / y))) - z; end
code[x_, y_, z_] := N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
x \cdot \log \left(\frac{x}{y}\right) - z
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
double code(double x, double y, double z) {
return (x * log((x / 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((x / y))) - z
end function
public static double code(double x, double y, double z) {
return (x * Math.log((x / y))) - z;
}
def code(x, y, z): return (x * math.log((x / y))) - z
function code(x, y, z) return Float64(Float64(x * log(Float64(x / y))) - z) end
function tmp = code(x, y, z) tmp = (x * log((x / y))) - z; end
code[x_, y_, z_] := N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
x \cdot \log \left(\frac{x}{y}\right) - z
(FPCore (x y z) :precision binary64 (if (<= y -5e-311) (- (* x (- (log (* -2.0 x)) (log (- (+ y y))))) z) (- (* x (- (log (+ x x)) (log (+ y y)))) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e-311) {
tmp = (x * (log((-2.0 * x)) - log(-(y + y)))) - z;
} else {
tmp = (x * (log((x + x)) - log((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 <= (-5d-311)) then
tmp = (x * (log(((-2.0d0) * x)) - log(-(y + y)))) - z
else
tmp = (x * (log((x + x)) - log((y + y)))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5e-311) {
tmp = (x * (Math.log((-2.0 * x)) - Math.log(-(y + y)))) - z;
} else {
tmp = (x * (Math.log((x + x)) - Math.log((y + y)))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e-311: tmp = (x * (math.log((-2.0 * x)) - math.log(-(y + y)))) - z else: tmp = (x * (math.log((x + x)) - math.log((y + y)))) - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e-311) tmp = Float64(Float64(x * Float64(log(Float64(-2.0 * x)) - log(Float64(-Float64(y + y))))) - z); else tmp = Float64(Float64(x * Float64(log(Float64(x + x)) - log(Float64(y + y)))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5e-311) tmp = (x * (log((-2.0 * x)) - log(-(y + y)))) - z; else tmp = (x * (log((x + x)) - log((y + y)))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e-311], N[(N[(x * N[(N[Log[N[(-2.0 * x), $MachinePrecision]], $MachinePrecision] - N[Log[(-N[(y + y), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x * N[(N[Log[N[(x + x), $MachinePrecision]], $MachinePrecision] - N[Log[N[(y + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-311}:\\
\;\;\;\;x \cdot \left(\log \left(-2 \cdot x\right) - \log \left(-\left(y + y\right)\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log \left(x + x\right) - \log \left(y + y\right)\right) - z\\
\end{array}
if y < -5.0000000000002318e-311Initial program 78.1%
lift-log.f64N/A
*-lft-identityN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
metadata-evalN/A
*-commutativeN/A
mult-flipN/A
frac-2negN/A
frac-timesN/A
log-divN/A
lower-unsound--.f64N/A
*-commutativeN/A
lower-unsound-log.f64N/A
*-commutativeN/A
metadata-evalN/A
associate-*l*N/A
*-lft-identityN/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-log.f64N/A
distribute-rgt-neg-outN/A
lower-neg.f64N/A
count-2-revN/A
lower-+.f6450.4%
Applied rewrites50.4%
if -5.0000000000002318e-311 < y Initial program 78.1%
lift-log.f64N/A
*-lft-identityN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
metadata-evalN/A
*-commutativeN/A
mult-flipN/A
frac-timesN/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-unsound-log.f64N/A
count-2-revN/A
lower-+.f6449.1%
Applied rewrites49.1%
(FPCore (x y z) :precision binary64 (if (<= y -5e-311) (- (* x (- (log (- x)) (log (- y)))) z) (- (* x (- (log (+ x x)) (log (+ y y)))) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e-311) {
tmp = (x * (log(-x) - log(-y))) - z;
} else {
tmp = (x * (log((x + x)) - log((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 <= (-5d-311)) then
tmp = (x * (log(-x) - log(-y))) - z
else
tmp = (x * (log((x + x)) - log((y + y)))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5e-311) {
tmp = (x * (Math.log(-x) - Math.log(-y))) - z;
} else {
tmp = (x * (Math.log((x + x)) - Math.log((y + y)))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e-311: tmp = (x * (math.log(-x) - math.log(-y))) - z else: tmp = (x * (math.log((x + x)) - math.log((y + y)))) - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e-311) tmp = Float64(Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))) - z); else tmp = Float64(Float64(x * Float64(log(Float64(x + x)) - log(Float64(y + y)))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5e-311) tmp = (x * (log(-x) - log(-y))) - z; else tmp = (x * (log((x + x)) - log((y + y)))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e-311], N[(N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x * N[(N[Log[N[(x + x), $MachinePrecision]], $MachinePrecision] - N[Log[N[(y + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-311}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log \left(x + x\right) - \log \left(y + y\right)\right) - z\\
\end{array}
if y < -5.0000000000002318e-311Initial program 78.1%
lift-log.f64N/A
lift-/.f64N/A
frac-2negN/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.f64N/A
lower-neg.f64N/A
lower-unsound-log.f64N/A
lower-neg.f6450.4%
Applied rewrites50.4%
if -5.0000000000002318e-311 < y Initial program 78.1%
lift-log.f64N/A
*-lft-identityN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
metadata-evalN/A
*-commutativeN/A
mult-flipN/A
frac-timesN/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-unsound-log.f64N/A
count-2-revN/A
lower-+.f6449.1%
Applied rewrites49.1%
(FPCore (x y z) :precision binary64 (if (<= y -5e-311) (- (* x (- (log (- x)) (log (- y)))) z) (- (- (* (log x) x) (* (log y) x)) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e-311) {
tmp = (x * (log(-x) - log(-y))) - z;
} else {
tmp = ((log(x) * x) - (log(y) * 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 (y <= (-5d-311)) then
tmp = (x * (log(-x) - log(-y))) - z
else
tmp = ((log(x) * x) - (log(y) * x)) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5e-311) {
tmp = (x * (Math.log(-x) - Math.log(-y))) - z;
} else {
tmp = ((Math.log(x) * x) - (Math.log(y) * x)) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e-311: tmp = (x * (math.log(-x) - math.log(-y))) - z else: tmp = ((math.log(x) * x) - (math.log(y) * x)) - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e-311) tmp = Float64(Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))) - z); else tmp = Float64(Float64(Float64(log(x) * x) - Float64(log(y) * x)) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5e-311) tmp = (x * (log(-x) - log(-y))) - z; else tmp = ((log(x) * x) - (log(y) * x)) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e-311], N[(N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(N[(N[Log[x], $MachinePrecision] * x), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-311}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(\log x \cdot x - \log y \cdot x\right) - z\\
\end{array}
if y < -5.0000000000002318e-311Initial program 78.1%
lift-log.f64N/A
lift-/.f64N/A
frac-2negN/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.f64N/A
lower-neg.f64N/A
lower-unsound-log.f64N/A
lower-neg.f6450.4%
Applied rewrites50.4%
if -5.0000000000002318e-311 < y Initial program 78.1%
remove-double-negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lower-log.f64N/A
lift-/.f64N/A
div-flip-revN/A
lower-/.f6477.8%
Applied rewrites77.8%
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
lift-log.f64N/A
lift-/.f64N/A
diff-logN/A
lift-log.f64N/A
lift-log.f64N/A
sub-negate-revN/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
diff-logN/A
lift-log.f64N/A
lift-log.f64N/A
sub-flipN/A
distribute-rgt-inN/A
fp-cancel-sub-signN/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6449.0%
Applied rewrites49.0%
(FPCore (x y z) :precision binary64 (if (<= y -5e-311) (- (* x (- (log (- x)) (log (- y)))) z) (- (* x (- (log x) (log y))) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e-311) {
tmp = (x * (log(-x) - log(-y))) - z;
} else {
tmp = (x * (log(x) - log(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 <= (-5d-311)) then
tmp = (x * (log(-x) - log(-y))) - z
else
tmp = (x * (log(x) - log(y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5e-311) {
tmp = (x * (Math.log(-x) - Math.log(-y))) - z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e-311: tmp = (x * (math.log(-x) - math.log(-y))) - z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e-311) tmp = Float64(Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))) - z); else tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5e-311) tmp = (x * (log(-x) - log(-y))) - z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e-311], N[(N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-311}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
if y < -5.0000000000002318e-311Initial program 78.1%
lift-log.f64N/A
lift-/.f64N/A
frac-2negN/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.f64N/A
lower-neg.f64N/A
lower-unsound-log.f64N/A
lower-neg.f6450.4%
Applied rewrites50.4%
if -5.0000000000002318e-311 < y Initial program 78.1%
lift-log.f64N/A
lift-/.f64N/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.f64N/A
lower-unsound-log.f6449.1%
Applied rewrites49.1%
(FPCore (x y z)
:precision binary64
(if (<= x -3.15e+205)
(* x (- (log (- x)) (log (- y))))
(if (<= x -1.85e-165)
(- (* x (log (/ x y))) z)
(if (<= x 1.8e-308) (- z) (- (* x (- (log x) (log y))) z)))))double code(double x, double y, double z) {
double tmp;
if (x <= -3.15e+205) {
tmp = x * (log(-x) - log(-y));
} else if (x <= -1.85e-165) {
tmp = (x * log((x / y))) - z;
} else if (x <= 1.8e-308) {
tmp = -z;
} else {
tmp = (x * (log(x) - log(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 (x <= (-3.15d+205)) then
tmp = x * (log(-x) - log(-y))
else if (x <= (-1.85d-165)) then
tmp = (x * log((x / y))) - z
else if (x <= 1.8d-308) then
tmp = -z
else
tmp = (x * (log(x) - log(y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.15e+205) {
tmp = x * (Math.log(-x) - Math.log(-y));
} else if (x <= -1.85e-165) {
tmp = (x * Math.log((x / y))) - z;
} else if (x <= 1.8e-308) {
tmp = -z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.15e+205: tmp = x * (math.log(-x) - math.log(-y)) elif x <= -1.85e-165: tmp = (x * math.log((x / y))) - z elif x <= 1.8e-308: tmp = -z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.15e+205) tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))); elseif (x <= -1.85e-165) tmp = Float64(Float64(x * log(Float64(x / y))) - z); elseif (x <= 1.8e-308) tmp = Float64(-z); else tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.15e+205) tmp = x * (log(-x) - log(-y)); elseif (x <= -1.85e-165) tmp = (x * log((x / y))) - z; elseif (x <= 1.8e-308) tmp = -z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.15e+205], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.85e-165], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 1.8e-308], (-z), N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;x \leq -3.15 \cdot 10^{+205}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-165}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-308}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
if x < -3.1500000000000001e205Initial program 78.1%
Taylor expanded in x around 0
lower-*.f6450.0%
Applied rewrites50.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6450.0%
Applied rewrites50.0%
Taylor expanded in z around 0
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6439.9%
Applied rewrites39.9%
lift-log.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
diff-logN/A
lift-log.f64N/A
lift-log.f64N/A
lift--.f6425.8%
Applied rewrites25.8%
if -3.1500000000000001e205 < x < -1.85e-165Initial program 78.1%
if -1.85e-165 < x < 1.7999999999999999e-308Initial program 78.1%
Taylor expanded in x around 0
lower-*.f6450.0%
Applied rewrites50.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6450.0%
Applied rewrites50.0%
if 1.7999999999999999e-308 < x Initial program 78.1%
lift-log.f64N/A
lift-/.f64N/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.f64N/A
lower-unsound-log.f6449.1%
Applied rewrites49.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.85e-165) (- (* x (log (/ x y))) z) (if (<= x 1.8e-308) (- z) (- (* x (- (log x) (log y))) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.85e-165) {
tmp = (x * log((x / y))) - z;
} else if (x <= 1.8e-308) {
tmp = -z;
} else {
tmp = (x * (log(x) - log(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 (x <= (-1.85d-165)) then
tmp = (x * log((x / y))) - z
else if (x <= 1.8d-308) then
tmp = -z
else
tmp = (x * (log(x) - log(y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.85e-165) {
tmp = (x * Math.log((x / y))) - z;
} else if (x <= 1.8e-308) {
tmp = -z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.85e-165: tmp = (x * math.log((x / y))) - z elif x <= 1.8e-308: tmp = -z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.85e-165) tmp = Float64(Float64(x * log(Float64(x / y))) - z); elseif (x <= 1.8e-308) tmp = Float64(-z); else tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.85e-165) tmp = (x * log((x / y))) - z; elseif (x <= 1.8e-308) tmp = -z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.85e-165], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 1.8e-308], (-z), N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{-165}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-308}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
if x < -1.85e-165Initial program 78.1%
if -1.85e-165 < x < 1.7999999999999999e-308Initial program 78.1%
Taylor expanded in x around 0
lower-*.f6450.0%
Applied rewrites50.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6450.0%
Applied rewrites50.0%
if 1.7999999999999999e-308 < x Initial program 78.1%
lift-log.f64N/A
lift-/.f64N/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.f64N/A
lower-unsound-log.f6449.1%
Applied rewrites49.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (* x (log (/ x y))) z))) (if (<= t_0 (- INFINITY)) (- z) (if (<= t_0 1e+297) t_0 (- z)))))
double code(double x, double y, double z) {
double t_0 = (x * log((x / y))) - z;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = -z;
} else if (t_0 <= 1e+297) {
tmp = t_0;
} else {
tmp = -z;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = (x * Math.log((x / y))) - z;
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = -z;
} else if (t_0 <= 1e+297) {
tmp = t_0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = (x * math.log((x / y))) - z tmp = 0 if t_0 <= -math.inf: tmp = -z elif t_0 <= 1e+297: tmp = t_0 else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(Float64(x * log(Float64(x / y))) - z) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(-z); elseif (t_0 <= 1e+297) tmp = t_0; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x * log((x / y))) - z; tmp = 0.0; if (t_0 <= -Inf) tmp = -z; elseif (t_0 <= 1e+297) tmp = t_0; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], (-z), If[LessEqual[t$95$0, 1e+297], t$95$0, (-z)]]]
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;-z\\
\mathbf{elif}\;t\_0 \leq 10^{+297}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
if (-.f64 (*.f64 x (log.f64 (/.f64 x y))) z) < -inf.0 or 1e297 < (-.f64 (*.f64 x (log.f64 (/.f64 x y))) z) Initial program 78.1%
Taylor expanded in x around 0
lower-*.f6450.0%
Applied rewrites50.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6450.0%
Applied rewrites50.0%
if -inf.0 < (-.f64 (*.f64 x (log.f64 (/.f64 x y))) z) < 1e297Initial program 78.1%
(FPCore (x y z) :precision binary64 (if (<= x -2e-32) (* x (log (/ x y))) (if (<= x 1.4e-36) (- z) (* (- x) (log (/ y x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2e-32) {
tmp = x * log((x / y));
} else if (x <= 1.4e-36) {
tmp = -z;
} else {
tmp = -x * log((y / 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-32)) then
tmp = x * log((x / y))
else if (x <= 1.4d-36) then
tmp = -z
else
tmp = -x * log((y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2e-32) {
tmp = x * Math.log((x / y));
} else if (x <= 1.4e-36) {
tmp = -z;
} else {
tmp = -x * Math.log((y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2e-32: tmp = x * math.log((x / y)) elif x <= 1.4e-36: tmp = -z else: tmp = -x * math.log((y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2e-32) tmp = Float64(x * log(Float64(x / y))); elseif (x <= 1.4e-36) tmp = Float64(-z); else tmp = Float64(Float64(-x) * log(Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2e-32) tmp = x * log((x / y)); elseif (x <= 1.4e-36) tmp = -z; else tmp = -x * log((y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2e-32], N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4e-36], (-z), N[((-x) * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-32}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-36}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \log \left(\frac{y}{x}\right)\\
\end{array}
if x < -2.0000000000000001e-32Initial program 78.1%
Taylor expanded in x around 0
lower-*.f6450.0%
Applied rewrites50.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6450.0%
Applied rewrites50.0%
Taylor expanded in z around 0
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6439.9%
Applied rewrites39.9%
if -2.0000000000000001e-32 < x < 1.4000000000000001e-36Initial program 78.1%
Taylor expanded in x around 0
lower-*.f6450.0%
Applied rewrites50.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6450.0%
Applied rewrites50.0%
if 1.4000000000000001e-36 < x Initial program 78.1%
Taylor expanded in x around 0
lower-*.f6450.0%
Applied rewrites50.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6450.0%
Applied rewrites50.0%
Taylor expanded in z around 0
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6439.9%
Applied rewrites39.9%
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
log-pow-revN/A
neg-logN/A
lift-log.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift-neg.f64N/A
lower-*.f6440.2%
Applied rewrites40.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (log (/ x y))))) (if (<= x -2e-32) t_0 (if (<= x 1.4e-36) (- z) t_0))))
double code(double x, double y, double z) {
double t_0 = x * log((x / y));
double tmp;
if (x <= -2e-32) {
tmp = t_0;
} else if (x <= 1.4e-36) {
tmp = -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 * log((x / y))
if (x <= (-2d-32)) then
tmp = t_0
else if (x <= 1.4d-36) then
tmp = -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 * Math.log((x / y));
double tmp;
if (x <= -2e-32) {
tmp = t_0;
} else if (x <= 1.4e-36) {
tmp = -z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * math.log((x / y)) tmp = 0 if x <= -2e-32: tmp = t_0 elif x <= 1.4e-36: tmp = -z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * log(Float64(x / y))) tmp = 0.0 if (x <= -2e-32) tmp = t_0; elseif (x <= 1.4e-36) tmp = Float64(-z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * log((x / y)); tmp = 0.0; if (x <= -2e-32) tmp = t_0; elseif (x <= 1.4e-36) tmp = -z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e-32], t$95$0, If[LessEqual[x, 1.4e-36], (-z), t$95$0]]]
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{-32}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-36}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -2.0000000000000001e-32 or 1.4000000000000001e-36 < x Initial program 78.1%
Taylor expanded in x around 0
lower-*.f6450.0%
Applied rewrites50.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6450.0%
Applied rewrites50.0%
Taylor expanded in z around 0
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6439.9%
Applied rewrites39.9%
if -2.0000000000000001e-32 < x < 1.4000000000000001e-36Initial program 78.1%
Taylor expanded in x around 0
lower-*.f6450.0%
Applied rewrites50.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6450.0%
Applied rewrites50.0%
(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)
-z
Initial program 78.1%
Taylor expanded in x around 0
lower-*.f6450.0%
Applied rewrites50.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6450.0%
Applied rewrites50.0%
herbie shell --seed 2025258
(FPCore (x y z)
:name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
:precision binary64
(- (* x (log (/ x y))) z))