
(FPCore (x y) :precision binary64 (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)))
double code(double x, double y) {
return (((x * x) + (y * y)) + (y * y)) + (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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (((x * x) + (y * y)) + (y * y)) + (y * y)
end function
public static double code(double x, double y) {
return (((x * x) + (y * y)) + (y * y)) + (y * y);
}
def code(x, y): return (((x * x) + (y * y)) + (y * y)) + (y * y)
function code(x, y) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y)) end
function tmp = code(x, y) tmp = (((x * x) + (y * y)) + (y * y)) + (y * y); end
code[x_, y_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)))
double code(double x, double y) {
return (((x * x) + (y * y)) + (y * y)) + (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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (((x * x) + (y * y)) + (y * y)) + (y * y)
end function
public static double code(double x, double y) {
return (((x * x) + (y * y)) + (y * y)) + (y * y);
}
def code(x, y): return (((x * x) + (y * y)) + (y * y)) + (y * y)
function code(x, y) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y)) end
function tmp = code(x, y) tmp = (((x * x) + (y * y)) + (y * y)) + (y * y); end
code[x_, y_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
\end{array}
(FPCore (x y) :precision binary64 (fma 3.0 (* y y) (* x x)))
double code(double x, double y) {
return fma(3.0, (y * y), (x * x));
}
function code(x, y) return fma(3.0, Float64(y * y), Float64(x * x)) end
code[x_, y_] := N[(3.0 * N[(y * y), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(3, y \cdot y, x \cdot x\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.9%
Applied rewrites99.9%
Applied rewrites99.9%
(FPCore (x y) :precision binary64 (if (<= x 0.00125) (* (* 3.0 y) y) (fma 3.0 y (* x x))))
double code(double x, double y) {
double tmp;
if (x <= 0.00125) {
tmp = (3.0 * y) * y;
} else {
tmp = fma(3.0, y, (x * x));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 0.00125) tmp = Float64(Float64(3.0 * y) * y); else tmp = fma(3.0, y, Float64(x * x)); end return tmp end
code[x_, y_] := If[LessEqual[x, 0.00125], N[(N[(3.0 * y), $MachinePrecision] * y), $MachinePrecision], N[(3.0 * y + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00125:\\
\;\;\;\;\left(3 \cdot y\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(3, y, x \cdot x\right)\\
\end{array}
\end{array}
if x < 0.00125000000000000003Initial program 99.9%
Taylor expanded in y around inf
Applied rewrites57.7%
Applied rewrites57.7%
if 0.00125000000000000003 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.9%
Applied rewrites99.9%
Applied rewrites99.9%
Applied rewrites48.2%
(FPCore (x y) :precision binary64 (* (* 3.0 y) y))
double code(double x, double y) {
return (3.0 * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (3.0d0 * y) * y
end function
public static double code(double x, double y) {
return (3.0 * y) * y;
}
def code(x, y): return (3.0 * y) * y
function code(x, y) return Float64(Float64(3.0 * y) * y) end
function tmp = code(x, y) tmp = (3.0 * y) * y; end
code[x_, y_] := N[(N[(3.0 * y), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\left(3 \cdot y\right) \cdot y
\end{array}
Initial program 99.9%
Taylor expanded in y around inf
Applied rewrites57.7%
Applied rewrites57.7%
(FPCore (x y) :precision binary64 (* 3.0 (* y y)))
double code(double x, double y) {
return 3.0 * (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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 3.0d0 * (y * y)
end function
public static double code(double x, double y) {
return 3.0 * (y * y);
}
def code(x, y): return 3.0 * (y * y)
function code(x, y) return Float64(3.0 * Float64(y * y)) end
function tmp = code(x, y) tmp = 3.0 * (y * y); end
code[x_, y_] := N[(3.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \left(y \cdot y\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around inf
Applied rewrites57.7%
Applied rewrites57.7%
(FPCore (x y) :precision binary64 (+ 0.0 (* y y)))
double code(double x, double y) {
return 0.0 + (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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.0d0 + (y * y)
end function
public static double code(double x, double y) {
return 0.0 + (y * y);
}
def code(x, y): return 0.0 + (y * y)
function code(x, y) return Float64(0.0 + Float64(y * y)) end
function tmp = code(x, y) tmp = 0.0 + (y * y); end
code[x_, y_] := N[(0.0 + N[(y * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0 + y \cdot y
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites31.0%
Applied rewrites37.3%
(FPCore (x y) :precision binary64 (if (<= (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)) 2e-214) 0.0 (fma 3.0 y x)))
double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 2e-214) {
tmp = 0.0;
} else {
tmp = fma(3.0, y, x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y)) <= 2e-214) tmp = 0.0; else tmp = fma(3.0, y, x); end return tmp end
code[x_, y_] := If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision], 2e-214], 0.0, N[(3.0 * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \leq 2 \cdot 10^{-214}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(3, y, x\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) < 1.99999999999999983e-214Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
Applied rewrites8.2%
if 1.99999999999999983e-214 < (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.9%
Applied rewrites99.9%
Applied rewrites4.1%
(FPCore (x y) :precision binary64 (if (<= (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)) 1e-275) 0.0 (* 6.0 y)))
double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-275) {
tmp = 0.0;
} else {
tmp = 6.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1d-275) then
tmp = 0.0d0
else
tmp = 6.0d0 * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-275) {
tmp = 0.0;
} else {
tmp = 6.0 * y;
}
return tmp;
}
def code(x, y): tmp = 0 if ((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-275: tmp = 0.0 else: tmp = 6.0 * y return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y)) <= 1e-275) tmp = 0.0; else tmp = Float64(6.0 * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-275) tmp = 0.0; else tmp = 6.0 * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision], 1e-275], 0.0, N[(6.0 * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \leq 10^{-275}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;6 \cdot y\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) < 9.99999999999999934e-276Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
Applied rewrites8.2%
if 9.99999999999999934e-276 < (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.9%
Applied rewrites30.6%
Taylor expanded in y around 0
Applied rewrites3.7%
(FPCore (x y) :precision binary64 (if (<= (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)) 1e-167) 0.0 (+ 2.0 y)))
double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-167) {
tmp = 0.0;
} else {
tmp = 2.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1d-167) then
tmp = 0.0d0
else
tmp = 2.0d0 + y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-167) {
tmp = 0.0;
} else {
tmp = 2.0 + y;
}
return tmp;
}
def code(x, y): tmp = 0 if ((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-167: tmp = 0.0 else: tmp = 2.0 + y return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y)) <= 1e-167) tmp = 0.0; else tmp = Float64(2.0 + y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-167) tmp = 0.0; else tmp = 2.0 + y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision], 1e-167], 0.0, N[(2.0 + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \leq 10^{-167}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;2 + y\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) < 1e-167Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
Applied rewrites8.2%
if 1e-167 < (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
(FPCore (x y) :precision binary64 (if (<= (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)) 1e-167) 0.0 (+ 1.0 y)))
double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-167) {
tmp = 0.0;
} else {
tmp = 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1d-167) then
tmp = 0.0d0
else
tmp = 1.0d0 + y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-167) {
tmp = 0.0;
} else {
tmp = 1.0 + y;
}
return tmp;
}
def code(x, y): tmp = 0 if ((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-167: tmp = 0.0 else: tmp = 1.0 + y return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y)) <= 1e-167) tmp = 0.0; else tmp = Float64(1.0 + y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-167) tmp = 0.0; else tmp = 1.0 + y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision], 1e-167], 0.0, N[(1.0 + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \leq 10^{-167}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 + y\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) < 1e-167Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
Applied rewrites8.2%
if 1e-167 < (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Applied rewrites4.1%
(FPCore (x y) :precision binary64 (if (<= (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)) 1e-275) 0.0 (+ 0.0 y)))
double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-275) {
tmp = 0.0;
} else {
tmp = 0.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1d-275) then
tmp = 0.0d0
else
tmp = 0.0d0 + y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-275) {
tmp = 0.0;
} else {
tmp = 0.0 + y;
}
return tmp;
}
def code(x, y): tmp = 0 if ((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-275: tmp = 0.0 else: tmp = 0.0 + y return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y)) <= 1e-275) tmp = 0.0; else tmp = Float64(0.0 + y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1e-275) tmp = 0.0; else tmp = 0.0 + y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision], 1e-275], 0.0, N[(0.0 + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \leq 10^{-275}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;0 + y\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) < 9.99999999999999934e-276Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
Applied rewrites8.2%
if 9.99999999999999934e-276 < (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Applied rewrites3.6%
(FPCore (x y) :precision binary64 (if (<= (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)) 2.6e-154) 0.0 (+ 3.0 3.0)))
double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 2.6e-154) {
tmp = 0.0;
} else {
tmp = 3.0 + 3.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 2.6d-154) then
tmp = 0.0d0
else
tmp = 3.0d0 + 3.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 2.6e-154) {
tmp = 0.0;
} else {
tmp = 3.0 + 3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if ((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 2.6e-154: tmp = 0.0 else: tmp = 3.0 + 3.0 return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y)) <= 2.6e-154) tmp = 0.0; else tmp = Float64(3.0 + 3.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 2.6e-154) tmp = 0.0; else tmp = 3.0 + 3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision], 2.6e-154], 0.0, N[(3.0 + 3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \leq 2.6 \cdot 10^{-154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;3 + 3\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) < 2.6e-154Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
Applied rewrites8.2%
if 2.6e-154 < (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) Initial program 99.9%
Taylor expanded in y around inf
Applied rewrites57.7%
Applied rewrites57.7%
Applied rewrites4.3%
(FPCore (x y) :precision binary64 (if (<= (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)) 1.5e-154) 0.0 2.0))
double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1.5e-154) {
tmp = 0.0;
} else {
tmp = 2.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1.5d-154) then
tmp = 0.0d0
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1.5e-154) {
tmp = 0.0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y): tmp = 0 if ((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1.5e-154: tmp = 0.0 else: tmp = 2.0 return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y)) <= 1.5e-154) tmp = 0.0; else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1.5e-154) tmp = 0.0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision], 1.5e-154], 0.0, 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \leq 1.5 \cdot 10^{-154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) < 1.5000000000000001e-154Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
Applied rewrites8.2%
if 1.5000000000000001e-154 < (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
(FPCore (x y) :precision binary64 (if (<= (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)) 1.1e-154) 0.0 1.0))
double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1.1e-154) {
tmp = 0.0;
} else {
tmp = 1.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1.1d-154) then
tmp = 0.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1.1e-154) {
tmp = 0.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if ((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1.1e-154: tmp = 0.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y)) <= 1.1e-154) tmp = 0.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((((x * x) + (y * y)) + (y * y)) + (y * y)) <= 1.1e-154) tmp = 0.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision], 1.1e-154], 0.0, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \leq 1.1 \cdot 10^{-154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) < 1.10000000000000004e-154Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
Applied rewrites8.2%
if 1.10000000000000004e-154 < (+.f64 (+.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 y y)) (*.f64 y y)) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
Applied rewrites4.3%
(FPCore (x y) :precision binary64 0.0)
double code(double x, double y) {
return 0.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 = 0.0d0
end function
public static double code(double x, double y) {
return 0.0;
}
def code(x, y): return 0.0
function code(x, y) return 0.0 end
function tmp = code(x, y) tmp = 0.0; end
code[x_, y_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites4.1%
Taylor expanded in y around 0
Applied rewrites4.3%
Applied rewrites8.2%
herbie shell --seed 2025159
(FPCore (x y)
:name "Linear.Quaternion:$c/ from linear-1.19.1.3, E"
:precision binary64
(+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)))