Diagrams.TwoD.Layout.CirclePacking:approxRadius from diagrams-contrib-1.3.0.5

Percentage Accurate: 43.7% → 56.4%
Time: 5.5s
Alternatives: 6
Speedup: 83.8×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{y \cdot 2}\\ \frac{\tan t\_0}{\sin t\_0} \end{array} \end{array} \]
(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}

\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot 2}\\
\frac{\tan t\_0}{\sin t\_0}
\end{array}
\end{array}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 43.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{y \cdot 2}\\ \frac{\tan t\_0}{\sin t\_0} \end{array} \end{array} \]
(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}

\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot 2}\\
\frac{\tan t\_0}{\sin t\_0}
\end{array}
\end{array}

Alternative 1: 56.4% accurate, 0.5× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ y_m = \left|y\right| \\ \begin{array}{l} t_0 := 0.5 \cdot \cos \left(2 \cdot \left(\pi + \pi\right)\right)\\ \mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 5 \cdot 10^{+148}:\\ \;\;\;\;\frac{1}{\sin \left(\left(-\frac{x\_m}{y\_m} \cdot 0.5\right) + \frac{\pi}{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \mathsf{fma}\left(y\_m \cdot x\_m, \frac{0.5}{y\_m} - \frac{0.5 - t\_0}{\left(0.5 + t\_0\right) \cdot y\_m} \cdot -0.5, y\_m \cdot \tan \left(\pi + \pi\right)\right)}{x\_m}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
 :precision binary64
 (let* ((t_0 (* 0.5 (cos (* 2.0 (+ PI PI))))))
   (if (<= (/ x_m (* y_m 2.0)) 5e+148)
     (/ 1.0 (sin (+ (- (* (/ x_m y_m) 0.5)) (/ PI 2.0))))
     (/
      (*
       2.0
       (fma
        (* y_m x_m)
        (- (/ 0.5 y_m) (* (/ (- 0.5 t_0) (* (+ 0.5 t_0) y_m)) -0.5))
        (* y_m (tan (+ PI PI)))))
      x_m))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
	double t_0 = 0.5 * cos((2.0 * (((double) M_PI) + ((double) M_PI))));
	double tmp;
	if ((x_m / (y_m * 2.0)) <= 5e+148) {
		tmp = 1.0 / sin((-((x_m / y_m) * 0.5) + (((double) M_PI) / 2.0)));
	} else {
		tmp = (2.0 * fma((y_m * x_m), ((0.5 / y_m) - (((0.5 - t_0) / ((0.5 + t_0) * y_m)) * -0.5)), (y_m * tan((((double) M_PI) + ((double) M_PI)))))) / x_m;
	}
	return tmp;
}
x_m = abs(x)
y_m = abs(y)
function code(x_m, y_m)
	t_0 = Float64(0.5 * cos(Float64(2.0 * Float64(pi + pi))))
	tmp = 0.0
	if (Float64(x_m / Float64(y_m * 2.0)) <= 5e+148)
		tmp = Float64(1.0 / sin(Float64(Float64(-Float64(Float64(x_m / y_m) * 0.5)) + Float64(pi / 2.0))));
	else
		tmp = Float64(Float64(2.0 * fma(Float64(y_m * x_m), Float64(Float64(0.5 / y_m) - Float64(Float64(Float64(0.5 - t_0) / Float64(Float64(0.5 + t_0) * y_m)) * -0.5)), Float64(y_m * tan(Float64(pi + pi))))) / x_m);
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[(0.5 * N[Cos[N[(2.0 * N[(Pi + Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 5e+148], N[(1.0 / N[Sin[N[((-N[(N[(x$95$m / y$95$m), $MachinePrecision] * 0.5), $MachinePrecision]) + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(N[(y$95$m * x$95$m), $MachinePrecision] * N[(N[(0.5 / y$95$m), $MachinePrecision] - N[(N[(N[(0.5 - t$95$0), $MachinePrecision] / N[(N[(0.5 + t$95$0), $MachinePrecision] * y$95$m), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + N[(y$95$m * N[Tan[N[(Pi + Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := 0.5 \cdot \cos \left(2 \cdot \left(\pi + \pi\right)\right)\\
\mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 5 \cdot 10^{+148}:\\
\;\;\;\;\frac{1}{\sin \left(\left(-\frac{x\_m}{y\_m} \cdot 0.5\right) + \frac{\pi}{2}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \mathsf{fma}\left(y\_m \cdot x\_m, \frac{0.5}{y\_m} - \frac{0.5 - t\_0}{\left(0.5 + t\_0\right) \cdot y\_m} \cdot -0.5, y\_m \cdot \tan \left(\pi + \pi\right)\right)}{x\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 5.00000000000000024e148

    1. Initial program 43.7%

      \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
    2. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{1}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)}} \]
      2. lower-cos.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
      5. lower-/.f6454.7

        \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot 0.5\right)} \]
    4. Applied rewrites54.7%

      \[\leadsto \color{blue}{\frac{1}{\cos \left(\frac{x}{y} \cdot 0.5\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
      3. associate-*l/N/A

        \[\leadsto \frac{1}{\cos \left(\frac{x \cdot \frac{1}{2}}{y}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \frac{1}{\cos \left(x \cdot \frac{\frac{1}{2}}{y}\right)} \]
      5. mult-flip-revN/A

        \[\leadsto \frac{1}{\cos \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{y}\right)\right)} \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\cos \left(\left(\frac{1}{2} \cdot \frac{1}{y}\right) \cdot x\right)} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{1}{\cos \left(\left(\frac{1}{2} \cdot \frac{1}{y}\right) \cdot x\right)} \]
      8. mult-flip-revN/A

        \[\leadsto \frac{1}{\cos \left(\frac{\frac{1}{2}}{y} \cdot x\right)} \]
      9. lift-/.f6454.7

        \[\leadsto \frac{1}{\cos \left(\frac{0.5}{y} \cdot x\right)} \]
    6. Applied rewrites54.7%

      \[\leadsto \frac{1}{\cos \left(\frac{0.5}{y} \cdot x\right)} \]
    7. Step-by-step derivation
      1. lift-cos.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{\frac{1}{2}}{y} \cdot x\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{\frac{1}{2}}{y} \cdot x\right)} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{\frac{1}{2}}{y} \cdot x\right)} \]
      4. cos-neg-revN/A

        \[\leadsto \frac{1}{\cos \left(\mathsf{neg}\left(\frac{\frac{1}{2}}{y} \cdot x\right)\right)} \]
      5. associate-*l/N/A

        \[\leadsto \frac{1}{\cos \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot x}{y}\right)\right)} \]
      6. associate-*r/N/A

        \[\leadsto \frac{1}{\cos \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{x}{y}\right)\right)} \]
      7. sin-+PI/2-revN/A

        \[\leadsto \frac{1}{\sin \left(\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{x}{y}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      8. lower-sin.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{x}{y}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      9. lower-+.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{x}{y}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      10. lower-neg.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{1}{2} \cdot \frac{x}{y}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      11. *-commutativeN/A

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot \frac{1}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      12. lower-*.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot \frac{1}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      13. lower-/.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot \frac{1}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot \frac{1}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      15. lift-PI.f6454.6

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot 0.5\right) + \frac{\pi}{2}\right)} \]
    8. Applied rewrites54.6%

      \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot 0.5\right) + \frac{\pi}{2}\right)} \]

    if 5.00000000000000024e148 < (/.f64 x (*.f64 y #s(literal 2 binary64)))

    1. Initial program 43.7%

      \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
    2. Step-by-step derivation
      1. lift-tan.f64N/A

        \[\leadsto \frac{\color{blue}{\tan \left(\frac{x}{y \cdot 2}\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      2. tan-+PI-revN/A

        \[\leadsto \frac{\color{blue}{\tan \left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      3. tan-+PI-revN/A

        \[\leadsto \frac{\color{blue}{\tan \left(\left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      4. lower-tan.f64N/A

        \[\leadsto \frac{\color{blue}{\tan \left(\left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      5. lower-+.f64N/A

        \[\leadsto \frac{\tan \color{blue}{\left(\left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\tan \left(\left(\frac{x}{\color{blue}{y \cdot 2}} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      7. lift-/.f64N/A

        \[\leadsto \frac{\tan \left(\left(\color{blue}{\frac{x}{y \cdot 2}} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      8. mult-flipN/A

        \[\leadsto \frac{\tan \left(\left(\color{blue}{x \cdot \frac{1}{y \cdot 2}} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      9. metadata-evalN/A

        \[\leadsto \frac{\tan \left(\left(x \cdot \frac{\color{blue}{1 \cdot 1}}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      10. times-fracN/A

        \[\leadsto \frac{\tan \left(\left(x \cdot \color{blue}{\left(\frac{1}{y} \cdot \frac{1}{2}\right)} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      11. metadata-evalN/A

        \[\leadsto \frac{\tan \left(\left(x \cdot \left(\frac{1}{y} \cdot \color{blue}{\frac{1}{2}}\right) + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      12. *-commutativeN/A

        \[\leadsto \frac{\tan \left(\left(x \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{y}\right)} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\tan \left(\color{blue}{\mathsf{fma}\left(x, \frac{1}{2} \cdot \frac{1}{y}, \mathsf{PI}\left(\right)\right)} + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      14. mult-flip-revN/A

        \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \color{blue}{\frac{\frac{1}{2}}{y}}, \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      15. lower-/.f64N/A

        \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \color{blue}{\frac{\frac{1}{2}}{y}}, \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      16. lower-PI.f64N/A

        \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \frac{\frac{1}{2}}{y}, \color{blue}{\pi}\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      17. lower-PI.f647.2

        \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \frac{0.5}{y}, \pi\right) + \color{blue}{\pi}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
    3. Applied rewrites7.2%

      \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{fma}\left(x, \frac{0.5}{y}, \pi\right) + \pi\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{2 \cdot \frac{y \cdot \sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{x \cdot \cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{y \cdot \sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{x \cdot \cos \left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot \color{blue}{2} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{y \cdot \sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{x \cdot \cos \left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot \color{blue}{2} \]
      3. times-fracN/A

        \[\leadsto \left(\frac{y}{x} \cdot \frac{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\frac{y}{x} \cdot \frac{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2 \]
      5. lower-/.f64N/A

        \[\leadsto \left(\frac{y}{x} \cdot \frac{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2 \]
      6. quot-tanN/A

        \[\leadsto \left(\frac{y}{x} \cdot \tan \left(2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 2 \]
      7. count-2-revN/A

        \[\leadsto \left(\frac{y}{x} \cdot \tan \left(\mathsf{PI}\left(\right) + \mathsf{PI}\left(\right)\right)\right) \cdot 2 \]
      8. tan-+PI-revN/A

        \[\leadsto \left(\frac{y}{x} \cdot \tan \mathsf{PI}\left(\right)\right) \cdot 2 \]
      9. tan-PI2.8

        \[\leadsto \left(\frac{y}{x} \cdot 0\right) \cdot 2 \]
    6. Applied rewrites2.8%

      \[\leadsto \color{blue}{\left(\frac{y}{x} \cdot 0\right) \cdot 2} \]
    7. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{2 \cdot \left(x \cdot \left(y \cdot \left(\frac{1}{2} \cdot \frac{1}{y} - \frac{-1}{2} \cdot \frac{{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}^{2}}{y \cdot {\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}^{2}}\right)\right)\right) + 2 \cdot \frac{y \cdot \sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}}{x}} \]
    8. Applied rewrites6.1%

      \[\leadsto \color{blue}{\frac{2 \cdot \mathsf{fma}\left(y \cdot x, \frac{0.5}{y} - \frac{0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi + \pi\right)\right)}{\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi + \pi\right)\right)\right) \cdot y} \cdot -0.5, y \cdot \tan \left(\pi + \pi\right)\right)}{x}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 56.4% accurate, 1.4× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 10^{+148}:\\ \;\;\;\;\frac{1}{\sin \left(\left(-\frac{x\_m}{y\_m} \cdot 0.5\right) + \frac{\pi}{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;0 + y\_m \cdot \left(\frac{\mathsf{fma}\left(0.5, x\_m, \left(0 \cdot x\_m\right) \cdot 0.5\right)}{y\_m \cdot x\_m} \cdot 2\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
 :precision binary64
 (if (<= (/ x_m (* y_m 2.0)) 1e+148)
   (/ 1.0 (sin (+ (- (* (/ x_m y_m) 0.5)) (/ PI 2.0))))
   (+ 0.0 (* y_m (* (/ (fma 0.5 x_m (* (* 0.0 x_m) 0.5)) (* y_m x_m)) 2.0)))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
	double tmp;
	if ((x_m / (y_m * 2.0)) <= 1e+148) {
		tmp = 1.0 / sin((-((x_m / y_m) * 0.5) + (((double) M_PI) / 2.0)));
	} else {
		tmp = 0.0 + (y_m * ((fma(0.5, x_m, ((0.0 * x_m) * 0.5)) / (y_m * x_m)) * 2.0));
	}
	return tmp;
}
x_m = abs(x)
y_m = abs(y)
function code(x_m, y_m)
	tmp = 0.0
	if (Float64(x_m / Float64(y_m * 2.0)) <= 1e+148)
		tmp = Float64(1.0 / sin(Float64(Float64(-Float64(Float64(x_m / y_m) * 0.5)) + Float64(pi / 2.0))));
	else
		tmp = Float64(0.0 + Float64(y_m * Float64(Float64(fma(0.5, x_m, Float64(Float64(0.0 * x_m) * 0.5)) / Float64(y_m * x_m)) * 2.0)));
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 1e+148], N[(1.0 / N[Sin[N[((-N[(N[(x$95$m / y$95$m), $MachinePrecision] * 0.5), $MachinePrecision]) + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.0 + N[(y$95$m * N[(N[(N[(0.5 * x$95$m + N[(N[(0.0 * x$95$m), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 10^{+148}:\\
\;\;\;\;\frac{1}{\sin \left(\left(-\frac{x\_m}{y\_m} \cdot 0.5\right) + \frac{\pi}{2}\right)}\\

\mathbf{else}:\\
\;\;\;\;0 + y\_m \cdot \left(\frac{\mathsf{fma}\left(0.5, x\_m, \left(0 \cdot x\_m\right) \cdot 0.5\right)}{y\_m \cdot x\_m} \cdot 2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 1e148

    1. Initial program 43.7%

      \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
    2. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{1}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)}} \]
      2. lower-cos.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
      5. lower-/.f6454.7

        \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot 0.5\right)} \]
    4. Applied rewrites54.7%

      \[\leadsto \color{blue}{\frac{1}{\cos \left(\frac{x}{y} \cdot 0.5\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
      3. associate-*l/N/A

        \[\leadsto \frac{1}{\cos \left(\frac{x \cdot \frac{1}{2}}{y}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \frac{1}{\cos \left(x \cdot \frac{\frac{1}{2}}{y}\right)} \]
      5. mult-flip-revN/A

        \[\leadsto \frac{1}{\cos \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{y}\right)\right)} \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\cos \left(\left(\frac{1}{2} \cdot \frac{1}{y}\right) \cdot x\right)} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{1}{\cos \left(\left(\frac{1}{2} \cdot \frac{1}{y}\right) \cdot x\right)} \]
      8. mult-flip-revN/A

        \[\leadsto \frac{1}{\cos \left(\frac{\frac{1}{2}}{y} \cdot x\right)} \]
      9. lift-/.f6454.7

        \[\leadsto \frac{1}{\cos \left(\frac{0.5}{y} \cdot x\right)} \]
    6. Applied rewrites54.7%

      \[\leadsto \frac{1}{\cos \left(\frac{0.5}{y} \cdot x\right)} \]
    7. Step-by-step derivation
      1. lift-cos.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{\frac{1}{2}}{y} \cdot x\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{\frac{1}{2}}{y} \cdot x\right)} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{1}{\cos \left(\frac{\frac{1}{2}}{y} \cdot x\right)} \]
      4. cos-neg-revN/A

        \[\leadsto \frac{1}{\cos \left(\mathsf{neg}\left(\frac{\frac{1}{2}}{y} \cdot x\right)\right)} \]
      5. associate-*l/N/A

        \[\leadsto \frac{1}{\cos \left(\mathsf{neg}\left(\frac{\frac{1}{2} \cdot x}{y}\right)\right)} \]
      6. associate-*r/N/A

        \[\leadsto \frac{1}{\cos \left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{x}{y}\right)\right)} \]
      7. sin-+PI/2-revN/A

        \[\leadsto \frac{1}{\sin \left(\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{x}{y}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      8. lower-sin.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{x}{y}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      9. lower-+.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(\mathsf{neg}\left(\frac{1}{2} \cdot \frac{x}{y}\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      10. lower-neg.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{1}{2} \cdot \frac{x}{y}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      11. *-commutativeN/A

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot \frac{1}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      12. lower-*.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot \frac{1}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      13. lower-/.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot \frac{1}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot \frac{1}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      15. lift-PI.f6454.6

        \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot 0.5\right) + \frac{\pi}{2}\right)} \]
    8. Applied rewrites54.6%

      \[\leadsto \frac{1}{\sin \left(\left(-\frac{x}{y} \cdot 0.5\right) + \frac{\pi}{2}\right)} \]

    if 1e148 < (/.f64 x (*.f64 y #s(literal 2 binary64)))

    1. Initial program 43.7%

      \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
    2. Step-by-step derivation
      1. lift-tan.f64N/A

        \[\leadsto \frac{\color{blue}{\tan \left(\frac{x}{y \cdot 2}\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      2. tan-+PI-revN/A

        \[\leadsto \frac{\color{blue}{\tan \left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      3. tan-+PI-revN/A

        \[\leadsto \frac{\color{blue}{\tan \left(\left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      4. lower-tan.f64N/A

        \[\leadsto \frac{\color{blue}{\tan \left(\left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      5. lower-+.f64N/A

        \[\leadsto \frac{\tan \color{blue}{\left(\left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\tan \left(\left(\frac{x}{\color{blue}{y \cdot 2}} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      7. lift-/.f64N/A

        \[\leadsto \frac{\tan \left(\left(\color{blue}{\frac{x}{y \cdot 2}} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      8. mult-flipN/A

        \[\leadsto \frac{\tan \left(\left(\color{blue}{x \cdot \frac{1}{y \cdot 2}} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      9. metadata-evalN/A

        \[\leadsto \frac{\tan \left(\left(x \cdot \frac{\color{blue}{1 \cdot 1}}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      10. times-fracN/A

        \[\leadsto \frac{\tan \left(\left(x \cdot \color{blue}{\left(\frac{1}{y} \cdot \frac{1}{2}\right)} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      11. metadata-evalN/A

        \[\leadsto \frac{\tan \left(\left(x \cdot \left(\frac{1}{y} \cdot \color{blue}{\frac{1}{2}}\right) + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      12. *-commutativeN/A

        \[\leadsto \frac{\tan \left(\left(x \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{y}\right)} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\tan \left(\color{blue}{\mathsf{fma}\left(x, \frac{1}{2} \cdot \frac{1}{y}, \mathsf{PI}\left(\right)\right)} + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      14. mult-flip-revN/A

        \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \color{blue}{\frac{\frac{1}{2}}{y}}, \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      15. lower-/.f64N/A

        \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \color{blue}{\frac{\frac{1}{2}}{y}}, \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      16. lower-PI.f64N/A

        \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \frac{\frac{1}{2}}{y}, \color{blue}{\pi}\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      17. lower-PI.f647.2

        \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \frac{0.5}{y}, \pi\right) + \color{blue}{\pi}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
    3. Applied rewrites7.2%

      \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{fma}\left(x, \frac{0.5}{y}, \pi\right) + \pi\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{2 \cdot \frac{y \cdot \sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{x \cdot \cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{y \cdot \sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{x \cdot \cos \left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot \color{blue}{2} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{y \cdot \sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{x \cdot \cos \left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot \color{blue}{2} \]
      3. times-fracN/A

        \[\leadsto \left(\frac{y}{x} \cdot \frac{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\frac{y}{x} \cdot \frac{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2 \]
      5. lower-/.f64N/A

        \[\leadsto \left(\frac{y}{x} \cdot \frac{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2 \]
      6. quot-tanN/A

        \[\leadsto \left(\frac{y}{x} \cdot \tan \left(2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 2 \]
      7. count-2-revN/A

        \[\leadsto \left(\frac{y}{x} \cdot \tan \left(\mathsf{PI}\left(\right) + \mathsf{PI}\left(\right)\right)\right) \cdot 2 \]
      8. tan-+PI-revN/A

        \[\leadsto \left(\frac{y}{x} \cdot \tan \mathsf{PI}\left(\right)\right) \cdot 2 \]
      9. tan-PI2.8

        \[\leadsto \left(\frac{y}{x} \cdot 0\right) \cdot 2 \]
    6. Applied rewrites2.8%

      \[\leadsto \color{blue}{\left(\frac{y}{x} \cdot 0\right) \cdot 2} \]
    7. Taylor expanded in x around 0

      \[\leadsto 0 \]
    8. Step-by-step derivation
      1. Applied rewrites3.1%

        \[\leadsto 0 \]
      2. Taylor expanded in y around inf

        \[\leadsto \color{blue}{y \cdot \left(2 \cdot \frac{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{x \cdot \cos \left(2 \cdot \mathsf{PI}\left(\right)\right)} + 2 \cdot \frac{\frac{1}{2} \cdot x - \frac{-1}{2} \cdot \frac{x \cdot {\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}^{2}}{{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}^{2}}}{x \cdot y}\right)} \]
      3. Applied rewrites42.0%

        \[\leadsto \color{blue}{0 + y \cdot \left(\frac{\mathsf{fma}\left(0.5, x, \left(0 \cdot x\right) \cdot 0.5\right)}{y \cdot x} \cdot 2\right)} \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 3: 56.0% accurate, 1.4× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 2 \cdot 10^{+17}:\\ \;\;\;\;\frac{1}{\sin \left(\mathsf{fma}\left(\frac{0.5}{y\_m}, x\_m, \frac{\pi}{2}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    y_m = (fabs.f64 y)
    (FPCore (x_m y_m)
     :precision binary64
     (if (<= (/ x_m (* y_m 2.0)) 2e+17)
       (/ 1.0 (sin (fma (/ 0.5 y_m) x_m (/ PI 2.0))))
       1.0))
    x_m = fabs(x);
    y_m = fabs(y);
    double code(double x_m, double y_m) {
    	double tmp;
    	if ((x_m / (y_m * 2.0)) <= 2e+17) {
    		tmp = 1.0 / sin(fma((0.5 / y_m), x_m, (((double) M_PI) / 2.0)));
    	} else {
    		tmp = 1.0;
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    y_m = abs(y)
    function code(x_m, y_m)
    	tmp = 0.0
    	if (Float64(x_m / Float64(y_m * 2.0)) <= 2e+17)
    		tmp = Float64(1.0 / sin(fma(Float64(0.5 / y_m), x_m, Float64(pi / 2.0))));
    	else
    		tmp = 1.0;
    	end
    	return tmp
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    y_m = N[Abs[y], $MachinePrecision]
    code[x$95$m_, y$95$m_] := If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 2e+17], N[(1.0 / N[Sin[N[(N[(0.5 / y$95$m), $MachinePrecision] * x$95$m + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
    
    \begin{array}{l}
    x_m = \left|x\right|
    \\
    y_m = \left|y\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 2 \cdot 10^{+17}:\\
    \;\;\;\;\frac{1}{\sin \left(\mathsf{fma}\left(\frac{0.5}{y\_m}, x\_m, \frac{\pi}{2}\right)\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 2e17

      1. Initial program 43.7%

        \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      2. Taylor expanded in x around inf

        \[\leadsto \color{blue}{\frac{1}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)}} \]
      3. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{1}{\color{blue}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)}} \]
        2. lower-cos.f64N/A

          \[\leadsto \frac{1}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)} \]
        3. *-commutativeN/A

          \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
        4. lower-*.f64N/A

          \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
        5. lower-/.f6454.7

          \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot 0.5\right)} \]
      4. Applied rewrites54.7%

        \[\leadsto \color{blue}{\frac{1}{\cos \left(\frac{x}{y} \cdot 0.5\right)}} \]
      5. Step-by-step derivation
        1. lift-cos.f64N/A

          \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
        3. lift-/.f64N/A

          \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
        4. *-commutativeN/A

          \[\leadsto \frac{1}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)} \]
        5. sin-+PI/2-revN/A

          \[\leadsto \frac{1}{\sin \left(\frac{1}{2} \cdot \frac{x}{y} + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        6. lower-sin.f64N/A

          \[\leadsto \frac{1}{\sin \left(\frac{1}{2} \cdot \frac{x}{y} + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        7. associate-*r/N/A

          \[\leadsto \frac{1}{\sin \left(\frac{\frac{1}{2} \cdot x}{y} + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        8. associate-*l/N/A

          \[\leadsto \frac{1}{\sin \left(\frac{\frac{1}{2}}{y} \cdot x + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        9. mult-flip-revN/A

          \[\leadsto \frac{1}{\sin \left(\left(\frac{1}{2} \cdot \frac{1}{y}\right) \cdot x + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        10. lower-fma.f64N/A

          \[\leadsto \frac{1}{\sin \left(\mathsf{fma}\left(\frac{1}{2} \cdot \frac{1}{y}, x, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)} \]
        11. mult-flip-revN/A

          \[\leadsto \frac{1}{\sin \left(\mathsf{fma}\left(\frac{\frac{1}{2}}{y}, x, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)} \]
        12. lift-/.f64N/A

          \[\leadsto \frac{1}{\sin \left(\mathsf{fma}\left(\frac{\frac{1}{2}}{y}, x, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)} \]
        13. lower-/.f64N/A

          \[\leadsto \frac{1}{\sin \left(\mathsf{fma}\left(\frac{\frac{1}{2}}{y}, x, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)} \]
        14. lift-PI.f6454.8

          \[\leadsto \frac{1}{\sin \left(\mathsf{fma}\left(\frac{0.5}{y}, x, \frac{\pi}{2}\right)\right)} \]
      6. Applied rewrites54.8%

        \[\leadsto \frac{1}{\sin \left(\mathsf{fma}\left(\frac{0.5}{y}, x, \frac{\pi}{2}\right)\right)} \]

      if 2e17 < (/.f64 x (*.f64 y #s(literal 2 binary64)))

      1. Initial program 43.7%

        \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
      2. Taylor expanded in x around 0

        \[\leadsto \color{blue}{1} \]
      3. Step-by-step derivation
        1. Applied rewrites54.7%

          \[\leadsto \color{blue}{1} \]
      4. Recombined 2 regimes into one program.
      5. Add Preprocessing

      Alternative 4: 56.0% accurate, 1.6× speedup?

      \[\begin{array}{l} x_m = \left|x\right| \\ y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 10^{+29}:\\ \;\;\;\;\frac{1}{\cos \left(\frac{0.5}{y\_m} \cdot x\_m\right)}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
      x_m = (fabs.f64 x)
      y_m = (fabs.f64 y)
      (FPCore (x_m y_m)
       :precision binary64
       (if (<= (/ x_m (* y_m 2.0)) 1e+29) (/ 1.0 (cos (* (/ 0.5 y_m) x_m))) 1.0))
      x_m = fabs(x);
      y_m = fabs(y);
      double code(double x_m, double y_m) {
      	double tmp;
      	if ((x_m / (y_m * 2.0)) <= 1e+29) {
      		tmp = 1.0 / cos(((0.5 / y_m) * x_m));
      	} else {
      		tmp = 1.0;
      	}
      	return tmp;
      }
      
      x_m =     private
      y_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(x_m, y_m)
      use fmin_fmax_functions
          real(8), intent (in) :: x_m
          real(8), intent (in) :: y_m
          real(8) :: tmp
          if ((x_m / (y_m * 2.0d0)) <= 1d+29) then
              tmp = 1.0d0 / cos(((0.5d0 / y_m) * x_m))
          else
              tmp = 1.0d0
          end if
          code = tmp
      end function
      
      x_m = Math.abs(x);
      y_m = Math.abs(y);
      public static double code(double x_m, double y_m) {
      	double tmp;
      	if ((x_m / (y_m * 2.0)) <= 1e+29) {
      		tmp = 1.0 / Math.cos(((0.5 / y_m) * x_m));
      	} else {
      		tmp = 1.0;
      	}
      	return tmp;
      }
      
      x_m = math.fabs(x)
      y_m = math.fabs(y)
      def code(x_m, y_m):
      	tmp = 0
      	if (x_m / (y_m * 2.0)) <= 1e+29:
      		tmp = 1.0 / math.cos(((0.5 / y_m) * x_m))
      	else:
      		tmp = 1.0
      	return tmp
      
      x_m = abs(x)
      y_m = abs(y)
      function code(x_m, y_m)
      	tmp = 0.0
      	if (Float64(x_m / Float64(y_m * 2.0)) <= 1e+29)
      		tmp = Float64(1.0 / cos(Float64(Float64(0.5 / y_m) * x_m)));
      	else
      		tmp = 1.0;
      	end
      	return tmp
      end
      
      x_m = abs(x);
      y_m = abs(y);
      function tmp_2 = code(x_m, y_m)
      	tmp = 0.0;
      	if ((x_m / (y_m * 2.0)) <= 1e+29)
      		tmp = 1.0 / cos(((0.5 / y_m) * x_m));
      	else
      		tmp = 1.0;
      	end
      	tmp_2 = tmp;
      end
      
      x_m = N[Abs[x], $MachinePrecision]
      y_m = N[Abs[y], $MachinePrecision]
      code[x$95$m_, y$95$m_] := If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 1e+29], N[(1.0 / N[Cos[N[(N[(0.5 / y$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
      
      \begin{array}{l}
      x_m = \left|x\right|
      \\
      y_m = \left|y\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 10^{+29}:\\
      \;\;\;\;\frac{1}{\cos \left(\frac{0.5}{y\_m} \cdot x\_m\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 9.99999999999999914e28

        1. Initial program 43.7%

          \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
        2. Taylor expanded in x around inf

          \[\leadsto \color{blue}{\frac{1}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{1}{\color{blue}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)}} \]
          2. lower-cos.f64N/A

            \[\leadsto \frac{1}{\cos \left(\frac{1}{2} \cdot \frac{x}{y}\right)} \]
          3. *-commutativeN/A

            \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
          4. lower-*.f64N/A

            \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
          5. lower-/.f6454.7

            \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot 0.5\right)} \]
        4. Applied rewrites54.7%

          \[\leadsto \color{blue}{\frac{1}{\cos \left(\frac{x}{y} \cdot 0.5\right)}} \]
        5. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{1}{\cos \left(\frac{x}{y} \cdot \frac{1}{2}\right)} \]
          3. associate-*l/N/A

            \[\leadsto \frac{1}{\cos \left(\frac{x \cdot \frac{1}{2}}{y}\right)} \]
          4. associate-*r/N/A

            \[\leadsto \frac{1}{\cos \left(x \cdot \frac{\frac{1}{2}}{y}\right)} \]
          5. mult-flip-revN/A

            \[\leadsto \frac{1}{\cos \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{y}\right)\right)} \]
          6. *-commutativeN/A

            \[\leadsto \frac{1}{\cos \left(\left(\frac{1}{2} \cdot \frac{1}{y}\right) \cdot x\right)} \]
          7. lower-*.f64N/A

            \[\leadsto \frac{1}{\cos \left(\left(\frac{1}{2} \cdot \frac{1}{y}\right) \cdot x\right)} \]
          8. mult-flip-revN/A

            \[\leadsto \frac{1}{\cos \left(\frac{\frac{1}{2}}{y} \cdot x\right)} \]
          9. lift-/.f6454.7

            \[\leadsto \frac{1}{\cos \left(\frac{0.5}{y} \cdot x\right)} \]
        6. Applied rewrites54.7%

          \[\leadsto \frac{1}{\cos \left(\frac{0.5}{y} \cdot x\right)} \]

        if 9.99999999999999914e28 < (/.f64 x (*.f64 y #s(literal 2 binary64)))

        1. Initial program 43.7%

          \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
        2. Taylor expanded in x around 0

          \[\leadsto \color{blue}{1} \]
        3. Step-by-step derivation
          1. Applied rewrites54.7%

            \[\leadsto \color{blue}{1} \]
        4. Recombined 2 regimes into one program.
        5. Add Preprocessing

        Alternative 5: 54.7% accurate, 83.8× speedup?

        \[\begin{array}{l} x_m = \left|x\right| \\ y_m = \left|y\right| \\ 1 \end{array} \]
        x_m = (fabs.f64 x)
        y_m = (fabs.f64 y)
        (FPCore (x_m y_m) :precision binary64 1.0)
        x_m = fabs(x);
        y_m = fabs(y);
        double code(double x_m, double y_m) {
        	return 1.0;
        }
        
        x_m =     private
        y_m =     private
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x_m, y_m)
        use fmin_fmax_functions
            real(8), intent (in) :: x_m
            real(8), intent (in) :: y_m
            code = 1.0d0
        end function
        
        x_m = Math.abs(x);
        y_m = Math.abs(y);
        public static double code(double x_m, double y_m) {
        	return 1.0;
        }
        
        x_m = math.fabs(x)
        y_m = math.fabs(y)
        def code(x_m, y_m):
        	return 1.0
        
        x_m = abs(x)
        y_m = abs(y)
        function code(x_m, y_m)
        	return 1.0
        end
        
        x_m = abs(x);
        y_m = abs(y);
        function tmp = code(x_m, y_m)
        	tmp = 1.0;
        end
        
        x_m = N[Abs[x], $MachinePrecision]
        y_m = N[Abs[y], $MachinePrecision]
        code[x$95$m_, y$95$m_] := 1.0
        
        \begin{array}{l}
        x_m = \left|x\right|
        \\
        y_m = \left|y\right|
        
        \\
        1
        \end{array}
        
        Derivation
        1. Initial program 43.7%

          \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
        2. Taylor expanded in x around 0

          \[\leadsto \color{blue}{1} \]
        3. Step-by-step derivation
          1. Applied rewrites54.7%

            \[\leadsto \color{blue}{1} \]
          2. Add Preprocessing

          Alternative 6: 3.1% accurate, 83.8× speedup?

          \[\begin{array}{l} x_m = \left|x\right| \\ y_m = \left|y\right| \\ 0 \end{array} \]
          x_m = (fabs.f64 x)
          y_m = (fabs.f64 y)
          (FPCore (x_m y_m) :precision binary64 0.0)
          x_m = fabs(x);
          y_m = fabs(y);
          double code(double x_m, double y_m) {
          	return 0.0;
          }
          
          x_m =     private
          y_m =     private
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x_m, y_m)
          use fmin_fmax_functions
              real(8), intent (in) :: x_m
              real(8), intent (in) :: y_m
              code = 0.0d0
          end function
          
          x_m = Math.abs(x);
          y_m = Math.abs(y);
          public static double code(double x_m, double y_m) {
          	return 0.0;
          }
          
          x_m = math.fabs(x)
          y_m = math.fabs(y)
          def code(x_m, y_m):
          	return 0.0
          
          x_m = abs(x)
          y_m = abs(y)
          function code(x_m, y_m)
          	return 0.0
          end
          
          x_m = abs(x);
          y_m = abs(y);
          function tmp = code(x_m, y_m)
          	tmp = 0.0;
          end
          
          x_m = N[Abs[x], $MachinePrecision]
          y_m = N[Abs[y], $MachinePrecision]
          code[x$95$m_, y$95$m_] := 0.0
          
          \begin{array}{l}
          x_m = \left|x\right|
          \\
          y_m = \left|y\right|
          
          \\
          0
          \end{array}
          
          Derivation
          1. Initial program 43.7%

            \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
          2. Step-by-step derivation
            1. lift-tan.f64N/A

              \[\leadsto \frac{\color{blue}{\tan \left(\frac{x}{y \cdot 2}\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            2. tan-+PI-revN/A

              \[\leadsto \frac{\color{blue}{\tan \left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            3. tan-+PI-revN/A

              \[\leadsto \frac{\color{blue}{\tan \left(\left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            4. lower-tan.f64N/A

              \[\leadsto \frac{\color{blue}{\tan \left(\left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            5. lower-+.f64N/A

              \[\leadsto \frac{\tan \color{blue}{\left(\left(\frac{x}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\tan \left(\left(\frac{x}{\color{blue}{y \cdot 2}} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            7. lift-/.f64N/A

              \[\leadsto \frac{\tan \left(\left(\color{blue}{\frac{x}{y \cdot 2}} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            8. mult-flipN/A

              \[\leadsto \frac{\tan \left(\left(\color{blue}{x \cdot \frac{1}{y \cdot 2}} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            9. metadata-evalN/A

              \[\leadsto \frac{\tan \left(\left(x \cdot \frac{\color{blue}{1 \cdot 1}}{y \cdot 2} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            10. times-fracN/A

              \[\leadsto \frac{\tan \left(\left(x \cdot \color{blue}{\left(\frac{1}{y} \cdot \frac{1}{2}\right)} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            11. metadata-evalN/A

              \[\leadsto \frac{\tan \left(\left(x \cdot \left(\frac{1}{y} \cdot \color{blue}{\frac{1}{2}}\right) + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            12. *-commutativeN/A

              \[\leadsto \frac{\tan \left(\left(x \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{y}\right)} + \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            13. lower-fma.f64N/A

              \[\leadsto \frac{\tan \left(\color{blue}{\mathsf{fma}\left(x, \frac{1}{2} \cdot \frac{1}{y}, \mathsf{PI}\left(\right)\right)} + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            14. mult-flip-revN/A

              \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \color{blue}{\frac{\frac{1}{2}}{y}}, \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            15. lower-/.f64N/A

              \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \color{blue}{\frac{\frac{1}{2}}{y}}, \mathsf{PI}\left(\right)\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            16. lower-PI.f64N/A

              \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \frac{\frac{1}{2}}{y}, \color{blue}{\pi}\right) + \mathsf{PI}\left(\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
            17. lower-PI.f647.2

              \[\leadsto \frac{\tan \left(\mathsf{fma}\left(x, \frac{0.5}{y}, \pi\right) + \color{blue}{\pi}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
          3. Applied rewrites7.2%

            \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{fma}\left(x, \frac{0.5}{y}, \pi\right) + \pi\right)}}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
          4. Taylor expanded in x around 0

            \[\leadsto \color{blue}{2 \cdot \frac{y \cdot \sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{x \cdot \cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}} \]
          5. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \frac{y \cdot \sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{x \cdot \cos \left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot \color{blue}{2} \]
            2. lower-*.f64N/A

              \[\leadsto \frac{y \cdot \sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{x \cdot \cos \left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot \color{blue}{2} \]
            3. times-fracN/A

              \[\leadsto \left(\frac{y}{x} \cdot \frac{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2 \]
            4. lower-*.f64N/A

              \[\leadsto \left(\frac{y}{x} \cdot \frac{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2 \]
            5. lower-/.f64N/A

              \[\leadsto \left(\frac{y}{x} \cdot \frac{\sin \left(2 \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(2 \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 2 \]
            6. quot-tanN/A

              \[\leadsto \left(\frac{y}{x} \cdot \tan \left(2 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 2 \]
            7. count-2-revN/A

              \[\leadsto \left(\frac{y}{x} \cdot \tan \left(\mathsf{PI}\left(\right) + \mathsf{PI}\left(\right)\right)\right) \cdot 2 \]
            8. tan-+PI-revN/A

              \[\leadsto \left(\frac{y}{x} \cdot \tan \mathsf{PI}\left(\right)\right) \cdot 2 \]
            9. tan-PI2.8

              \[\leadsto \left(\frac{y}{x} \cdot 0\right) \cdot 2 \]
          6. Applied rewrites2.8%

            \[\leadsto \color{blue}{\left(\frac{y}{x} \cdot 0\right) \cdot 2} \]
          7. Taylor expanded in x around 0

            \[\leadsto 0 \]
          8. Step-by-step derivation
            1. Applied rewrites3.1%

              \[\leadsto 0 \]
            2. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2025134 
            (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)))))