
(FPCore (x y) :precision binary64 (- (/ x (* y y)) 3.0))
double code(double x, double y) {
return (x / (y * y)) - 3.0;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (y * y)) - 3.0d0
end function
public static double code(double x, double y) {
return (x / (y * y)) - 3.0;
}
def code(x, y): return (x / (y * y)) - 3.0
function code(x, y) return Float64(Float64(x / Float64(y * y)) - 3.0) end
function tmp = code(x, y) tmp = (x / (y * y)) - 3.0; end
code[x_, y_] := N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y \cdot y} - 3
\end{array}
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (- (/ x (* y y)) 3.0))
double code(double x, double y) {
return (x / (y * y)) - 3.0;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (y * y)) - 3.0d0
end function
public static double code(double x, double y) {
return (x / (y * y)) - 3.0;
}
def code(x, y): return (x / (y * y)) - 3.0
function code(x, y) return Float64(Float64(x / Float64(y * y)) - 3.0) end
function tmp = code(x, y) tmp = (x / (y * y)) - 3.0; end
code[x_, y_] := N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y \cdot y} - 3
\end{array}
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= y_m 2e-153) (/ (/ x y_m) y_m) (- (/ x (* y_m y_m)) 3.0)))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if (y_m <= 2e-153) {
tmp = (x / y_m) / y_m;
} else {
tmp = (x / (y_m * y_m)) - 3.0;
}
return tmp;
}
y_m = private
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_m)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: tmp
if (y_m <= 2d-153) then
tmp = (x / y_m) / y_m
else
tmp = (x / (y_m * y_m)) - 3.0d0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double tmp;
if (y_m <= 2e-153) {
tmp = (x / y_m) / y_m;
} else {
tmp = (x / (y_m * y_m)) - 3.0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): tmp = 0 if y_m <= 2e-153: tmp = (x / y_m) / y_m else: tmp = (x / (y_m * y_m)) - 3.0 return tmp
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (y_m <= 2e-153) tmp = Float64(Float64(x / y_m) / y_m); else tmp = Float64(Float64(x / Float64(y_m * y_m)) - 3.0); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) tmp = 0.0; if (y_m <= 2e-153) tmp = (x / y_m) / y_m; else tmp = (x / (y_m * y_m)) - 3.0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[y$95$m, 2e-153], N[(N[(x / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(x / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 2 \cdot 10^{-153}:\\
\;\;\;\;\frac{\frac{x}{y\_m}}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m \cdot y\_m} - 3\\
\end{array}
\end{array}
if y < 2.00000000000000008e-153Initial program 94.2%
Taylor expanded in x around inf
pow2N/A
lift-/.f64N/A
lift-*.f6445.3
Applied rewrites45.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-/.f64N/A
lift-/.f6451.0
Applied rewrites51.0%
if 2.00000000000000008e-153 < y Initial program 94.2%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (- (/ (/ x y_m) y_m) 3.0))
y_m = fabs(y);
double code(double x, double y_m) {
return ((x / y_m) / y_m) - 3.0;
}
y_m = private
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_m)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = ((x / y_m) / y_m) - 3.0d0
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return ((x / y_m) / y_m) - 3.0;
}
y_m = math.fabs(y) def code(x, y_m): return ((x / y_m) / y_m) - 3.0
y_m = abs(y) function code(x, y_m) return Float64(Float64(Float64(x / y_m) / y_m) - 3.0) end
y_m = abs(y); function tmp = code(x, y_m) tmp = ((x / y_m) / y_m) - 3.0; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[(N[(x / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] - 3.0), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{\frac{x}{y\_m}}{y\_m} - 3
\end{array}
Initial program 94.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (let* ((t_0 (- (/ x (* y_m y_m)) 3.0)) (t_1 (/ (/ x y_m) y_m))) (if (<= t_0 -1e+17) t_1 (if (<= t_0 -2.0) -3.0 t_1))))
y_m = fabs(y);
double code(double x, double y_m) {
double t_0 = (x / (y_m * y_m)) - 3.0;
double t_1 = (x / y_m) / y_m;
double tmp;
if (t_0 <= -1e+17) {
tmp = t_1;
} else if (t_0 <= -2.0) {
tmp = -3.0;
} else {
tmp = t_1;
}
return tmp;
}
y_m = private
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_m)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (x / (y_m * y_m)) - 3.0d0
t_1 = (x / y_m) / y_m
if (t_0 <= (-1d+17)) then
tmp = t_1
else if (t_0 <= (-2.0d0)) then
tmp = -3.0d0
else
tmp = t_1
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double t_0 = (x / (y_m * y_m)) - 3.0;
double t_1 = (x / y_m) / y_m;
double tmp;
if (t_0 <= -1e+17) {
tmp = t_1;
} else if (t_0 <= -2.0) {
tmp = -3.0;
} else {
tmp = t_1;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): t_0 = (x / (y_m * y_m)) - 3.0 t_1 = (x / y_m) / y_m tmp = 0 if t_0 <= -1e+17: tmp = t_1 elif t_0 <= -2.0: tmp = -3.0 else: tmp = t_1 return tmp
y_m = abs(y) function code(x, y_m) t_0 = Float64(Float64(x / Float64(y_m * y_m)) - 3.0) t_1 = Float64(Float64(x / y_m) / y_m) tmp = 0.0 if (t_0 <= -1e+17) tmp = t_1; elseif (t_0 <= -2.0) tmp = -3.0; else tmp = t_1; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) t_0 = (x / (y_m * y_m)) - 3.0; t_1 = (x / y_m) / y_m; tmp = 0.0; if (t_0 <= -1e+17) tmp = t_1; elseif (t_0 <= -2.0) tmp = -3.0; else tmp = t_1; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(N[(x / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+17], t$95$1, If[LessEqual[t$95$0, -2.0], -3.0, t$95$1]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x}{y\_m \cdot y\_m} - 3\\
t_1 := \frac{\frac{x}{y\_m}}{y\_m}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq -2:\\
\;\;\;\;-3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (*.f64 y y)) #s(literal 3 binary64)) < -1e17 or -2 < (-.f64 (/.f64 x (*.f64 y y)) #s(literal 3 binary64)) Initial program 94.2%
Taylor expanded in x around inf
pow2N/A
lift-/.f64N/A
lift-*.f6445.3
Applied rewrites45.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-/.f64N/A
lift-/.f6451.0
Applied rewrites51.0%
if -1e17 < (-.f64 (/.f64 x (*.f64 y y)) #s(literal 3 binary64)) < -2Initial program 94.2%
Taylor expanded in x around 0
Applied rewrites50.9%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (let* ((t_0 (/ x (* y_m y_m))) (t_1 (- t_0 3.0))) (if (<= t_1 -1e+17) t_0 (if (<= t_1 -2.0) -3.0 t_0))))
y_m = fabs(y);
double code(double x, double y_m) {
double t_0 = x / (y_m * y_m);
double t_1 = t_0 - 3.0;
double tmp;
if (t_1 <= -1e+17) {
tmp = t_0;
} else if (t_1 <= -2.0) {
tmp = -3.0;
} else {
tmp = t_0;
}
return tmp;
}
y_m = private
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_m)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (y_m * y_m)
t_1 = t_0 - 3.0d0
if (t_1 <= (-1d+17)) then
tmp = t_0
else if (t_1 <= (-2.0d0)) then
tmp = -3.0d0
else
tmp = t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double t_0 = x / (y_m * y_m);
double t_1 = t_0 - 3.0;
double tmp;
if (t_1 <= -1e+17) {
tmp = t_0;
} else if (t_1 <= -2.0) {
tmp = -3.0;
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): t_0 = x / (y_m * y_m) t_1 = t_0 - 3.0 tmp = 0 if t_1 <= -1e+17: tmp = t_0 elif t_1 <= -2.0: tmp = -3.0 else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m) t_0 = Float64(x / Float64(y_m * y_m)) t_1 = Float64(t_0 - 3.0) tmp = 0.0 if (t_1 <= -1e+17) tmp = t_0; elseif (t_1 <= -2.0) tmp = -3.0; else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) t_0 = x / (y_m * y_m); t_1 = t_0 - 3.0; tmp = 0.0; if (t_1 <= -1e+17) tmp = t_0; elseif (t_1 <= -2.0) tmp = -3.0; else tmp = t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(x / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - 3.0), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+17], t$95$0, If[LessEqual[t$95$1, -2.0], -3.0, t$95$0]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x}{y\_m \cdot y\_m}\\
t_1 := t\_0 - 3\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq -2:\\
\;\;\;\;-3\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (*.f64 y y)) #s(literal 3 binary64)) < -1e17 or -2 < (-.f64 (/.f64 x (*.f64 y y)) #s(literal 3 binary64)) Initial program 94.2%
Taylor expanded in x around inf
pow2N/A
lift-/.f64N/A
lift-*.f6445.3
Applied rewrites45.3%
if -1e17 < (-.f64 (/.f64 x (*.f64 y y)) #s(literal 3 binary64)) < -2Initial program 94.2%
Taylor expanded in x around 0
Applied rewrites50.9%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 -3.0)
y_m = fabs(y);
double code(double x, double y_m) {
return -3.0;
}
y_m = private
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_m)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = -3.0d0
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return -3.0;
}
y_m = math.fabs(y) def code(x, y_m): return -3.0
y_m = abs(y) function code(x, y_m) return -3.0 end
y_m = abs(y); function tmp = code(x, y_m) tmp = -3.0; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := -3.0
\begin{array}{l}
y_m = \left|y\right|
\\
-3
\end{array}
Initial program 94.2%
Taylor expanded in x around 0
Applied rewrites50.9%
herbie shell --seed 2025123
(FPCore (x y)
:name "Statistics.Sample:$skurtosis from math-functions-0.1.5.2"
:precision binary64
(- (/ x (* y y)) 3.0))