Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3

Percentage Accurate: 50.6% → 79.5%
Time: 1.5s
Alternatives: 3
Speedup: N/A×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y \cdot 4\right) \cdot y\\ \frac{x \cdot x - t\_0}{x \cdot x + t\_0} \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (* y 4.0) y))) (/ (- (* x x) t_0) (+ (* x x) t_0))))
double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + 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 = (y * 4.0d0) * y
    code = ((x * x) - t_0) / ((x * x) + t_0)
end function
public static double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + t_0);
}
def code(x, y):
	t_0 = (y * 4.0) * y
	return ((x * x) - t_0) / ((x * x) + t_0)
function code(x, y)
	t_0 = Float64(Float64(y * 4.0) * y)
	return Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0))
end
function tmp = code(x, y)
	t_0 = (y * 4.0) * y;
	tmp = ((x * x) - t_0) / ((x * x) + t_0);
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y \cdot 4\right) \cdot y\\
\frac{x \cdot x - t\_0}{x \cdot x + t\_0}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

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 3 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: 50.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y \cdot 4\right) \cdot y\\ \frac{x \cdot x - t\_0}{x \cdot x + t\_0} \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (* y 4.0) y))) (/ (- (* x x) t_0) (+ (* x x) t_0))))
double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + 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 = (y * 4.0d0) * y
    code = ((x * x) - t_0) / ((x * x) + t_0)
end function
public static double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + t_0);
}
def code(x, y):
	t_0 = (y * 4.0) * y
	return ((x * x) - t_0) / ((x * x) + t_0)
function code(x, y)
	t_0 = Float64(Float64(y * 4.0) * y)
	return Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0))
end
function tmp = code(x, y)
	t_0 = (y * 4.0) * y;
	tmp = ((x * x) - t_0) / ((x * x) + t_0);
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y \cdot 4\right) \cdot y\\
\frac{x \cdot x - t\_0}{x \cdot x + t\_0}
\end{array}
\end{array}

Alternative 1: 79.5% accurate, N/A× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := \left(y\_m \cdot 4\right) \cdot y\_m\\ \mathbf{if}\;y\_m \leq 1.55 \cdot 10^{-53}:\\ \;\;\;\;1\\ \mathbf{elif}\;y\_m \leq 3.2 \cdot 10^{+120}:\\ \;\;\;\;\frac{x \cdot x - t\_0}{x \cdot x + t\_0}\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m)
 :precision binary64
 (let* ((t_0 (* (* y_m 4.0) y_m)))
   (if (<= y_m 1.55e-53)
     1.0
     (if (<= y_m 3.2e+120) (/ (- (* x x) t_0) (+ (* x x) t_0)) -1.0))))
y_m = fabs(y);
double code(double x, double y_m) {
	double t_0 = (y_m * 4.0) * y_m;
	double tmp;
	if (y_m <= 1.55e-53) {
		tmp = 1.0;
	} else if (y_m <= 3.2e+120) {
		tmp = ((x * x) - t_0) / ((x * x) + t_0);
	} else {
		tmp = -1.0;
	}
	return tmp;
}
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, y_m)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (y_m * 4.0d0) * y_m
    if (y_m <= 1.55d-53) then
        tmp = 1.0d0
    else if (y_m <= 3.2d+120) then
        tmp = ((x * x) - t_0) / ((x * x) + t_0)
    else
        tmp = -1.0d0
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
	double t_0 = (y_m * 4.0) * y_m;
	double tmp;
	if (y_m <= 1.55e-53) {
		tmp = 1.0;
	} else if (y_m <= 3.2e+120) {
		tmp = ((x * x) - t_0) / ((x * x) + t_0);
	} else {
		tmp = -1.0;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m):
	t_0 = (y_m * 4.0) * y_m
	tmp = 0
	if y_m <= 1.55e-53:
		tmp = 1.0
	elif y_m <= 3.2e+120:
		tmp = ((x * x) - t_0) / ((x * x) + t_0)
	else:
		tmp = -1.0
	return tmp
y_m = abs(y)
function code(x, y_m)
	t_0 = Float64(Float64(y_m * 4.0) * y_m)
	tmp = 0.0
	if (y_m <= 1.55e-53)
		tmp = 1.0;
	elseif (y_m <= 3.2e+120)
		tmp = Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0));
	else
		tmp = -1.0;
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m)
	t_0 = (y_m * 4.0) * y_m;
	tmp = 0.0;
	if (y_m <= 1.55e-53)
		tmp = 1.0;
	elseif (y_m <= 3.2e+120)
		tmp = ((x * x) - t_0) / ((x * x) + t_0);
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(N[(y$95$m * 4.0), $MachinePrecision] * y$95$m), $MachinePrecision]}, If[LessEqual[y$95$m, 1.55e-53], 1.0, If[LessEqual[y$95$m, 3.2e+120], N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], -1.0]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := \left(y\_m \cdot 4\right) \cdot y\_m\\
\mathbf{if}\;y\_m \leq 1.55 \cdot 10^{-53}:\\
\;\;\;\;1\\

\mathbf{elif}\;y\_m \leq 3.2 \cdot 10^{+120}:\\
\;\;\;\;\frac{x \cdot x - t\_0}{x \cdot x + t\_0}\\

\mathbf{else}:\\
\;\;\;\;-1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.55000000000000008e-53

    1. Initial program 53.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{1} \]
    4. Step-by-step derivation
      1. Applied rewrites60.4%

        \[\leadsto \color{blue}{1} \]

      if 1.55000000000000008e-53 < y < 3.19999999999999982e120

      1. Initial program 78.4%

        \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. Add Preprocessing

      if 3.19999999999999982e120 < y

      1. Initial program 22.2%

        \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{-1} \]
      4. Step-by-step derivation
        1. Applied rewrites94.5%

          \[\leadsto \color{blue}{-1} \]
      5. Recombined 3 regimes into one program.
      6. Add Preprocessing

      Alternative 2: 74.9% accurate, N/A× speedup?

      \[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 3700000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
      y_m = (fabs.f64 y)
      (FPCore (x y_m) :precision binary64 (if (<= y_m 3700000.0) 1.0 -1.0))
      y_m = fabs(y);
      double code(double x, double y_m) {
      	double tmp;
      	if (y_m <= 3700000.0) {
      		tmp = 1.0;
      	} else {
      		tmp = -1.0;
      	}
      	return tmp;
      }
      
      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, y_m)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: y_m
          real(8) :: tmp
          if (y_m <= 3700000.0d0) then
              tmp = 1.0d0
          else
              tmp = -1.0d0
          end if
          code = tmp
      end function
      
      y_m = Math.abs(y);
      public static double code(double x, double y_m) {
      	double tmp;
      	if (y_m <= 3700000.0) {
      		tmp = 1.0;
      	} else {
      		tmp = -1.0;
      	}
      	return tmp;
      }
      
      y_m = math.fabs(y)
      def code(x, y_m):
      	tmp = 0
      	if y_m <= 3700000.0:
      		tmp = 1.0
      	else:
      		tmp = -1.0
      	return tmp
      
      y_m = abs(y)
      function code(x, y_m)
      	tmp = 0.0
      	if (y_m <= 3700000.0)
      		tmp = 1.0;
      	else
      		tmp = -1.0;
      	end
      	return tmp
      end
      
      y_m = abs(y);
      function tmp_2 = code(x, y_m)
      	tmp = 0.0;
      	if (y_m <= 3700000.0)
      		tmp = 1.0;
      	else
      		tmp = -1.0;
      	end
      	tmp_2 = tmp;
      end
      
      y_m = N[Abs[y], $MachinePrecision]
      code[x_, y$95$m_] := If[LessEqual[y$95$m, 3700000.0], 1.0, -1.0]
      
      \begin{array}{l}
      y_m = \left|y\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y\_m \leq 3700000:\\
      \;\;\;\;1\\
      
      \mathbf{else}:\\
      \;\;\;\;-1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 3.7e6

        1. Initial program 55.8%

          \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
        2. Add Preprocessing
        3. Taylor expanded in x around inf

          \[\leadsto \color{blue}{1} \]
        4. Step-by-step derivation
          1. Applied rewrites60.2%

            \[\leadsto \color{blue}{1} \]

          if 3.7e6 < y

          1. Initial program 42.4%

            \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
          2. Add Preprocessing
          3. Taylor expanded in x around 0

            \[\leadsto \color{blue}{-1} \]
          4. Step-by-step derivation
            1. Applied rewrites80.0%

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

          Alternative 3: 51.8% accurate, N/A× speedup?

          \[\begin{array}{l} y_m = \left|y\right| \\ -1 \end{array} \]
          y_m = (fabs.f64 y)
          (FPCore (x y_m) :precision binary64 -1.0)
          y_m = fabs(y);
          double code(double x, double y_m) {
          	return -1.0;
          }
          
          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, y_m)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y_m
              code = -1.0d0
          end function
          
          y_m = Math.abs(y);
          public static double code(double x, double y_m) {
          	return -1.0;
          }
          
          y_m = math.fabs(y)
          def code(x, y_m):
          	return -1.0
          
          y_m = abs(y)
          function code(x, y_m)
          	return -1.0
          end
          
          y_m = abs(y);
          function tmp = code(x, y_m)
          	tmp = -1.0;
          end
          
          y_m = N[Abs[y], $MachinePrecision]
          code[x_, y$95$m_] := -1.0
          
          \begin{array}{l}
          y_m = \left|y\right|
          
          \\
          -1
          \end{array}
          
          Derivation
          1. Initial program 52.7%

            \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
          2. Add Preprocessing
          3. Taylor expanded in x around 0

            \[\leadsto \color{blue}{-1} \]
          4. Step-by-step derivation
            1. Applied rewrites49.9%

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

            Reproduce

            ?
            herbie shell --seed 2025057 
            (FPCore (x y)
              :name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
              :precision binary64
            
              :alt
              (! :herbie-platform default (if (< (/ (- (* x x) (* (* y 4) y)) (+ (* x x) (* (* y 4) y))) 9743233849626781/10000000000000000) (- (/ (* x x) (+ (* x x) (* (* y y) 4))) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4)))) 2) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4))))))
            
              (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))