
(FPCore (x y z) :precision binary64 (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))
double code(double x, double y, double z) {
return x + (exp((y * log((y / (z + y))))) / 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 + (exp((y * log((y / (z + y))))) / y)
end function
public static double code(double x, double y, double z) {
return x + (Math.exp((y * Math.log((y / (z + y))))) / y);
}
def code(x, y, z): return x + (math.exp((y * math.log((y / (z + y))))) / y)
function code(x, y, z) return Float64(x + Float64(exp(Float64(y * log(Float64(y / Float64(z + y))))) / y)) end
function tmp = code(x, y, z) tmp = x + (exp((y * log((y / (z + y))))) / y); end
code[x_, y_, z_] := N[(x + N[(N[Exp[N[(y * N[Log[N[(y / N[(z + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\end{array}
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))
double code(double x, double y, double z) {
return x + (exp((y * log((y / (z + y))))) / 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 + (exp((y * log((y / (z + y))))) / y)
end function
public static double code(double x, double y, double z) {
return x + (Math.exp((y * Math.log((y / (z + y))))) / y);
}
def code(x, y, z): return x + (math.exp((y * math.log((y / (z + y))))) / y)
function code(x, y, z) return Float64(x + Float64(exp(Float64(y * log(Float64(y / Float64(z + y))))) / y)) end
function tmp = code(x, y, z) tmp = x + (exp((y * log((y / (z + y))))) / y); end
code[x_, y_, z_] := N[(x + N[(N[Exp[N[(y * N[Log[N[(y / N[(z + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\end{array}
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (/ (exp (- z)) y) x))) (if (<= y -1.25e+36) t_0 (if (<= y 0.0074) (+ x (/ 1.0 y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (exp(-z) / y) + x;
double tmp;
if (y <= -1.25e+36) {
tmp = t_0;
} else if (y <= 0.0074) {
tmp = x + (1.0 / 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 = (exp(-z) / y) + x
if (y <= (-1.25d+36)) then
tmp = t_0
else if (y <= 0.0074d0) then
tmp = x + (1.0d0 / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (Math.exp(-z) / y) + x;
double tmp;
if (y <= -1.25e+36) {
tmp = t_0;
} else if (y <= 0.0074) {
tmp = x + (1.0 / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (math.exp(-z) / y) + x tmp = 0 if y <= -1.25e+36: tmp = t_0 elif y <= 0.0074: tmp = x + (1.0 / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(exp(Float64(-z)) / y) + x) tmp = 0.0 if (y <= -1.25e+36) tmp = t_0; elseif (y <= 0.0074) tmp = Float64(x + Float64(1.0 / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (exp(-z) / y) + x; tmp = 0.0; if (y <= -1.25e+36) tmp = t_0; elseif (y <= 0.0074) tmp = x + (1.0 / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Exp[(-z)], $MachinePrecision] / y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -1.25e+36], t$95$0, If[LessEqual[y, 0.0074], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{e^{-z}}{y} + x\\
\mathbf{if}\;y \leq -1.25 \cdot 10^{+36}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.0074:\\
\;\;\;\;x + \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.24999999999999994e36 or 0.0074000000000000003 < y Initial program 84.8%
Taylor expanded in y around inf
lower-*.f6485.8
Applied rewrites85.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6485.8
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6485.8
Applied rewrites85.8%
if -1.24999999999999994e36 < y < 0.0074000000000000003Initial program 84.8%
Taylor expanded in y around 0
Applied rewrites84.6%
(FPCore (x y z) :precision binary64 (if (<= y -1.8e+36) (fma (/ (/ (- 1.0 z) x) y) x x) (if (<= y 0.0074) (+ x (/ 1.0 y)) (- x (/ -1.0 (fma z y y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.8e+36) {
tmp = fma((((1.0 - z) / x) / y), x, x);
} else if (y <= 0.0074) {
tmp = x + (1.0 / y);
} else {
tmp = x - (-1.0 / fma(z, y, y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.8e+36) tmp = fma(Float64(Float64(Float64(1.0 - z) / x) / y), x, x); elseif (y <= 0.0074) tmp = Float64(x + Float64(1.0 / y)); else tmp = Float64(x - Float64(-1.0 / fma(z, y, y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -1.8e+36], N[(N[(N[(N[(1.0 - z), $MachinePrecision] / x), $MachinePrecision] / y), $MachinePrecision] * x + x), $MachinePrecision], If[LessEqual[y, 0.0074], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(x - N[(-1.0 / N[(z * y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+36}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{1 - z}{x}}{y}, x, x\right)\\
\mathbf{elif}\;y \leq 0.0074:\\
\;\;\;\;x + \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{-1}{\mathsf{fma}\left(z, y, y\right)}\\
\end{array}
\end{array}
if y < -1.7999999999999999e36Initial program 84.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6467.6
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6467.6
Applied rewrites67.6%
lift-+.f64N/A
+-commutativeN/A
sum-to-mult-revN/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
lower-fma.f6463.1
Applied rewrites63.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.3
Applied rewrites65.3%
if -1.7999999999999999e36 < y < 0.0074000000000000003Initial program 84.8%
Taylor expanded in y around 0
Applied rewrites84.6%
if 0.0074000000000000003 < y Initial program 84.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
lift-/.f64N/A
div-flipN/A
lower-special-/.f64N/A
lower-special-/.f6467.6
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6474.3
Applied rewrites74.3%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6474.3
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6474.3
Applied rewrites74.3%
(FPCore (x y z) :precision binary64 (if (<= y 0.0074) (+ x (/ 1.0 y)) (- x (/ -1.0 (fma z y y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.0074) {
tmp = x + (1.0 / y);
} else {
tmp = x - (-1.0 / fma(z, y, y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 0.0074) tmp = Float64(x + Float64(1.0 / y)); else tmp = Float64(x - Float64(-1.0 / fma(z, y, y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 0.0074], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(x - N[(-1.0 / N[(z * y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.0074:\\
\;\;\;\;x + \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{-1}{\mathsf{fma}\left(z, y, y\right)}\\
\end{array}
\end{array}
if y < 0.0074000000000000003Initial program 84.8%
Taylor expanded in y around 0
Applied rewrites84.6%
if 0.0074000000000000003 < y Initial program 84.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
lift-/.f64N/A
div-flipN/A
lower-special-/.f64N/A
lower-special-/.f6467.6
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6474.3
Applied rewrites74.3%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6474.3
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6474.3
Applied rewrites74.3%
(FPCore (x y z) :precision binary64 (+ x (/ 1.0 y)))
double code(double x, double y, double z) {
return x + (1.0 / 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 + (1.0d0 / y)
end function
public static double code(double x, double y, double z) {
return x + (1.0 / y);
}
def code(x, y, z): return x + (1.0 / y)
function code(x, y, z) return Float64(x + Float64(1.0 / y)) end
function tmp = code(x, y, z) tmp = x + (1.0 / y); end
code[x_, y_, z_] := N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{1}{y}
\end{array}
Initial program 84.8%
Taylor expanded in y around 0
Applied rewrites84.6%
(FPCore (x y z) :precision binary64 (if (<= y -7.5e+25) (* 1.0 x) (if (<= y 2.1e-81) (/ 1.0 y) (* 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.5e+25) {
tmp = 1.0 * x;
} else if (y <= 2.1e-81) {
tmp = 1.0 / y;
} 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 (y <= (-7.5d+25)) then
tmp = 1.0d0 * x
else if (y <= 2.1d-81) then
tmp = 1.0d0 / y
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7.5e+25) {
tmp = 1.0 * x;
} else if (y <= 2.1e-81) {
tmp = 1.0 / y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.5e+25: tmp = 1.0 * x elif y <= 2.1e-81: tmp = 1.0 / y else: tmp = 1.0 * x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.5e+25) tmp = Float64(1.0 * x); elseif (y <= 2.1e-81) tmp = Float64(1.0 / y); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7.5e+25) tmp = 1.0 * x; elseif (y <= 2.1e-81) tmp = 1.0 / y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.5e+25], N[(1.0 * x), $MachinePrecision], If[LessEqual[y, 2.1e-81], N[(1.0 / y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+25}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-81}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if y < -7.49999999999999993e25 or 2.0999999999999999e-81 < y Initial program 84.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
lift-+.f64N/A
sum-to-multN/A
lower-special-*.f64N/A
lower-special-+.f64N/A
lower-special-/.f6463.1
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6463.1
Applied rewrites63.1%
Taylor expanded in x around inf
Applied rewrites49.7%
if -7.49999999999999993e25 < y < 2.0999999999999999e-81Initial program 84.8%
Taylor expanded in y around 0
lower-/.f6439.2
Applied rewrites39.2%
(FPCore (x y z) :precision binary64 (* 1.0 x))
double code(double x, double y, double z) {
return 1.0 * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 * x
end function
public static double code(double x, double y, double z) {
return 1.0 * x;
}
def code(x, y, z): return 1.0 * x
function code(x, y, z) return Float64(1.0 * x) end
function tmp = code(x, y, z) tmp = 1.0 * x; end
code[x_, y_, z_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 84.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
lift-+.f64N/A
sum-to-multN/A
lower-special-*.f64N/A
lower-special-+.f64N/A
lower-special-/.f6463.1
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6463.1
Applied rewrites63.1%
Taylor expanded in x around inf
Applied rewrites49.7%
herbie shell --seed 2025154
(FPCore (x y z)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"
:precision binary64
(+ x (/ (exp (* y (log (/ y (+ z y))))) y)))