
(FPCore (x y) :precision binary64 (let* ((t_0 (/ x (* y 2.0)))) (/ (tan t_0) (sin t_0))))
double code(double x, double y) {
double t_0 = x / (y * 2.0);
return tan(t_0) / sin(t_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
real(8) :: t_0
t_0 = x / (y * 2.0d0)
code = tan(t_0) / sin(t_0)
end function
public static double code(double x, double y) {
double t_0 = x / (y * 2.0);
return Math.tan(t_0) / Math.sin(t_0);
}
def code(x, y): t_0 = x / (y * 2.0) return math.tan(t_0) / math.sin(t_0)
function code(x, y) t_0 = Float64(x / Float64(y * 2.0)) return Float64(tan(t_0) / sin(t_0)) end
function tmp = code(x, y) t_0 = x / (y * 2.0); tmp = tan(t_0) / sin(t_0); end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Tan[t$95$0], $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{x}{y \cdot 2}\\
\frac{\tan t\_0}{\sin t\_0}
\end{array}
Herbie found 4 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (let* ((t_0 (/ x (* y 2.0)))) (/ (tan t_0) (sin t_0))))
double code(double x, double y) {
double t_0 = x / (y * 2.0);
return tan(t_0) / sin(t_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
real(8) :: t_0
t_0 = x / (y * 2.0d0)
code = tan(t_0) / sin(t_0)
end function
public static double code(double x, double y) {
double t_0 = x / (y * 2.0);
return Math.tan(t_0) / Math.sin(t_0);
}
def code(x, y): t_0 = x / (y * 2.0) return math.tan(t_0) / math.sin(t_0)
function code(x, y) t_0 = Float64(x / Float64(y * 2.0)) return Float64(tan(t_0) / sin(t_0)) end
function tmp = code(x, y) t_0 = x / (y * 2.0); tmp = tan(t_0) / sin(t_0); end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Tan[t$95$0], $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{x}{y \cdot 2}\\
\frac{\tan t\_0}{\sin t\_0}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (* y 2.0))))
(if (<= (/ (tan t_0) (sin t_0)) 3.26)
(/ 1.0 (cos (/ 0.5 (/ y x))))
1.0)))double code(double x, double y) {
double t_0 = x / (y * 2.0);
double tmp;
if ((tan(t_0) / sin(t_0)) <= 3.26) {
tmp = 1.0 / cos((0.5 / (y / x)));
} 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) :: t_0
real(8) :: tmp
t_0 = x / (y * 2.0d0)
if ((tan(t_0) / sin(t_0)) <= 3.26d0) then
tmp = 1.0d0 / cos((0.5d0 / (y / x)))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y * 2.0);
double tmp;
if ((Math.tan(t_0) / Math.sin(t_0)) <= 3.26) {
tmp = 1.0 / Math.cos((0.5 / (y / x)));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (y * 2.0) tmp = 0 if (math.tan(t_0) / math.sin(t_0)) <= 3.26: tmp = 1.0 / math.cos((0.5 / (y / x))) else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y * 2.0)) tmp = 0.0 if (Float64(tan(t_0) / sin(t_0)) <= 3.26) tmp = Float64(1.0 / cos(Float64(0.5 / Float64(y / x)))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y * 2.0); tmp = 0.0; if ((tan(t_0) / sin(t_0)) <= 3.26) tmp = 1.0 / cos((0.5 / (y / x))); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Tan[t$95$0], $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 3.26], N[(1.0 / N[Cos[N[(0.5 / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
t_0 := \frac{x}{y \cdot 2}\\
\mathbf{if}\;\frac{\tan t\_0}{\sin t\_0} \leq 3.26:\\
\;\;\;\;\frac{1}{\cos \left(\frac{0.5}{\frac{y}{x}}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
if (/.f64 (tan.f64 (/.f64 x (*.f64 y #s(literal 2 binary64)))) (sin.f64 (/.f64 x (*.f64 y #s(literal 2 binary64))))) < 3.2599999999999998Initial program 44.2%
lift-/.f64N/A
mult-flipN/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
associate-*l/N/A
rgt-mult-inverseN/A
lower-/.f64N/A
lower-cos.f6455.1%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6455.1%
Applied rewrites55.1%
lift-/.f64N/A
lift-+.f64N/A
count-2N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6455.1%
Applied rewrites55.1%
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f6455.0%
Applied rewrites55.0%
if 3.2599999999999998 < (/.f64 (tan.f64 (/.f64 x (*.f64 y #s(literal 2 binary64)))) (sin.f64 (/.f64 x (*.f64 y #s(literal 2 binary64))))) Initial program 44.2%
Taylor expanded in x around 0
Applied rewrites55.1%
(FPCore (x y) :precision binary64 (if (<= (/ (fabs x) (* (fabs y) 2.0)) 2e+162) (/ 1.0 (cos (* (/ 0.5 (fabs y)) (fabs x)))) 1.0))
double code(double x, double y) {
double tmp;
if ((fabs(x) / (fabs(y) * 2.0)) <= 2e+162) {
tmp = 1.0 / cos(((0.5 / fabs(y)) * fabs(x)));
} 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 ((abs(x) / (abs(y) * 2.0d0)) <= 2d+162) then
tmp = 1.0d0 / cos(((0.5d0 / abs(y)) * abs(x)))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((Math.abs(x) / (Math.abs(y) * 2.0)) <= 2e+162) {
tmp = 1.0 / Math.cos(((0.5 / Math.abs(y)) * Math.abs(x)));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (math.fabs(x) / (math.fabs(y) * 2.0)) <= 2e+162: tmp = 1.0 / math.cos(((0.5 / math.fabs(y)) * math.fabs(x))) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (Float64(abs(x) / Float64(abs(y) * 2.0)) <= 2e+162) tmp = Float64(1.0 / cos(Float64(Float64(0.5 / abs(y)) * abs(x)))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((abs(x) / (abs(y) * 2.0)) <= 2e+162) tmp = 1.0 / cos(((0.5 / abs(y)) * abs(x))); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[Abs[x], $MachinePrecision] / N[(N[Abs[y], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], 2e+162], N[(1.0 / N[Cos[N[(N[(0.5 / N[Abs[y], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\mathbf{if}\;\frac{\left|x\right|}{\left|y\right| \cdot 2} \leq 2 \cdot 10^{+162}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{0.5}{\left|y\right|} \cdot \left|x\right|\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 1.9999999999999999e162Initial program 44.2%
lift-/.f64N/A
mult-flipN/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
associate-*l/N/A
rgt-mult-inverseN/A
lower-/.f64N/A
lower-cos.f6455.1%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6455.1%
Applied rewrites55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
count-2N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6455.0%
Applied rewrites55.0%
if 1.9999999999999999e162 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 44.2%
Taylor expanded in x around 0
Applied rewrites55.1%
(FPCore (x y) :precision binary64 (if (<= (/ (fabs x) (* (fabs y) 2.0)) 2e+162) (/ 1.0 (cos (/ (fabs x) (+ (fabs y) (fabs y))))) 1.0))
double code(double x, double y) {
double tmp;
if ((fabs(x) / (fabs(y) * 2.0)) <= 2e+162) {
tmp = 1.0 / cos((fabs(x) / (fabs(y) + fabs(y))));
} 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 ((abs(x) / (abs(y) * 2.0d0)) <= 2d+162) then
tmp = 1.0d0 / cos((abs(x) / (abs(y) + abs(y))))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((Math.abs(x) / (Math.abs(y) * 2.0)) <= 2e+162) {
tmp = 1.0 / Math.cos((Math.abs(x) / (Math.abs(y) + Math.abs(y))));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (math.fabs(x) / (math.fabs(y) * 2.0)) <= 2e+162: tmp = 1.0 / math.cos((math.fabs(x) / (math.fabs(y) + math.fabs(y)))) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (Float64(abs(x) / Float64(abs(y) * 2.0)) <= 2e+162) tmp = Float64(1.0 / cos(Float64(abs(x) / Float64(abs(y) + abs(y))))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((abs(x) / (abs(y) * 2.0)) <= 2e+162) tmp = 1.0 / cos((abs(x) / (abs(y) + abs(y)))); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[Abs[x], $MachinePrecision] / N[(N[Abs[y], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], 2e+162], N[(1.0 / N[Cos[N[(N[Abs[x], $MachinePrecision] / N[(N[Abs[y], $MachinePrecision] + N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\mathbf{if}\;\frac{\left|x\right|}{\left|y\right| \cdot 2} \leq 2 \cdot 10^{+162}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{\left|x\right|}{\left|y\right| + \left|y\right|}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 1.9999999999999999e162Initial program 44.2%
lift-/.f64N/A
mult-flipN/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
associate-*l/N/A
rgt-mult-inverseN/A
lower-/.f64N/A
lower-cos.f6455.1%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6455.1%
Applied rewrites55.1%
if 1.9999999999999999e162 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 44.2%
Taylor expanded in x around 0
Applied rewrites55.1%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 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 = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
1
Initial program 44.2%
Taylor expanded in x around 0
Applied rewrites55.1%
herbie shell --seed 2025258
(FPCore (x y)
:name "Diagrams.TwoD.Layout.CirclePacking:approxRadius from diagrams-contrib-1.3.0.5"
:precision binary64
(/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))))