
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 1/2) (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 + 1/2), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 1/2) (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 + 1/2), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right) - z
(FPCore (x y z) :precision binary64 (- (- (+ y x) z) (* (log y) (- y -1/2))))
double code(double x, double y, double z) {
return ((y + x) - z) - (log(y) * (y - -0.5));
}
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 = ((y + x) - z) - (log(y) * (y - (-0.5d0)))
end function
public static double code(double x, double y, double z) {
return ((y + x) - z) - (Math.log(y) * (y - -0.5));
}
def code(x, y, z): return ((y + x) - z) - (math.log(y) * (y - -0.5))
function code(x, y, z) return Float64(Float64(Float64(y + x) - z) - Float64(log(y) * Float64(y - -0.5))) end
function tmp = code(x, y, z) tmp = ((y + x) - z) - (log(y) * (y - -0.5)); end
code[x_, y_, z_] := N[(N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * N[(y - -1/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(y + x\right) - z\right) - \log y \cdot \left(y - \frac{-1}{2}\right)
Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
sub-flipN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
remove-double-negN/A
distribute-neg-inN/A
sub-flipN/A
sub-negate-revN/A
associate--r-N/A
sub-flip-reverseN/A
sub-negate-revN/A
associate-+r-N/A
+-commutativeN/A
lower--.f64N/A
lower-+.f6499.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
(FPCore (x y z)
:precision binary64
(if (<=
z
-47999999999999996524089971390543551186526799180673510009045877937386533124740660945353317548032)
(- (- y z) (* (log y) (- y -1/2)))
(if (<=
z
12000000000000000092156844732391635628802393190991881159827561381888)
(- (+ x y) (* (log y) (+ 1/2 y)))
(- x (+ z (* 1/2 (log y)))))))double code(double x, double y, double z) {
double tmp;
if (z <= -4.8e+94) {
tmp = (y - z) - (log(y) * (y - -0.5));
} else if (z <= 1.2e+67) {
tmp = (x + y) - (log(y) * (0.5 + y));
} else {
tmp = x - (z + (0.5 * 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 (z <= (-4.8d+94)) then
tmp = (y - z) - (log(y) * (y - (-0.5d0)))
else if (z <= 1.2d+67) then
tmp = (x + y) - (log(y) * (0.5d0 + y))
else
tmp = x - (z + (0.5d0 * log(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.8e+94) {
tmp = (y - z) - (Math.log(y) * (y - -0.5));
} else if (z <= 1.2e+67) {
tmp = (x + y) - (Math.log(y) * (0.5 + y));
} else {
tmp = x - (z + (0.5 * Math.log(y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.8e+94: tmp = (y - z) - (math.log(y) * (y - -0.5)) elif z <= 1.2e+67: tmp = (x + y) - (math.log(y) * (0.5 + y)) else: tmp = x - (z + (0.5 * math.log(y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.8e+94) tmp = Float64(Float64(y - z) - Float64(log(y) * Float64(y - -0.5))); elseif (z <= 1.2e+67) tmp = Float64(Float64(x + y) - Float64(log(y) * Float64(0.5 + y))); else tmp = Float64(x - Float64(z + Float64(0.5 * log(y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.8e+94) tmp = (y - z) - (log(y) * (y - -0.5)); elseif (z <= 1.2e+67) tmp = (x + y) - (log(y) * (0.5 + y)); else tmp = x - (z + (0.5 * log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -47999999999999996524089971390543551186526799180673510009045877937386533124740660945353317548032], N[(N[(y - z), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * N[(y - -1/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 12000000000000000092156844732391635628802393190991881159827561381888], N[(N[(x + y), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * N[(1/2 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z + N[(1/2 * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -47999999999999996524089971390543551186526799180673510009045877937386533124740660945353317548032:\\
\;\;\;\;\left(y - z\right) - \log y \cdot \left(y - \frac{-1}{2}\right)\\
\mathbf{elif}\;z \leq 12000000000000000092156844732391635628802393190991881159827561381888:\\
\;\;\;\;\left(x + y\right) - \log y \cdot \left(\frac{1}{2} + y\right)\\
\mathbf{else}:\\
\;\;\;\;x - \left(z + \frac{1}{2} \cdot \log y\right)\\
\end{array}
if z < -4.7999999999999997e94Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
sub-flipN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
remove-double-negN/A
distribute-neg-inN/A
sub-flipN/A
sub-negate-revN/A
associate--r-N/A
sub-flip-reverseN/A
sub-negate-revN/A
associate-+r-N/A
+-commutativeN/A
lower--.f64N/A
lower-+.f6499.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites71.9%
if -4.7999999999999997e94 < z < 1.2e67Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
sub-flipN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
remove-double-negN/A
distribute-neg-inN/A
sub-flipN/A
sub-negate-revN/A
associate--r-N/A
sub-flip-reverseN/A
sub-negate-revN/A
associate-+r-N/A
+-commutativeN/A
lower--.f64N/A
lower-+.f6499.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites71.9%
Taylor expanded in z around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6471.0%
Applied rewrites71.0%
if 1.2e67 < z Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6469.6%
Applied rewrites69.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (log y) (+ 1/2 y))))
(if (<=
z
-47999999999999996524089971390543551186526799180673510009045877937386533124740660945353317548032)
(- (- y t_0) z)
(if (<=
z
12000000000000000092156844732391635628802393190991881159827561381888)
(- (+ x y) t_0)
(- x (+ z (* 1/2 (log y))))))))double code(double x, double y, double z) {
double t_0 = log(y) * (0.5 + y);
double tmp;
if (z <= -4.8e+94) {
tmp = (y - t_0) - z;
} else if (z <= 1.2e+67) {
tmp = (x + y) - t_0;
} else {
tmp = x - (z + (0.5 * 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) :: t_0
real(8) :: tmp
t_0 = log(y) * (0.5d0 + y)
if (z <= (-4.8d+94)) then
tmp = (y - t_0) - z
else if (z <= 1.2d+67) then
tmp = (x + y) - t_0
else
tmp = x - (z + (0.5d0 * log(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.log(y) * (0.5 + y);
double tmp;
if (z <= -4.8e+94) {
tmp = (y - t_0) - z;
} else if (z <= 1.2e+67) {
tmp = (x + y) - t_0;
} else {
tmp = x - (z + (0.5 * Math.log(y)));
}
return tmp;
}
def code(x, y, z): t_0 = math.log(y) * (0.5 + y) tmp = 0 if z <= -4.8e+94: tmp = (y - t_0) - z elif z <= 1.2e+67: tmp = (x + y) - t_0 else: tmp = x - (z + (0.5 * math.log(y))) return tmp
function code(x, y, z) t_0 = Float64(log(y) * Float64(0.5 + y)) tmp = 0.0 if (z <= -4.8e+94) tmp = Float64(Float64(y - t_0) - z); elseif (z <= 1.2e+67) tmp = Float64(Float64(x + y) - t_0); else tmp = Float64(x - Float64(z + Float64(0.5 * log(y)))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = log(y) * (0.5 + y); tmp = 0.0; if (z <= -4.8e+94) tmp = (y - t_0) - z; elseif (z <= 1.2e+67) tmp = (x + y) - t_0; else tmp = x - (z + (0.5 * log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Log[y], $MachinePrecision] * N[(1/2 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -47999999999999996524089971390543551186526799180673510009045877937386533124740660945353317548032], N[(N[(y - t$95$0), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[z, 12000000000000000092156844732391635628802393190991881159827561381888], N[(N[(x + y), $MachinePrecision] - t$95$0), $MachinePrecision], N[(x - N[(z + N[(1/2 * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \log y \cdot \left(\frac{1}{2} + y\right)\\
\mathbf{if}\;z \leq -47999999999999996524089971390543551186526799180673510009045877937386533124740660945353317548032:\\
\;\;\;\;\left(y - t\_0\right) - z\\
\mathbf{elif}\;z \leq 12000000000000000092156844732391635628802393190991881159827561381888:\\
\;\;\;\;\left(x + y\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;x - \left(z + \frac{1}{2} \cdot \log y\right)\\
\end{array}
if z < -4.7999999999999997e94Initial program 99.8%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6471.9%
Applied rewrites71.9%
if -4.7999999999999997e94 < z < 1.2e67Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
sub-flipN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
remove-double-negN/A
distribute-neg-inN/A
sub-flipN/A
sub-negate-revN/A
associate--r-N/A
sub-flip-reverseN/A
sub-negate-revN/A
associate-+r-N/A
+-commutativeN/A
lower--.f64N/A
lower-+.f6499.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites71.9%
Taylor expanded in z around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6471.0%
Applied rewrites71.0%
if 1.2e67 < z Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6469.6%
Applied rewrites69.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- x (+ z (* 1/2 (log y))))))
(if (<=
z
-800000000000000024645330584772205526216201632061146770768717952555311882330651492352)
t_0
(if (<=
z
12000000000000000092156844732391635628802393190991881159827561381888)
(- (+ x y) (* (log y) (+ 1/2 y)))
t_0))))double code(double x, double y, double z) {
double t_0 = x - (z + (0.5 * log(y)));
double tmp;
if (z <= -8e+83) {
tmp = t_0;
} else if (z <= 1.2e+67) {
tmp = (x + y) - (log(y) * (0.5 + y));
} 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 - (z + (0.5d0 * log(y)))
if (z <= (-8d+83)) then
tmp = t_0
else if (z <= 1.2d+67) then
tmp = (x + y) - (log(y) * (0.5d0 + y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x - (z + (0.5 * Math.log(y)));
double tmp;
if (z <= -8e+83) {
tmp = t_0;
} else if (z <= 1.2e+67) {
tmp = (x + y) - (Math.log(y) * (0.5 + y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x - (z + (0.5 * math.log(y))) tmp = 0 if z <= -8e+83: tmp = t_0 elif z <= 1.2e+67: tmp = (x + y) - (math.log(y) * (0.5 + y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x - Float64(z + Float64(0.5 * log(y)))) tmp = 0.0 if (z <= -8e+83) tmp = t_0; elseif (z <= 1.2e+67) tmp = Float64(Float64(x + y) - Float64(log(y) * Float64(0.5 + y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x - (z + (0.5 * log(y))); tmp = 0.0; if (z <= -8e+83) tmp = t_0; elseif (z <= 1.2e+67) tmp = (x + y) - (log(y) * (0.5 + y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(z + N[(1/2 * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -800000000000000024645330584772205526216201632061146770768717952555311882330651492352], t$95$0, If[LessEqual[z, 12000000000000000092156844732391635628802393190991881159827561381888], N[(N[(x + y), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * N[(1/2 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := x - \left(z + \frac{1}{2} \cdot \log y\right)\\
\mathbf{if}\;z \leq -800000000000000024645330584772205526216201632061146770768717952555311882330651492352:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 12000000000000000092156844732391635628802393190991881159827561381888:\\
\;\;\;\;\left(x + y\right) - \log y \cdot \left(\frac{1}{2} + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -8.0000000000000002e83 or 1.2e67 < z Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6469.6%
Applied rewrites69.6%
if -8.0000000000000002e83 < z < 1.2e67Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
sub-flipN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
remove-double-negN/A
distribute-neg-inN/A
sub-flipN/A
sub-negate-revN/A
associate--r-N/A
sub-flip-reverseN/A
sub-negate-revN/A
associate-+r-N/A
+-commutativeN/A
lower--.f64N/A
lower-+.f6499.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites71.9%
Taylor expanded in z around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6471.0%
Applied rewrites71.0%
(FPCore (x y z) :precision binary64 (- x (+ z (* 1/2 (log y)))))
double code(double x, double y, double z) {
return x - (z + (0.5 * log(y)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - (z + (0.5d0 * log(y)))
end function
public static double code(double x, double y, double z) {
return x - (z + (0.5 * Math.log(y)));
}
def code(x, y, z): return x - (z + (0.5 * math.log(y)))
function code(x, y, z) return Float64(x - Float64(z + Float64(0.5 * log(y)))) end
function tmp = code(x, y, z) tmp = x - (z + (0.5 * log(y))); end
code[x_, y_, z_] := N[(x - N[(z + N[(1/2 * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x - \left(z + \frac{1}{2} \cdot \log y\right)
Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6469.6%
Applied rewrites69.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- 1 (/ z x)) x)))
(if (<= x -780000000)
t_0
(if (<= x 3602879701896397/281474976710656)
(- (* -1/2 (log y)) z)
t_0))))double code(double x, double y, double z) {
double t_0 = (1.0 - (z / x)) * x;
double tmp;
if (x <= -780000000.0) {
tmp = t_0;
} else if (x <= 12.8) {
tmp = (-0.5 * log(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 = (1.0d0 - (z / x)) * x
if (x <= (-780000000.0d0)) then
tmp = t_0
else if (x <= 12.8d0) then
tmp = ((-0.5d0) * log(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 = (1.0 - (z / x)) * x;
double tmp;
if (x <= -780000000.0) {
tmp = t_0;
} else if (x <= 12.8) {
tmp = (-0.5 * Math.log(y)) - z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (1.0 - (z / x)) * x tmp = 0 if x <= -780000000.0: tmp = t_0 elif x <= 12.8: tmp = (-0.5 * math.log(y)) - z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(1.0 - Float64(z / x)) * x) tmp = 0.0 if (x <= -780000000.0) tmp = t_0; elseif (x <= 12.8) tmp = Float64(Float64(-0.5 * log(y)) - z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (1.0 - (z / x)) * x; tmp = 0.0; if (x <= -780000000.0) tmp = t_0; elseif (x <= 12.8) tmp = (-0.5 * log(y)) - z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1 - N[(z / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -780000000], t$95$0, If[LessEqual[x, 3602879701896397/281474976710656], N[(N[(-1/2 * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(1 - \frac{z}{x}\right) \cdot x\\
\mathbf{if}\;x \leq -780000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq \frac{3602879701896397}{281474976710656}:\\
\;\;\;\;\frac{-1}{2} \cdot \log y - z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -7.8e8 or 12.800000000000001 < x Initial program 99.8%
lift--.f64N/A
sub-flipN/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites79.2%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6459.7%
Applied rewrites59.7%
Taylor expanded in z around inf
lower-/.f6447.2%
Applied rewrites47.2%
if -7.8e8 < x < 12.800000000000001Initial program 99.8%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6471.9%
Applied rewrites71.9%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f6442.4%
Applied rewrites42.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- 1 (/ z x)) x)))
(if (<= x -115000000)
t_0
(if (<= x 616761790044201/21267647932558653966460912964485513216)
(- z)
t_0))))double code(double x, double y, double z) {
double t_0 = (1.0 - (z / x)) * x;
double tmp;
if (x <= -115000000.0) {
tmp = t_0;
} else if (x <= 2.9e-23) {
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 = (1.0d0 - (z / x)) * x
if (x <= (-115000000.0d0)) then
tmp = t_0
else if (x <= 2.9d-23) 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 = (1.0 - (z / x)) * x;
double tmp;
if (x <= -115000000.0) {
tmp = t_0;
} else if (x <= 2.9e-23) {
tmp = -z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (1.0 - (z / x)) * x tmp = 0 if x <= -115000000.0: tmp = t_0 elif x <= 2.9e-23: tmp = -z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(1.0 - Float64(z / x)) * x) tmp = 0.0 if (x <= -115000000.0) tmp = t_0; elseif (x <= 2.9e-23) tmp = Float64(-z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (1.0 - (z / x)) * x; tmp = 0.0; if (x <= -115000000.0) tmp = t_0; elseif (x <= 2.9e-23) tmp = -z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1 - N[(z / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -115000000], t$95$0, If[LessEqual[x, 616761790044201/21267647932558653966460912964485513216], (-z), t$95$0]]]
\begin{array}{l}
t_0 := \left(1 - \frac{z}{x}\right) \cdot x\\
\mathbf{if}\;x \leq -115000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq \frac{616761790044201}{21267647932558653966460912964485513216}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -1.15e8 or 2.9000000000000002e-23 < x Initial program 99.8%
lift--.f64N/A
sub-flipN/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites79.2%
Taylor expanded in y around 0
lower--.f64N/A
lower-*.f64N/A
lower-log.f6459.7%
Applied rewrites59.7%
Taylor expanded in z around inf
lower-/.f6447.2%
Applied rewrites47.2%
if -1.15e8 < x < 2.9000000000000002e-23Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6430.0%
Applied rewrites30.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.0%
Applied rewrites30.0%
(FPCore (x y z)
:precision binary64
(if (<=
z
-47999999999999996524089971390543551186526799180673510009045877937386533124740660945353317548032)
(- z)
(if (<=
z
400000000000000006223766451786737209707280558768424573347908232172333512465902281305994155966018979070482512347136000)
(* 1 x)
(- z))))double code(double x, double y, double z) {
double tmp;
if (z <= -4.8e+94) {
tmp = -z;
} else if (z <= 4e+116) {
tmp = 1.0 * 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 <= (-4.8d+94)) then
tmp = -z
else if (z <= 4d+116) then
tmp = 1.0d0 * x
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.8e+94) {
tmp = -z;
} else if (z <= 4e+116) {
tmp = 1.0 * x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.8e+94: tmp = -z elif z <= 4e+116: tmp = 1.0 * x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.8e+94) tmp = Float64(-z); elseif (z <= 4e+116) tmp = Float64(1.0 * x); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.8e+94) tmp = -z; elseif (z <= 4e+116) tmp = 1.0 * x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -47999999999999996524089971390543551186526799180673510009045877937386533124740660945353317548032], (-z), If[LessEqual[z, 400000000000000006223766451786737209707280558768424573347908232172333512465902281305994155966018979070482512347136000], N[(1 * x), $MachinePrecision], (-z)]]
\begin{array}{l}
\mathbf{if}\;z \leq -47999999999999996524089971390543551186526799180673510009045877937386533124740660945353317548032:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 400000000000000006223766451786737209707280558768424573347908232172333512465902281305994155966018979070482512347136000:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
if z < -4.7999999999999997e94 or 4.0000000000000001e116 < z Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6430.0%
Applied rewrites30.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.0%
Applied rewrites30.0%
if -4.7999999999999997e94 < z < 4.0000000000000001e116Initial program 99.8%
lift--.f64N/A
sub-flipN/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites79.2%
Taylor expanded in x around inf
Applied rewrites29.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 99.8%
Taylor expanded in z around inf
lower-*.f6430.0%
Applied rewrites30.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6430.0%
Applied rewrites30.0%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z)
:name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
:precision binary64
(- (+ (- x (* (+ y 1/2) (log y))) y) z))