
(FPCore (x y) :precision binary64 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
double code(double x, double y) {
return (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.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 = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
end function
public static double code(double x, double y) {
return (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
def code(x, y): return (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0)
function code(x, y) return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0)) end
function tmp = code(x, y) tmp = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0); end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)
\end{array}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
double code(double x, double y) {
return (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.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 = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
end function
public static double code(double x, double y) {
return (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
def code(x, y): return (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0)
function code(x, y) return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0)) end
function tmp = code(x, y) tmp = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0); end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)
\end{array}
(FPCore (x y) :precision binary64 (* 3.0 (fma (- (/ 0.1111111111111111 x) 1.0) (sqrt x) (* y (sqrt x)))))
double code(double x, double y) {
return 3.0 * fma(((0.1111111111111111 / x) - 1.0), sqrt(x), (y * sqrt(x)));
}
function code(x, y) return Float64(3.0 * fma(Float64(Float64(0.1111111111111111 / x) - 1.0), sqrt(x), Float64(y * sqrt(x)))) end
code[x_, y_] := N[(3.0 * N[(N[(N[(0.1111111111111111 / x), $MachinePrecision] - 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision] + N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \mathsf{fma}\left(\frac{0.1111111111111111}{x} - 1, \sqrt{x}, y \cdot \sqrt{x}\right)
\end{array}
Initial program 99.4%
Taylor expanded in y around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6499.4
Applied rewrites99.4%
lift-sqrt.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower--.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f6499.4
Applied rewrites99.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0))))
(if (<= t_0 -5e+18)
(* 3.0 (* (sqrt x) (- y 1.0)))
(if (<= t_0 1e+152)
(* 3.0 (* (- (/ 0.1111111111111111 x) 1.0) (sqrt x)))
(* (sqrt x) (* y 3.0))))))
double code(double x, double y) {
double t_0 = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
double tmp;
if (t_0 <= -5e+18) {
tmp = 3.0 * (sqrt(x) * (y - 1.0));
} else if (t_0 <= 1e+152) {
tmp = 3.0 * (((0.1111111111111111 / x) - 1.0) * sqrt(x));
} else {
tmp = sqrt(x) * (y * 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) :: t_0
real(8) :: tmp
t_0 = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
if (t_0 <= (-5d+18)) then
tmp = 3.0d0 * (sqrt(x) * (y - 1.0d0))
else if (t_0 <= 1d+152) then
tmp = 3.0d0 * (((0.1111111111111111d0 / x) - 1.0d0) * sqrt(x))
else
tmp = sqrt(x) * (y * 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
double tmp;
if (t_0 <= -5e+18) {
tmp = 3.0 * (Math.sqrt(x) * (y - 1.0));
} else if (t_0 <= 1e+152) {
tmp = 3.0 * (((0.1111111111111111 / x) - 1.0) * Math.sqrt(x));
} else {
tmp = Math.sqrt(x) * (y * 3.0);
}
return tmp;
}
def code(x, y): t_0 = (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0) tmp = 0 if t_0 <= -5e+18: tmp = 3.0 * (math.sqrt(x) * (y - 1.0)) elif t_0 <= 1e+152: tmp = 3.0 * (((0.1111111111111111 / x) - 1.0) * math.sqrt(x)) else: tmp = math.sqrt(x) * (y * 3.0) return tmp
function code(x, y) t_0 = Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0)) tmp = 0.0 if (t_0 <= -5e+18) tmp = Float64(3.0 * Float64(sqrt(x) * Float64(y - 1.0))); elseif (t_0 <= 1e+152) tmp = Float64(3.0 * Float64(Float64(Float64(0.1111111111111111 / x) - 1.0) * sqrt(x))); else tmp = Float64(sqrt(x) * Float64(y * 3.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0); tmp = 0.0; if (t_0 <= -5e+18) tmp = 3.0 * (sqrt(x) * (y - 1.0)); elseif (t_0 <= 1e+152) tmp = 3.0 * (((0.1111111111111111 / x) - 1.0) * sqrt(x)); else tmp = sqrt(x) * (y * 3.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+18], N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+152], N[(3.0 * N[(N[(N[(0.1111111111111111 / x), $MachinePrecision] - 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+18}:\\
\;\;\;\;3 \cdot \left(\sqrt{x} \cdot \left(y - 1\right)\right)\\
\mathbf{elif}\;t\_0 \leq 10^{+152}:\\
\;\;\;\;3 \cdot \left(\left(\frac{0.1111111111111111}{x} - 1\right) \cdot \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(y \cdot 3\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 3 binary64) (sqrt.f64 x)) (-.f64 (+.f64 y (/.f64 #s(literal 1 binary64) (*.f64 x #s(literal 9 binary64)))) #s(literal 1 binary64))) < -5e18Initial program 99.5%
Taylor expanded in x around inf
Applied rewrites99.0%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sqrt.f6499.0
Applied rewrites99.0%
if -5e18 < (*.f64 (*.f64 #s(literal 3 binary64) (sqrt.f64 x)) (-.f64 (+.f64 y (/.f64 #s(literal 1 binary64) (*.f64 x #s(literal 9 binary64)))) #s(literal 1 binary64))) < 1e152Initial program 99.3%
Taylor expanded in y around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6499.3
Applied rewrites99.3%
Taylor expanded in y around 0
associate-*r/N/A
metadata-evalN/A
*-commutativeN/A
lower--.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6484.7
Applied rewrites84.7%
if 1e152 < (*.f64 (*.f64 #s(literal 3 binary64) (sqrt.f64 x)) (-.f64 (+.f64 y (/.f64 #s(literal 1 binary64) (*.f64 x #s(literal 9 binary64)))) #s(literal 1 binary64))) Initial program 99.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-sqrt.f6495.6
Applied rewrites95.6%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-*.f6495.3
Applied rewrites95.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0))))
(if (<= t_0 -2000.0)
(* 3.0 (* (sqrt x) (- y 1.0)))
(if (<= t_0 1e+152)
(* (/ 0.1111111111111111 (sqrt x)) 3.0)
(* (sqrt x) (* y 3.0))))))
double code(double x, double y) {
double t_0 = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
double tmp;
if (t_0 <= -2000.0) {
tmp = 3.0 * (sqrt(x) * (y - 1.0));
} else if (t_0 <= 1e+152) {
tmp = (0.1111111111111111 / sqrt(x)) * 3.0;
} else {
tmp = sqrt(x) * (y * 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) :: t_0
real(8) :: tmp
t_0 = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
if (t_0 <= (-2000.0d0)) then
tmp = 3.0d0 * (sqrt(x) * (y - 1.0d0))
else if (t_0 <= 1d+152) then
tmp = (0.1111111111111111d0 / sqrt(x)) * 3.0d0
else
tmp = sqrt(x) * (y * 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
double tmp;
if (t_0 <= -2000.0) {
tmp = 3.0 * (Math.sqrt(x) * (y - 1.0));
} else if (t_0 <= 1e+152) {
tmp = (0.1111111111111111 / Math.sqrt(x)) * 3.0;
} else {
tmp = Math.sqrt(x) * (y * 3.0);
}
return tmp;
}
def code(x, y): t_0 = (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0) tmp = 0 if t_0 <= -2000.0: tmp = 3.0 * (math.sqrt(x) * (y - 1.0)) elif t_0 <= 1e+152: tmp = (0.1111111111111111 / math.sqrt(x)) * 3.0 else: tmp = math.sqrt(x) * (y * 3.0) return tmp
function code(x, y) t_0 = Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0)) tmp = 0.0 if (t_0 <= -2000.0) tmp = Float64(3.0 * Float64(sqrt(x) * Float64(y - 1.0))); elseif (t_0 <= 1e+152) tmp = Float64(Float64(0.1111111111111111 / sqrt(x)) * 3.0); else tmp = Float64(sqrt(x) * Float64(y * 3.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0); tmp = 0.0; if (t_0 <= -2000.0) tmp = 3.0 * (sqrt(x) * (y - 1.0)); elseif (t_0 <= 1e+152) tmp = (0.1111111111111111 / sqrt(x)) * 3.0; else tmp = sqrt(x) * (y * 3.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2000.0], N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+152], N[(N[(0.1111111111111111 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * 3.0), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)\\
\mathbf{if}\;t\_0 \leq -2000:\\
\;\;\;\;3 \cdot \left(\sqrt{x} \cdot \left(y - 1\right)\right)\\
\mathbf{elif}\;t\_0 \leq 10^{+152}:\\
\;\;\;\;\frac{0.1111111111111111}{\sqrt{x}} \cdot 3\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(y \cdot 3\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 3 binary64) (sqrt.f64 x)) (-.f64 (+.f64 y (/.f64 #s(literal 1 binary64) (*.f64 x #s(literal 9 binary64)))) #s(literal 1 binary64))) < -2e3Initial program 99.5%
Taylor expanded in x around inf
Applied rewrites98.6%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sqrt.f6498.6
Applied rewrites98.6%
if -2e3 < (*.f64 (*.f64 #s(literal 3 binary64) (sqrt.f64 x)) (-.f64 (+.f64 y (/.f64 #s(literal 1 binary64) (*.f64 x #s(literal 9 binary64)))) #s(literal 1 binary64))) < 1e152Initial program 99.2%
Taylor expanded in y around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6499.2
Applied rewrites99.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6482.5
Applied rewrites82.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.5
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
associate-*l/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6482.6
Applied rewrites82.6%
if 1e152 < (*.f64 (*.f64 #s(literal 3 binary64) (sqrt.f64 x)) (-.f64 (+.f64 y (/.f64 #s(literal 1 binary64) (*.f64 x #s(literal 9 binary64)))) #s(literal 1 binary64))) Initial program 99.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-sqrt.f6495.6
Applied rewrites95.6%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-*.f6495.3
Applied rewrites95.3%
(FPCore (x y) :precision binary64 (* 3.0 (fma (sqrt x) y (* (- (/ 0.1111111111111111 x) 1.0) (sqrt x)))))
double code(double x, double y) {
return 3.0 * fma(sqrt(x), y, (((0.1111111111111111 / x) - 1.0) * sqrt(x)));
}
function code(x, y) return Float64(3.0 * fma(sqrt(x), y, Float64(Float64(Float64(0.1111111111111111 / x) - 1.0) * sqrt(x)))) end
code[x_, y_] := N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * y + N[(N[(N[(0.1111111111111111 / x), $MachinePrecision] - 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \mathsf{fma}\left(\sqrt{x}, y, \left(\frac{0.1111111111111111}{x} - 1\right) \cdot \sqrt{x}\right)
\end{array}
Initial program 99.4%
Taylor expanded in y around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6499.4
Applied rewrites99.4%
(FPCore (x y) :precision binary64 (* (* 3.0 (sqrt x)) (- (+ y (/ 0.1111111111111111 x)) 1.0)))
double code(double x, double y) {
return (3.0 * sqrt(x)) * ((y + (0.1111111111111111 / x)) - 1.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 = (3.0d0 * sqrt(x)) * ((y + (0.1111111111111111d0 / x)) - 1.0d0)
end function
public static double code(double x, double y) {
return (3.0 * Math.sqrt(x)) * ((y + (0.1111111111111111 / x)) - 1.0);
}
def code(x, y): return (3.0 * math.sqrt(x)) * ((y + (0.1111111111111111 / x)) - 1.0)
function code(x, y) return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(0.1111111111111111 / x)) - 1.0)) end
function tmp = code(x, y) tmp = (3.0 * sqrt(x)) * ((y + (0.1111111111111111 / x)) - 1.0); end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{0.1111111111111111}{x}\right) - 1\right)
\end{array}
Initial program 99.4%
Taylor expanded in x around 0
lower-/.f6499.4
Applied rewrites99.4%
(FPCore (x y) :precision binary64 (if (<= y -480.0) (* (* (sqrt x) y) 3.0) (if (<= y 1.0) (* 3.0 (- (sqrt x))) (* (sqrt x) (* y 3.0)))))
double code(double x, double y) {
double tmp;
if (y <= -480.0) {
tmp = (sqrt(x) * y) * 3.0;
} else if (y <= 1.0) {
tmp = 3.0 * -sqrt(x);
} else {
tmp = sqrt(x) * (y * 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 (y <= (-480.0d0)) then
tmp = (sqrt(x) * y) * 3.0d0
else if (y <= 1.0d0) then
tmp = 3.0d0 * -sqrt(x)
else
tmp = sqrt(x) * (y * 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -480.0) {
tmp = (Math.sqrt(x) * y) * 3.0;
} else if (y <= 1.0) {
tmp = 3.0 * -Math.sqrt(x);
} else {
tmp = Math.sqrt(x) * (y * 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -480.0: tmp = (math.sqrt(x) * y) * 3.0 elif y <= 1.0: tmp = 3.0 * -math.sqrt(x) else: tmp = math.sqrt(x) * (y * 3.0) return tmp
function code(x, y) tmp = 0.0 if (y <= -480.0) tmp = Float64(Float64(sqrt(x) * y) * 3.0); elseif (y <= 1.0) tmp = Float64(3.0 * Float64(-sqrt(x))); else tmp = Float64(sqrt(x) * Float64(y * 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -480.0) tmp = (sqrt(x) * y) * 3.0; elseif (y <= 1.0) tmp = 3.0 * -sqrt(x); else tmp = sqrt(x) * (y * 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -480.0], N[(N[(N[Sqrt[x], $MachinePrecision] * y), $MachinePrecision] * 3.0), $MachinePrecision], If[LessEqual[y, 1.0], N[(3.0 * (-N[Sqrt[x], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -480:\\
\;\;\;\;\left(\sqrt{x} \cdot y\right) \cdot 3\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;3 \cdot \left(-\sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(y \cdot 3\right)\\
\end{array}
\end{array}
if y < -480Initial program 99.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-sqrt.f6472.4
Applied rewrites72.4%
if -480 < y < 1Initial program 99.4%
Taylor expanded in y around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6499.4
Applied rewrites99.4%
Taylor expanded in y around 0
associate-*r/N/A
metadata-evalN/A
*-commutativeN/A
lower--.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6498.1
Applied rewrites98.1%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f64N/A
lift-sqrt.f6448.9
Applied rewrites48.9%
if 1 < y Initial program 99.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-sqrt.f6475.0
Applied rewrites75.0%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-*.f6474.9
Applied rewrites74.9%
(FPCore (x y) :precision binary64 (let* ((t_0 (* (sqrt x) (* y 3.0)))) (if (<= y -480.0) t_0 (if (<= y 1.0) (* 3.0 (- (sqrt x))) t_0))))
double code(double x, double y) {
double t_0 = sqrt(x) * (y * 3.0);
double tmp;
if (y <= -480.0) {
tmp = t_0;
} else if (y <= 1.0) {
tmp = 3.0 * -sqrt(x);
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(x) * (y * 3.0d0)
if (y <= (-480.0d0)) then
tmp = t_0
else if (y <= 1.0d0) then
tmp = 3.0d0 * -sqrt(x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.sqrt(x) * (y * 3.0);
double tmp;
if (y <= -480.0) {
tmp = t_0;
} else if (y <= 1.0) {
tmp = 3.0 * -Math.sqrt(x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sqrt(x) * (y * 3.0) tmp = 0 if y <= -480.0: tmp = t_0 elif y <= 1.0: tmp = 3.0 * -math.sqrt(x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(sqrt(x) * Float64(y * 3.0)) tmp = 0.0 if (y <= -480.0) tmp = t_0; elseif (y <= 1.0) tmp = Float64(3.0 * Float64(-sqrt(x))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = sqrt(x) * (y * 3.0); tmp = 0.0; if (y <= -480.0) tmp = t_0; elseif (y <= 1.0) tmp = 3.0 * -sqrt(x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sqrt[x], $MachinePrecision] * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -480.0], t$95$0, If[LessEqual[y, 1.0], N[(3.0 * (-N[Sqrt[x], $MachinePrecision])), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x} \cdot \left(y \cdot 3\right)\\
\mathbf{if}\;y \leq -480:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;3 \cdot \left(-\sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -480 or 1 < y Initial program 99.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-sqrt.f6473.7
Applied rewrites73.7%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-*.f6473.5
Applied rewrites73.5%
if -480 < y < 1Initial program 99.4%
Taylor expanded in y around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6499.4
Applied rewrites99.4%
Taylor expanded in y around 0
associate-*r/N/A
metadata-evalN/A
*-commutativeN/A
lower--.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6498.1
Applied rewrites98.1%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f64N/A
lift-sqrt.f6448.9
Applied rewrites48.9%
(FPCore (x y) :precision binary64 (* 3.0 (* (sqrt x) (- y 1.0))))
double code(double x, double y) {
return 3.0 * (sqrt(x) * (y - 1.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 = 3.0d0 * (sqrt(x) * (y - 1.0d0))
end function
public static double code(double x, double y) {
return 3.0 * (Math.sqrt(x) * (y - 1.0));
}
def code(x, y): return 3.0 * (math.sqrt(x) * (y - 1.0))
function code(x, y) return Float64(3.0 * Float64(sqrt(x) * Float64(y - 1.0))) end
function tmp = code(x, y) tmp = 3.0 * (sqrt(x) * (y - 1.0)); end
code[x_, y_] := N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \left(\sqrt{x} \cdot \left(y - 1\right)\right)
\end{array}
Initial program 99.4%
Taylor expanded in x around inf
Applied rewrites62.6%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-sqrt.f6462.6
Applied rewrites62.6%
(FPCore (x y) :precision binary64 (* 3.0 (- (sqrt x))))
double code(double x, double y) {
return 3.0 * -sqrt(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 = 3.0d0 * -sqrt(x)
end function
public static double code(double x, double y) {
return 3.0 * -Math.sqrt(x);
}
def code(x, y): return 3.0 * -math.sqrt(x)
function code(x, y) return Float64(3.0 * Float64(-sqrt(x))) end
function tmp = code(x, y) tmp = 3.0 * -sqrt(x); end
code[x_, y_] := N[(3.0 * (-N[Sqrt[x], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \left(-\sqrt{x}\right)
\end{array}
Initial program 99.4%
Taylor expanded in y around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6499.4
Applied rewrites99.4%
Taylor expanded in y around 0
associate-*r/N/A
metadata-evalN/A
*-commutativeN/A
lower--.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6461.4
Applied rewrites61.4%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f64N/A
lift-sqrt.f6425.3
Applied rewrites25.3%
(FPCore (x y) :precision binary64 (* 3.0 (+ (* y (sqrt x)) (* (- (/ 1.0 (* x 9.0)) 1.0) (sqrt x)))))
double code(double x, double y) {
return 3.0 * ((y * sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * sqrt(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 = 3.0d0 * ((y * sqrt(x)) + (((1.0d0 / (x * 9.0d0)) - 1.0d0) * sqrt(x)))
end function
public static double code(double x, double y) {
return 3.0 * ((y * Math.sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * Math.sqrt(x)));
}
def code(x, y): return 3.0 * ((y * math.sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * math.sqrt(x)))
function code(x, y) return Float64(3.0 * Float64(Float64(y * sqrt(x)) + Float64(Float64(Float64(1.0 / Float64(x * 9.0)) - 1.0) * sqrt(x)))) end
function tmp = code(x, y) tmp = 3.0 * ((y * sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * sqrt(x))); end
code[x_, y_] := N[(3.0 * N[(N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \left(y \cdot \sqrt{x} + \left(\frac{1}{x \cdot 9} - 1\right) \cdot \sqrt{x}\right)
\end{array}
herbie shell --seed 2025089
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:alt
(! :herbie-platform default (* 3 (+ (* y (sqrt x)) (* (- (/ 1 (* x 9)) 1) (sqrt x)))))
(* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))