
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + y) - z;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + y) - z;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
(FPCore (x y z) :precision binary64 (- x (- (* (- 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(x - Float64(Float64(Float64(y - -0.5) * log(y)) - Float64(y - z))) end
function tmp = code(x, y, z) tmp = x - (((y - -0.5) * log(y)) - (y - z)); end
code[x_, y_, z_] := N[(x - N[(N[(N[(y - -0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(\left(y - -0.5\right) \cdot \log y - \left(y - z\right)\right)
\end{array}
Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites99.8%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f6499.8
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (- (+ y x) (fma (log y) (- y -0.5) z)))
double code(double x, double y, double z) {
return (y + x) - fma(log(y), (y - -0.5), z);
}
function code(x, y, z) return Float64(Float64(y + x) - fma(log(y), Float64(y - -0.5), z)) end
code[x_, y_, z_] := N[(N[(y + x), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * N[(y - -0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + x\right) - \mathsf{fma}\left(\log y, y - -0.5, z\right)
\end{array}
Initial program 99.8%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6499.8
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (if (<= y 3.8e-5) (+ (- x (* (log y) (- y -0.5))) (- z)) (+ (- x (* (- y) (- (log y)))) (- y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.8e-5) {
tmp = (x - (log(y) * (y - -0.5))) + -z;
} else {
tmp = (x - (-y * -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 <= 3.8d-5) then
tmp = (x - (log(y) * (y - (-0.5d0)))) + -z
else
tmp = (x - (-y * -log(y))) + (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.8e-5) {
tmp = (x - (Math.log(y) * (y - -0.5))) + -z;
} else {
tmp = (x - (-y * -Math.log(y))) + (y - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.8e-5: tmp = (x - (math.log(y) * (y - -0.5))) + -z else: tmp = (x - (-y * -math.log(y))) + (y - z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.8e-5) tmp = Float64(Float64(x - Float64(log(y) * Float64(y - -0.5))) + Float64(-z)); else tmp = Float64(Float64(x - Float64(Float64(-y) * Float64(-log(y)))) + Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.8e-5) tmp = (x - (log(y) * (y - -0.5))) + -z; else tmp = (x - (-y * -log(y))) + (y - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.8e-5], N[(N[(x - N[(N[Log[y], $MachinePrecision] * N[(y - -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-z)), $MachinePrecision], N[(N[(x - N[((-y) * (-N[Log[y], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.8 \cdot 10^{-5}:\\
\;\;\;\;\left(x - \log y \cdot \left(y - -0.5\right)\right) + \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - \left(-y\right) \cdot \left(-\log y\right)\right) + \left(y - z\right)\\
\end{array}
\end{array}
if y < 3.8000000000000002e-5Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites99.8%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6479.5
Applied rewrites79.5%
if 3.8000000000000002e-5 < y Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
neg-logN/A
lift-neg.f64N/A
lift-log.f6486.7
Applied rewrites86.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (- x (* (log y) (- y -0.5))) (- z))))
(if (<= z -2.8e+63)
t_0
(if (<= z 1.7e+102) (- x (- (* (+ 0.5 y) (log y)) y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (x - (log(y) * (y - -0.5))) + -z;
double tmp;
if (z <= -2.8e+63) {
tmp = t_0;
} else if (z <= 1.7e+102) {
tmp = x - (((0.5 + y) * log(y)) - 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 - (log(y) * (y - (-0.5d0)))) + -z
if (z <= (-2.8d+63)) then
tmp = t_0
else if (z <= 1.7d+102) then
tmp = x - (((0.5d0 + y) * log(y)) - 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 - (Math.log(y) * (y - -0.5))) + -z;
double tmp;
if (z <= -2.8e+63) {
tmp = t_0;
} else if (z <= 1.7e+102) {
tmp = x - (((0.5 + y) * Math.log(y)) - y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x - (math.log(y) * (y - -0.5))) + -z tmp = 0 if z <= -2.8e+63: tmp = t_0 elif z <= 1.7e+102: tmp = x - (((0.5 + y) * math.log(y)) - y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x - Float64(log(y) * Float64(y - -0.5))) + Float64(-z)) tmp = 0.0 if (z <= -2.8e+63) tmp = t_0; elseif (z <= 1.7e+102) tmp = Float64(x - Float64(Float64(Float64(0.5 + y) * log(y)) - y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x - (log(y) * (y - -0.5))) + -z; tmp = 0.0; if (z <= -2.8e+63) tmp = t_0; elseif (z <= 1.7e+102) tmp = x - (((0.5 + y) * log(y)) - y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - N[(N[Log[y], $MachinePrecision] * N[(y - -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-z)), $MachinePrecision]}, If[LessEqual[z, -2.8e+63], t$95$0, If[LessEqual[z, 1.7e+102], N[(x - N[(N[(N[(0.5 + y), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x - \log y \cdot \left(y - -0.5\right)\right) + \left(-z\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+63}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+102}:\\
\;\;\;\;x - \left(\left(0.5 + y\right) \cdot \log y - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.79999999999999987e63 or 1.7e102 < z Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites99.8%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6479.5
Applied rewrites79.5%
if -2.79999999999999987e63 < z < 1.7e102Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites99.8%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
lift-log.f6471.6
Applied rewrites71.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (- x (log (sqrt y))) z)))
(if (<= z -3.2e+63)
t_0
(if (<= z 1.7e+102) (- x (- (* (+ 0.5 y) (log y)) y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (x - log(sqrt(y))) - z;
double tmp;
if (z <= -3.2e+63) {
tmp = t_0;
} else if (z <= 1.7e+102) {
tmp = x - (((0.5 + y) * log(y)) - 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 - log(sqrt(y))) - z
if (z <= (-3.2d+63)) then
tmp = t_0
else if (z <= 1.7d+102) then
tmp = x - (((0.5d0 + y) * log(y)) - 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 - Math.log(Math.sqrt(y))) - z;
double tmp;
if (z <= -3.2e+63) {
tmp = t_0;
} else if (z <= 1.7e+102) {
tmp = x - (((0.5 + y) * Math.log(y)) - y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x - math.log(math.sqrt(y))) - z tmp = 0 if z <= -3.2e+63: tmp = t_0 elif z <= 1.7e+102: tmp = x - (((0.5 + y) * math.log(y)) - y) 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 <= -3.2e+63) tmp = t_0; elseif (z <= 1.7e+102) tmp = Float64(x - Float64(Float64(Float64(0.5 + y) * log(y)) - y)); 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 <= -3.2e+63) tmp = t_0; elseif (z <= 1.7e+102) tmp = x - (((0.5 + y) * log(y)) - y); 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, -3.2e+63], t$95$0, If[LessEqual[z, 1.7e+102], N[(x - N[(N[(N[(0.5 + y), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $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 -3.2 \cdot 10^{+63}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+102}:\\
\;\;\;\;x - \left(\left(0.5 + y\right) \cdot \log y - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.20000000000000011e63 or 1.7e102 < z Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6471.0
Applied rewrites71.0%
if -3.20000000000000011e63 < z < 1.7e102Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites99.8%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
lift-log.f6471.6
Applied rewrites71.6%
(FPCore (x y z) :precision binary64 (if (<= y 2.65e+45) (- (- x (log (sqrt y))) z) (- x (* (- (log y) 1.0) y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.65e+45) {
tmp = (x - log(sqrt(y))) - z;
} else {
tmp = x - ((log(y) - 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 <= 2.65d+45) then
tmp = (x - log(sqrt(y))) - z
else
tmp = x - ((log(y) - 1.0d0) * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.65e+45) {
tmp = (x - Math.log(Math.sqrt(y))) - z;
} else {
tmp = x - ((Math.log(y) - 1.0) * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.65e+45: tmp = (x - math.log(math.sqrt(y))) - z else: tmp = x - ((math.log(y) - 1.0) * y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.65e+45) tmp = Float64(Float64(x - log(sqrt(y))) - z); else tmp = Float64(x - Float64(Float64(log(y) - 1.0) * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.65e+45) tmp = (x - log(sqrt(y))) - z; else tmp = x - ((log(y) - 1.0) * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.65e+45], N[(N[(x - N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(x - N[(N[(N[Log[y], $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.65 \cdot 10^{+45}:\\
\;\;\;\;\left(x - \log \left(\sqrt{y}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x - \left(\log y - 1\right) \cdot y\\
\end{array}
\end{array}
if y < 2.64999999999999996e45Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6471.0
Applied rewrites71.0%
if 2.64999999999999996e45 < y Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites99.8%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
*-commutativeN/A
mul-1-negN/A
neg-logN/A
remove-double-negN/A
lower-*.f64N/A
lower--.f64N/A
lift-log.f6459.0
Applied rewrites59.0%
(FPCore (x y z) :precision binary64 (if (<= y 1.15e+121) (- (- x (log (sqrt y))) z) (* (- 1.0 (log y)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.15e+121) {
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.15d+121) 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.15e+121) {
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.15e+121: 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.15e+121) 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.15e+121) 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.15e+121], 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.15 \cdot 10^{+121}:\\
\;\;\;\;\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.1499999999999999e121Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6471.0
Applied rewrites71.0%
if 1.1499999999999999e121 < y Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites99.8%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
*-commutativeN/A
mul-1-negN/A
neg-logN/A
remove-double-negN/A
lower-*.f64N/A
lower--.f64N/A
lift-log.f6430.5
Applied rewrites30.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (- y) (- (/ x y))) z))
(t_1 (+ (- x (* (+ y 0.5) (log y))) y))
(t_2 (* (- 1.0 (log y)) y)))
(if (<= t_1 -1e+151)
t_2
(if (<= t_1 -1e+86)
t_0
(if (<= t_1 -4e+50)
t_2
(if (<= t_1 500.0)
(- (- (log (sqrt y))) z)
(if (<= t_1 1e+177) t_0 (* 1.0 x))))))))
double code(double x, double y, double z) {
double t_0 = (-y * -(x / y)) - z;
double t_1 = (x - ((y + 0.5) * log(y))) + y;
double t_2 = (1.0 - log(y)) * y;
double tmp;
if (t_1 <= -1e+151) {
tmp = t_2;
} else if (t_1 <= -1e+86) {
tmp = t_0;
} else if (t_1 <= -4e+50) {
tmp = t_2;
} else if (t_1 <= 500.0) {
tmp = -log(sqrt(y)) - z;
} else if (t_1 <= 1e+177) {
tmp = t_0;
} else {
tmp = 1.0 * 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (-y * -(x / y)) - z
t_1 = (x - ((y + 0.5d0) * log(y))) + y
t_2 = (1.0d0 - log(y)) * y
if (t_1 <= (-1d+151)) then
tmp = t_2
else if (t_1 <= (-1d+86)) then
tmp = t_0
else if (t_1 <= (-4d+50)) then
tmp = t_2
else if (t_1 <= 500.0d0) then
tmp = -log(sqrt(y)) - z
else if (t_1 <= 1d+177) then
tmp = t_0
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (-y * -(x / y)) - z;
double t_1 = (x - ((y + 0.5) * Math.log(y))) + y;
double t_2 = (1.0 - Math.log(y)) * y;
double tmp;
if (t_1 <= -1e+151) {
tmp = t_2;
} else if (t_1 <= -1e+86) {
tmp = t_0;
} else if (t_1 <= -4e+50) {
tmp = t_2;
} else if (t_1 <= 500.0) {
tmp = -Math.log(Math.sqrt(y)) - z;
} else if (t_1 <= 1e+177) {
tmp = t_0;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): t_0 = (-y * -(x / y)) - z t_1 = (x - ((y + 0.5) * math.log(y))) + y t_2 = (1.0 - math.log(y)) * y tmp = 0 if t_1 <= -1e+151: tmp = t_2 elif t_1 <= -1e+86: tmp = t_0 elif t_1 <= -4e+50: tmp = t_2 elif t_1 <= 500.0: tmp = -math.log(math.sqrt(y)) - z elif t_1 <= 1e+177: tmp = t_0 else: tmp = 1.0 * x return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(-y) * Float64(-Float64(x / y))) - 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 <= -1e+151) tmp = t_2; elseif (t_1 <= -1e+86) tmp = t_0; elseif (t_1 <= -4e+50) tmp = t_2; elseif (t_1 <= 500.0) tmp = Float64(Float64(-log(sqrt(y))) - z); elseif (t_1 <= 1e+177) tmp = t_0; else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (-y * -(x / y)) - z; t_1 = (x - ((y + 0.5) * log(y))) + y; t_2 = (1.0 - log(y)) * y; tmp = 0.0; if (t_1 <= -1e+151) tmp = t_2; elseif (t_1 <= -1e+86) tmp = t_0; elseif (t_1 <= -4e+50) tmp = t_2; elseif (t_1 <= 500.0) tmp = -log(sqrt(y)) - z; elseif (t_1 <= 1e+177) tmp = t_0; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[((-y) * (-N[(x / y), $MachinePrecision])), $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, -1e+151], t$95$2, If[LessEqual[t$95$1, -1e+86], t$95$0, If[LessEqual[t$95$1, -4e+50], t$95$2, If[LessEqual[t$95$1, 500.0], N[((-N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]) - z), $MachinePrecision], If[LessEqual[t$95$1, 1e+177], t$95$0, N[(1.0 * x), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-y\right) \cdot \left(-\frac{x}{y}\right) - z\\
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 -1 \cdot 10^{+151}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+86}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{+50}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 500:\\
\;\;\;\;\left(-\log \left(\sqrt{y}\right)\right) - z\\
\mathbf{elif}\;t\_1 \leq 10^{+177}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -1.00000000000000002e151 or -1e86 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -4.0000000000000003e50Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites99.8%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
*-commutativeN/A
mul-1-negN/A
neg-logN/A
remove-double-negN/A
lower-*.f64N/A
lower--.f64N/A
lift-log.f6430.5
Applied rewrites30.5%
if -1.00000000000000002e151 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -1e86 or 500 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 1e177Initial program 99.8%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
Applied rewrites87.9%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6446.2
Applied rewrites46.2%
if -4.0000000000000003e50 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 500Initial program 99.8%
Taylor expanded in y around 0
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6469.9
Applied rewrites69.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f6469.9
Applied rewrites69.9%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-log.f6471.0
Applied rewrites71.0%
Taylor expanded in x around 0
mul-1-negN/A
pow1/2N/A
log-pow-revN/A
lower-neg.f64N/A
log-pow-revN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-log.f6442.1
Applied rewrites42.1%
if 1e177 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.5%
Taylor expanded in x around inf
Applied rewrites30.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (- y) (- (/ x y))) z)))
(if (<= x -1.95e+155)
(* 1.0 x)
(if (<= x -5.2e+42)
t_0
(if (<= x 24000000000000.0)
(- (- (log (sqrt y))) z)
(if (<= x 1.75e+179) t_0 (* 1.0 x)))))))
double code(double x, double y, double z) {
double t_0 = (-y * -(x / y)) - z;
double tmp;
if (x <= -1.95e+155) {
tmp = 1.0 * x;
} else if (x <= -5.2e+42) {
tmp = t_0;
} else if (x <= 24000000000000.0) {
tmp = -log(sqrt(y)) - z;
} else if (x <= 1.75e+179) {
tmp = t_0;
} else {
tmp = 1.0 * 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 = (-y * -(x / y)) - z
if (x <= (-1.95d+155)) then
tmp = 1.0d0 * x
else if (x <= (-5.2d+42)) then
tmp = t_0
else if (x <= 24000000000000.0d0) then
tmp = -log(sqrt(y)) - z
else if (x <= 1.75d+179) then
tmp = t_0
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (-y * -(x / y)) - z;
double tmp;
if (x <= -1.95e+155) {
tmp = 1.0 * x;
} else if (x <= -5.2e+42) {
tmp = t_0;
} else if (x <= 24000000000000.0) {
tmp = -Math.log(Math.sqrt(y)) - z;
} else if (x <= 1.75e+179) {
tmp = t_0;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): t_0 = (-y * -(x / y)) - z tmp = 0 if x <= -1.95e+155: tmp = 1.0 * x elif x <= -5.2e+42: tmp = t_0 elif x <= 24000000000000.0: tmp = -math.log(math.sqrt(y)) - z elif x <= 1.75e+179: tmp = t_0 else: tmp = 1.0 * x return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(-y) * Float64(-Float64(x / y))) - z) tmp = 0.0 if (x <= -1.95e+155) tmp = Float64(1.0 * x); elseif (x <= -5.2e+42) tmp = t_0; elseif (x <= 24000000000000.0) tmp = Float64(Float64(-log(sqrt(y))) - z); elseif (x <= 1.75e+179) tmp = t_0; else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (-y * -(x / y)) - z; tmp = 0.0; if (x <= -1.95e+155) tmp = 1.0 * x; elseif (x <= -5.2e+42) tmp = t_0; elseif (x <= 24000000000000.0) tmp = -log(sqrt(y)) - z; elseif (x <= 1.75e+179) tmp = t_0; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[((-y) * (-N[(x / y), $MachinePrecision])), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[x, -1.95e+155], N[(1.0 * x), $MachinePrecision], If[LessEqual[x, -5.2e+42], t$95$0, If[LessEqual[x, 24000000000000.0], N[((-N[Log[N[Sqrt[y], $MachinePrecision]], $MachinePrecision]) - z), $MachinePrecision], If[LessEqual[x, 1.75e+179], t$95$0, N[(1.0 * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-y\right) \cdot \left(-\frac{x}{y}\right) - z\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{+155}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{+42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 24000000000000:\\
\;\;\;\;\left(-\log \left(\sqrt{y}\right)\right) - z\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+179}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if x < -1.9499999999999999e155 or 1.75000000000000007e179 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.5%
Taylor expanded in x around inf
Applied rewrites30.6%
if -1.9499999999999999e155 < x < -5.1999999999999998e42 or 2.4e13 < x < 1.75000000000000007e179Initial program 99.8%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
Applied rewrites87.9%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6446.2
Applied rewrites46.2%
if -5.1999999999999998e42 < x < 2.4e13Initial program 99.8%
Taylor expanded in y around 0
log-pow-revN/A
lower-log.f64N/A
unpow1/2N/A
lower-sqrt.f6469.9
Applied rewrites69.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f6469.9
Applied rewrites69.9%
Taylor expanded in y around 0
lower--.f64N/A
log-pow-revN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-log.f6471.0
Applied rewrites71.0%
Taylor expanded in x around 0
mul-1-negN/A
pow1/2N/A
log-pow-revN/A
lower-neg.f64N/A
log-pow-revN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-log.f6442.1
Applied rewrites42.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.95e+155) (* 1.0 x) (if (<= x 1.75e+179) (- (* (- y) (- (/ x y))) z) (* 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.95e+155) {
tmp = 1.0 * x;
} else if (x <= 1.75e+179) {
tmp = (-y * -(x / y)) - z;
} else {
tmp = 1.0 * 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 <= (-1.95d+155)) then
tmp = 1.0d0 * x
else if (x <= 1.75d+179) then
tmp = (-y * -(x / y)) - z
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.95e+155) {
tmp = 1.0 * x;
} else if (x <= 1.75e+179) {
tmp = (-y * -(x / y)) - z;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.95e+155: tmp = 1.0 * x elif x <= 1.75e+179: tmp = (-y * -(x / y)) - z else: tmp = 1.0 * x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.95e+155) tmp = Float64(1.0 * x); elseif (x <= 1.75e+179) tmp = Float64(Float64(Float64(-y) * Float64(-Float64(x / y))) - z); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.95e+155) tmp = 1.0 * x; elseif (x <= 1.75e+179) tmp = (-y * -(x / y)) - z; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.95e+155], N[(1.0 * x), $MachinePrecision], If[LessEqual[x, 1.75e+179], N[(N[((-y) * (-N[(x / y), $MachinePrecision])), $MachinePrecision] - z), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{+155}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+179}:\\
\;\;\;\;\left(-y\right) \cdot \left(-\frac{x}{y}\right) - z\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if x < -1.9499999999999999e155 or 1.75000000000000007e179 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.5%
Taylor expanded in x around inf
Applied rewrites30.6%
if -1.9499999999999999e155 < x < 1.75000000000000007e179Initial program 99.8%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
Applied rewrites87.9%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6446.2
Applied rewrites46.2%
(FPCore (x y z) :precision binary64 (if (<= x -4e+70) (* 1.0 x) (if (<= x 2.25e+41) (- z) (* 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4e+70) {
tmp = 1.0 * x;
} else if (x <= 2.25e+41) {
tmp = -z;
} else {
tmp = 1.0 * 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 <= (-4d+70)) then
tmp = 1.0d0 * x
else if (x <= 2.25d+41) then
tmp = -z
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4e+70) {
tmp = 1.0 * x;
} else if (x <= 2.25e+41) {
tmp = -z;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4e+70: tmp = 1.0 * x elif x <= 2.25e+41: tmp = -z else: tmp = 1.0 * x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4e+70) tmp = Float64(1.0 * x); elseif (x <= 2.25e+41) tmp = Float64(-z); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4e+70) tmp = 1.0 * x; elseif (x <= 2.25e+41) tmp = -z; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4e+70], N[(1.0 * x), $MachinePrecision], If[LessEqual[x, 2.25e+41], (-z), N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+70}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{+41}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if x < -4.00000000000000029e70 or 2.2500000000000001e41 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.5%
Taylor expanded in x around inf
Applied rewrites30.6%
if -4.00000000000000029e70 < x < 2.2500000000000001e41Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6429.3
Applied rewrites29.3%
(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
mul-1-negN/A
lower-neg.f6429.3
Applied rewrites29.3%
herbie shell --seed 2025139
(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))