
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
return x + (fabs((y - x)) / 2.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 + (abs((y - x)) / 2.0d0)
end function
public static double code(double x, double y) {
return x + (Math.abs((y - x)) / 2.0);
}
def code(x, y): return x + (math.fabs((y - x)) / 2.0)
function code(x, y) return Float64(x + Float64(abs(Float64(y - x)) / 2.0)) end
function tmp = code(x, y) tmp = x + (abs((y - x)) / 2.0); end
code[x_, y_] := N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left|y - x\right|}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
return x + (fabs((y - x)) / 2.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 + (abs((y - x)) / 2.0d0)
end function
public static double code(double x, double y) {
return x + (Math.abs((y - x)) / 2.0);
}
def code(x, y): return x + (math.fabs((y - x)) / 2.0)
function code(x, y) return Float64(x + Float64(abs(Float64(y - x)) / 2.0)) end
function tmp = code(x, y) tmp = x + (abs((y - x)) / 2.0); end
code[x_, y_] := N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left|y - x\right|}{2}
\end{array}
(FPCore (x y) :precision binary64 (fma 0.5 (fabs (- y x)) x))
double code(double x, double y) {
return fma(0.5, fabs((y - x)), x);
}
function code(x, y) return fma(0.5, abs(Float64(y - x)), x) end
code[x_, y_] := N[(0.5 * N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(0.5, \left|y - x\right|, x\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= (+ x (/ (fabs (- y x)) 2.0)) -4e-229) (* 0.5 x) (fma (- x y) 0.5 x)))
double code(double x, double y) {
double tmp;
if ((x + (fabs((y - x)) / 2.0)) <= -4e-229) {
tmp = 0.5 * x;
} else {
tmp = fma((x - y), 0.5, x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (Float64(x + Float64(abs(Float64(y - x)) / 2.0)) <= -4e-229) tmp = Float64(0.5 * x); else tmp = fma(Float64(x - y), 0.5, x); end return tmp end
code[x_, y_] := If[LessEqual[N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], -4e-229], N[(0.5 * x), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * 0.5 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + \frac{\left|y - x\right|}{2} \leq -4 \cdot 10^{-229}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (fabs.f64 (-.f64 y x)) #s(literal 2 binary64))) < -4.00000000000000028e-229Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.2
Applied rewrites80.2%
Taylor expanded in x around 0
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-unprodN/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6497.9
Applied rewrites97.9%
Taylor expanded in x around inf
lower-*.f6498.0
Applied rewrites98.0%
if -4.00000000000000028e-229 < (+.f64 x (/.f64 (fabs.f64 (-.f64 y x)) #s(literal 2 binary64))) Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
lift--.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift--.f64N/A
lower-sqrt.f64N/A
lift--.f6467.1
Applied rewrites67.1%
lift-fma.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-fma.f6467.1
Applied rewrites67.7%
(FPCore (x y) :precision binary64 (if (<= (+ x (/ (fabs (- y x)) 2.0)) -4e-229) (* 0.5 x) (* -0.5 y)))
double code(double x, double y) {
double tmp;
if ((x + (fabs((y - x)) / 2.0)) <= -4e-229) {
tmp = 0.5 * x;
} else {
tmp = -0.5 * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x + (abs((y - x)) / 2.0d0)) <= (-4d-229)) then
tmp = 0.5d0 * x
else
tmp = (-0.5d0) * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x + (Math.abs((y - x)) / 2.0)) <= -4e-229) {
tmp = 0.5 * x;
} else {
tmp = -0.5 * y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x + (math.fabs((y - x)) / 2.0)) <= -4e-229: tmp = 0.5 * x else: tmp = -0.5 * y return tmp
function code(x, y) tmp = 0.0 if (Float64(x + Float64(abs(Float64(y - x)) / 2.0)) <= -4e-229) tmp = Float64(0.5 * x); else tmp = Float64(-0.5 * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x + (abs((y - x)) / 2.0)) <= -4e-229) tmp = 0.5 * x; else tmp = -0.5 * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], -4e-229], N[(0.5 * x), $MachinePrecision], N[(-0.5 * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + \frac{\left|y - x\right|}{2} \leq -4 \cdot 10^{-229}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot y\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (fabs.f64 (-.f64 y x)) #s(literal 2 binary64))) < -4.00000000000000028e-229Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6480.2
Applied rewrites80.2%
Taylor expanded in x around 0
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-unprodN/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6497.9
Applied rewrites97.9%
Taylor expanded in x around inf
lower-*.f6498.0
Applied rewrites98.0%
if -4.00000000000000028e-229 < (+.f64 x (/.f64 (fabs.f64 (-.f64 y x)) #s(literal 2 binary64))) Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
lift--.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift--.f64N/A
lower-sqrt.f64N/A
lift--.f6467.1
Applied rewrites67.1%
Taylor expanded in x around 0
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
rem-sqrt-square-revN/A
lower-*.f6433.8
Applied rewrites33.8%
(FPCore (x y) :precision binary64 (if (<= y -6.4e-119) (fma 1.5 x (* -0.5 y)) (if (<= y 3.7e-35) (fma 0.5 (fabs x) x) (fma 0.5 (fabs (- y)) x))))
double code(double x, double y) {
double tmp;
if (y <= -6.4e-119) {
tmp = fma(1.5, x, (-0.5 * y));
} else if (y <= 3.7e-35) {
tmp = fma(0.5, fabs(x), x);
} else {
tmp = fma(0.5, fabs(-y), x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -6.4e-119) tmp = fma(1.5, x, Float64(-0.5 * y)); elseif (y <= 3.7e-35) tmp = fma(0.5, abs(x), x); else tmp = fma(0.5, abs(Float64(-y)), x); end return tmp end
code[x_, y_] := If[LessEqual[y, -6.4e-119], N[(1.5 * x + N[(-0.5 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.7e-35], N[(0.5 * N[Abs[x], $MachinePrecision] + x), $MachinePrecision], N[(0.5 * N[Abs[(-y)], $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.4 \cdot 10^{-119}:\\
\;\;\;\;\mathsf{fma}\left(1.5, x, -0.5 \cdot y\right)\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \left|x\right|, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \left|-y\right|, x\right)\\
\end{array}
\end{array}
if y < -6.39999999999999986e-119Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
lift--.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift--.f64N/A
lower-sqrt.f64N/A
lift--.f6489.6
Applied rewrites89.6%
Taylor expanded in x around 0
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
rem-sqrt-square-revN/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6492.1
Applied rewrites92.1%
if -6.39999999999999986e-119 < y < 3.6999999999999999e-35Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites85.5%
if 3.6999999999999999e-35 < y Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
(FPCore (x y) :precision binary64 (if (<= y -5.9e-111) (fma (- x y) 0.5 x) (if (<= y 3.7e-35) (fma 0.5 (fabs x) x) (fma 0.5 (fabs (- y)) x))))
double code(double x, double y) {
double tmp;
if (y <= -5.9e-111) {
tmp = fma((x - y), 0.5, x);
} else if (y <= 3.7e-35) {
tmp = fma(0.5, fabs(x), x);
} else {
tmp = fma(0.5, fabs(-y), x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -5.9e-111) tmp = fma(Float64(x - y), 0.5, x); elseif (y <= 3.7e-35) tmp = fma(0.5, abs(x), x); else tmp = fma(0.5, abs(Float64(-y)), x); end return tmp end
code[x_, y_] := If[LessEqual[y, -5.9e-111], N[(N[(x - y), $MachinePrecision] * 0.5 + x), $MachinePrecision], If[LessEqual[y, 3.7e-35], N[(0.5 * N[Abs[x], $MachinePrecision] + x), $MachinePrecision], N[(0.5 * N[Abs[(-y)], $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{-111}:\\
\;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \left|x\right|, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \left|-y\right|, x\right)\\
\end{array}
\end{array}
if y < -5.9000000000000001e-111Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64100.0
Applied rewrites100.0%
lift--.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift--.f64N/A
lower-sqrt.f64N/A
lift--.f6489.5
Applied rewrites89.5%
lift-fma.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-fma.f6489.5
Applied rewrites91.9%
if -5.9000000000000001e-111 < y < 3.6999999999999999e-35Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites85.7%
if 3.6999999999999999e-35 < y Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
(FPCore (x y) :precision binary64 (if (<= y -5.9e-111) (fma (- x y) 0.5 x) (if (<= y 3.7e-35) (fma 0.5 (fabs x) x) (* 0.5 (fabs (- y x))))))
double code(double x, double y) {
double tmp;
if (y <= -5.9e-111) {
tmp = fma((x - y), 0.5, x);
} else if (y <= 3.7e-35) {
tmp = fma(0.5, fabs(x), x);
} else {
tmp = 0.5 * fabs((y - x));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -5.9e-111) tmp = fma(Float64(x - y), 0.5, x); elseif (y <= 3.7e-35) tmp = fma(0.5, abs(x), x); else tmp = Float64(0.5 * abs(Float64(y - x))); end return tmp end
code[x_, y_] := If[LessEqual[y, -5.9e-111], N[(N[(x - y), $MachinePrecision] * 0.5 + x), $MachinePrecision], If[LessEqual[y, 3.7e-35], N[(0.5 * N[Abs[x], $MachinePrecision] + x), $MachinePrecision], N[(0.5 * N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{-111}:\\
\;\;\;\;\mathsf{fma}\left(x - y, 0.5, x\right)\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \left|x\right|, x\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left|y - x\right|\\
\end{array}
\end{array}
if y < -5.9000000000000001e-111Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64100.0
Applied rewrites100.0%
lift--.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift--.f64N/A
lower-sqrt.f64N/A
lift--.f6489.5
Applied rewrites89.5%
lift-fma.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-fma.f6489.5
Applied rewrites91.9%
if -5.9000000000000001e-111 < y < 3.6999999999999999e-35Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites85.7%
if 3.6999999999999999e-35 < y Initial program 99.9%
Taylor expanded in x around 0
lower-*.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6474.4
Applied rewrites74.4%
Final simplification84.2%
(FPCore (x y) :precision binary64 (if (<= x -9e-229) (* 0.5 x) (if (<= x 8.8e-153) (* -0.5 y) (* 1.5 x))))
double code(double x, double y) {
double tmp;
if (x <= -9e-229) {
tmp = 0.5 * x;
} else if (x <= 8.8e-153) {
tmp = -0.5 * y;
} else {
tmp = 1.5 * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-9d-229)) then
tmp = 0.5d0 * x
else if (x <= 8.8d-153) then
tmp = (-0.5d0) * y
else
tmp = 1.5d0 * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -9e-229) {
tmp = 0.5 * x;
} else if (x <= 8.8e-153) {
tmp = -0.5 * y;
} else {
tmp = 1.5 * x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -9e-229: tmp = 0.5 * x elif x <= 8.8e-153: tmp = -0.5 * y else: tmp = 1.5 * x return tmp
function code(x, y) tmp = 0.0 if (x <= -9e-229) tmp = Float64(0.5 * x); elseif (x <= 8.8e-153) tmp = Float64(-0.5 * y); else tmp = Float64(1.5 * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -9e-229) tmp = 0.5 * x; elseif (x <= 8.8e-153) tmp = -0.5 * y; else tmp = 1.5 * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -9e-229], N[(0.5 * x), $MachinePrecision], If[LessEqual[x, 8.8e-153], N[(-0.5 * y), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-229}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-153}:\\
\;\;\;\;-0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;1.5 \cdot x\\
\end{array}
\end{array}
if x < -9.0000000000000004e-229Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6489.6
Applied rewrites89.6%
Taylor expanded in x around 0
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-unprodN/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6475.7
Applied rewrites75.7%
Taylor expanded in x around inf
lower-*.f6451.9
Applied rewrites51.9%
if -9.0000000000000004e-229 < x < 8.80000000000000003e-153Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
lift--.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift--.f64N/A
lower-sqrt.f64N/A
lift--.f6453.3
Applied rewrites53.3%
Taylor expanded in x around 0
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
rem-sqrt-square-revN/A
lower-*.f6442.5
Applied rewrites42.5%
if 8.80000000000000003e-153 < x Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
lift--.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift--.f64N/A
lower-sqrt.f64N/A
lift--.f6483.8
Applied rewrites83.8%
Taylor expanded in x around inf
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
rem-sqrt-square-revN/A
lower-*.f6467.1
Applied rewrites67.1%
(FPCore (x y) :precision binary64 (if (<= y -4.8e-111) (* (- x y) 0.5) (fma 0.5 (fabs x) x)))
double code(double x, double y) {
double tmp;
if (y <= -4.8e-111) {
tmp = (x - y) * 0.5;
} else {
tmp = fma(0.5, fabs(x), x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -4.8e-111) tmp = Float64(Float64(x - y) * 0.5); else tmp = fma(0.5, abs(x), x); end return tmp end
code[x_, y_] := If[LessEqual[y, -4.8e-111], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], N[(0.5 * N[Abs[x], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-111}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \left|x\right|, x\right)\\
\end{array}
\end{array}
if y < -4.8000000000000001e-111Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6497.8
Applied rewrites97.8%
Taylor expanded in x around 0
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-unprodN/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6485.7
Applied rewrites85.7%
if -4.8000000000000001e-111 < y Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites60.2%
(FPCore (x y) :precision binary64 (if (<= x 2.9e-151) (* (- x y) 0.5) (* 1.5 x)))
double code(double x, double y) {
double tmp;
if (x <= 2.9e-151) {
tmp = (x - y) * 0.5;
} else {
tmp = 1.5 * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 2.9d-151) then
tmp = (x - y) * 0.5d0
else
tmp = 1.5d0 * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 2.9e-151) {
tmp = (x - y) * 0.5;
} else {
tmp = 1.5 * x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.9e-151: tmp = (x - y) * 0.5 else: tmp = 1.5 * x return tmp
function code(x, y) tmp = 0.0 if (x <= 2.9e-151) tmp = Float64(Float64(x - y) * 0.5); else tmp = Float64(1.5 * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 2.9e-151) tmp = (x - y) * 0.5; else tmp = 1.5 * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.9e-151], N[(N[(x - y), $MachinePrecision] * 0.5), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.9 \cdot 10^{-151}:\\
\;\;\;\;\left(x - y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;1.5 \cdot x\\
\end{array}
\end{array}
if x < 2.90000000000000013e-151Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6493.1
Applied rewrites93.1%
Taylor expanded in x around 0
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-unprodN/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6465.0
Applied rewrites65.0%
if 2.90000000000000013e-151 < x Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
lift--.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift--.f64N/A
lower-sqrt.f64N/A
lift--.f6483.8
Applied rewrites83.8%
Taylor expanded in x around inf
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
rem-sqrt-square-revN/A
lower-*.f6467.1
Applied rewrites67.1%
(FPCore (x y) :precision binary64 (* 0.5 x))
double code(double x, double y) {
return 0.5 * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.5d0 * x
end function
public static double code(double x, double y) {
return 0.5 * x;
}
def code(x, y): return 0.5 * x
function code(x, y) return Float64(0.5 * x) end
function tmp = code(x, y) tmp = 0.5 * x; end
code[x_, y_] := N[(0.5 * x), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot x
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
fabs-subN/A
*-lft-identityN/A
metadata-evalN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
lower-fabs.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6489.8
Applied rewrites89.8%
Taylor expanded in x around 0
fabs-subN/A
rem-sqrt-square-revN/A
sqrt-unprodN/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6451.7
Applied rewrites51.7%
Taylor expanded in x around inf
lower-*.f6427.9
Applied rewrites27.9%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites11.2%
herbie shell --seed 2025080
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))