Statistics.Sample:$skurtosis from math-functions-0.1.5.2

Percentage Accurate: 94.1% → 99.8%
Time: 4.3s
Alternatives: 5
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{x}{y \cdot y} - 3 \end{array} \]
(FPCore (x y) :precision binary64 (- (/ x (* y y)) 3.0))
double code(double x, double y) {
	return (x / (y * y)) - 3.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x / (y * y)) - 3.0d0
end function
public static double code(double x, double y) {
	return (x / (y * y)) - 3.0;
}
def code(x, y):
	return (x / (y * y)) - 3.0
function code(x, y)
	return Float64(Float64(x / Float64(y * y)) - 3.0)
end
function tmp = code(x, y)
	tmp = (x / (y * y)) - 3.0;
end
code[x_, y_] := N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{y \cdot y} - 3
\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 5 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: 94.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x}{y \cdot y} - 3 \end{array} \]
(FPCore (x y) :precision binary64 (- (/ x (* y y)) 3.0))
double code(double x, double y) {
	return (x / (y * y)) - 3.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x / (y * y)) - 3.0d0
end function
public static double code(double x, double y) {
	return (x / (y * y)) - 3.0;
}
def code(x, y):
	return (x / (y * y)) - 3.0
function code(x, y)
	return Float64(Float64(x / Float64(y * y)) - 3.0)
end
function tmp = code(x, y)
	tmp = (x / (y * y)) - 3.0;
end
code[x_, y_] := N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{y \cdot y} - 3
\end{array}

Alternative 1: 99.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot y \leq 5 \cdot 10^{-289}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y} - 3\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (* y y) 5e-289) (/ (/ x y) y) (- (/ x (* y y)) 3.0)))
double code(double x, double y) {
	double tmp;
	if ((y * y) <= 5e-289) {
		tmp = (x / y) / y;
	} else {
		tmp = (x / (y * y)) - 3.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y * y) <= 5d-289) then
        tmp = (x / y) / y
    else
        tmp = (x / (y * y)) - 3.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y * y) <= 5e-289) {
		tmp = (x / y) / y;
	} else {
		tmp = (x / (y * y)) - 3.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y * y) <= 5e-289:
		tmp = (x / y) / y
	else:
		tmp = (x / (y * y)) - 3.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (Float64(y * y) <= 5e-289)
		tmp = Float64(Float64(x / y) / y);
	else
		tmp = Float64(Float64(x / Float64(y * y)) - 3.0);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y * y) <= 5e-289)
		tmp = (x / y) / y;
	else
		tmp = (x / (y * y)) - 3.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[(y * y), $MachinePrecision], 5e-289], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision], N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 5 \cdot 10^{-289}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y} - 3\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y y) < 5.00000000000000029e-289

    1. Initial program 78.4%

      \[\frac{x}{y \cdot y} - 3 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. unpow1N/A

        \[\leadsto \color{blue}{{\left(\frac{x}{y \cdot y}\right)}^{1}} - 3 \]
      2. metadata-evalN/A

        \[\leadsto {\left(\frac{x}{y \cdot y}\right)}^{\color{blue}{\left(\frac{2}{2}\right)}} - 3 \]
      3. sqrt-pow1N/A

        \[\leadsto \color{blue}{\sqrt{{\left(\frac{x}{y \cdot y}\right)}^{2}}} - 3 \]
      4. pow2N/A

        \[\leadsto \sqrt{\color{blue}{\frac{x}{y \cdot y} \cdot \frac{x}{y \cdot y}}} - 3 \]
      5. lift-/.f64N/A

        \[\leadsto \sqrt{\color{blue}{\frac{x}{y \cdot y}} \cdot \frac{x}{y \cdot y}} - 3 \]
      6. associate-*l/N/A

        \[\leadsto \sqrt{\color{blue}{\frac{x \cdot \frac{x}{y \cdot y}}{y \cdot y}}} - 3 \]
      7. associate-/l*N/A

        \[\leadsto \sqrt{\color{blue}{x \cdot \frac{\frac{x}{y \cdot y}}{y \cdot y}}} - 3 \]
      8. sqrt-prodN/A

        \[\leadsto \color{blue}{\sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{y \cdot y}}} - 3 \]
      9. rem-square-sqrtN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\sqrt{y \cdot y} \cdot \sqrt{y \cdot y}}}} - 3 \]
      10. sqrt-unprodN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}}}} - 3 \]
      11. rem-sqrt-square-revN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\left|y \cdot y\right|}}} - 3 \]
      12. neg-fabsN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\left|\mathsf{neg}\left(y \cdot y\right)\right|}}} - 3 \]
      13. rem-sqrt-squareN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\sqrt{\left(\mathsf{neg}\left(y \cdot y\right)\right) \cdot \left(\mathsf{neg}\left(y \cdot y\right)\right)}}}} - 3 \]
      14. sqrt-prodN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\sqrt{\mathsf{neg}\left(y \cdot y\right)} \cdot \sqrt{\mathsf{neg}\left(y \cdot y\right)}}}} - 3 \]
      15. rem-square-sqrtN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\mathsf{neg}\left(y \cdot y\right)}}} - 3 \]
      16. lower-*.f64N/A

        \[\leadsto \color{blue}{\sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\mathsf{neg}\left(y \cdot y\right)}}} - 3 \]
      17. lower-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{x}} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\mathsf{neg}\left(y \cdot y\right)}} - 3 \]
      18. lower-sqrt.f64N/A

        \[\leadsto \sqrt{x} \cdot \color{blue}{\sqrt{\frac{\frac{x}{y \cdot y}}{\mathsf{neg}\left(y \cdot y\right)}}} - 3 \]
      19. lower-/.f64N/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\color{blue}{\frac{\frac{x}{y \cdot y}}{\mathsf{neg}\left(y \cdot y\right)}}} - 3 \]
    4. Applied rewrites37.5%

      \[\leadsto \color{blue}{\sqrt{x} \cdot \sqrt{\frac{\frac{\frac{x}{y}}{y}}{y \cdot y}}} - 3 \]
    5. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot {\left(\sqrt{-1}\right)}^{2}}{{y}^{2}}} \]
    6. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(x \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{{y}^{2}}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x \cdot {\left(\sqrt{-1}\right)}^{2}\right)}}{{y}^{2}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{{\left(\sqrt{-1}\right)}^{2} \cdot x}\right)}{{y}^{2}} \]
      4. unpow2N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot x\right)}{{y}^{2}} \]
      5. rem-square-sqrtN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{-1} \cdot x\right)}{{y}^{2}} \]
      6. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{{y}^{2}} \]
      7. remove-double-negN/A

        \[\leadsto \frac{\color{blue}{x}}{{y}^{2}} \]
      8. unpow2N/A

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
      9. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} \]
      10. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} \]
      11. lower-/.f6499.9

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    7. Applied rewrites99.9%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} \]

    if 5.00000000000000029e-289 < (*.f64 y y)

    1. Initial program 99.9%

      \[\frac{x}{y \cdot y} - 3 \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 93.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{y \cdot y}\\ \mathbf{if}\;t\_0 \leq -3 \lor \neg \left(t\_0 \leq 3\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;-3\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ x (* y y))))
   (if (or (<= t_0 -3.0) (not (<= t_0 3.0))) t_0 -3.0)))
double code(double x, double y) {
	double t_0 = x / (y * y);
	double tmp;
	if ((t_0 <= -3.0) || !(t_0 <= 3.0)) {
		tmp = t_0;
	} else {
		tmp = -3.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x / (y * y)
    if ((t_0 <= (-3.0d0)) .or. (.not. (t_0 <= 3.0d0))) then
        tmp = t_0
    else
        tmp = -3.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x / (y * y);
	double tmp;
	if ((t_0 <= -3.0) || !(t_0 <= 3.0)) {
		tmp = t_0;
	} else {
		tmp = -3.0;
	}
	return tmp;
}
def code(x, y):
	t_0 = x / (y * y)
	tmp = 0
	if (t_0 <= -3.0) or not (t_0 <= 3.0):
		tmp = t_0
	else:
		tmp = -3.0
	return tmp
function code(x, y)
	t_0 = Float64(x / Float64(y * y))
	tmp = 0.0
	if ((t_0 <= -3.0) || !(t_0 <= 3.0))
		tmp = t_0;
	else
		tmp = -3.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x / (y * y);
	tmp = 0.0;
	if ((t_0 <= -3.0) || ~((t_0 <= 3.0)))
		tmp = t_0;
	else
		tmp = -3.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -3.0], N[Not[LessEqual[t$95$0, 3.0]], $MachinePrecision]], t$95$0, -3.0]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot y}\\
\mathbf{if}\;t\_0 \leq -3 \lor \neg \left(t\_0 \leq 3\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x (*.f64 y y)) < -3 or 3 < (/.f64 x (*.f64 y y))

    1. Initial program 88.0%

      \[\frac{x}{y \cdot y} - 3 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. unpow1N/A

        \[\leadsto \color{blue}{{\left(\frac{x}{y \cdot y}\right)}^{1}} - 3 \]
      2. metadata-evalN/A

        \[\leadsto {\left(\frac{x}{y \cdot y}\right)}^{\color{blue}{\left(\frac{2}{2}\right)}} - 3 \]
      3. sqrt-pow1N/A

        \[\leadsto \color{blue}{\sqrt{{\left(\frac{x}{y \cdot y}\right)}^{2}}} - 3 \]
      4. pow2N/A

        \[\leadsto \sqrt{\color{blue}{\frac{x}{y \cdot y} \cdot \frac{x}{y \cdot y}}} - 3 \]
      5. lift-/.f64N/A

        \[\leadsto \sqrt{\color{blue}{\frac{x}{y \cdot y}} \cdot \frac{x}{y \cdot y}} - 3 \]
      6. associate-*l/N/A

        \[\leadsto \sqrt{\color{blue}{\frac{x \cdot \frac{x}{y \cdot y}}{y \cdot y}}} - 3 \]
      7. associate-/l*N/A

        \[\leadsto \sqrt{\color{blue}{x \cdot \frac{\frac{x}{y \cdot y}}{y \cdot y}}} - 3 \]
      8. sqrt-prodN/A

        \[\leadsto \color{blue}{\sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{y \cdot y}}} - 3 \]
      9. rem-square-sqrtN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\sqrt{y \cdot y} \cdot \sqrt{y \cdot y}}}} - 3 \]
      10. sqrt-unprodN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}}}} - 3 \]
      11. rem-sqrt-square-revN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\left|y \cdot y\right|}}} - 3 \]
      12. neg-fabsN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\left|\mathsf{neg}\left(y \cdot y\right)\right|}}} - 3 \]
      13. rem-sqrt-squareN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\sqrt{\left(\mathsf{neg}\left(y \cdot y\right)\right) \cdot \left(\mathsf{neg}\left(y \cdot y\right)\right)}}}} - 3 \]
      14. sqrt-prodN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\sqrt{\mathsf{neg}\left(y \cdot y\right)} \cdot \sqrt{\mathsf{neg}\left(y \cdot y\right)}}}} - 3 \]
      15. rem-square-sqrtN/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\color{blue}{\mathsf{neg}\left(y \cdot y\right)}}} - 3 \]
      16. lower-*.f64N/A

        \[\leadsto \color{blue}{\sqrt{x} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\mathsf{neg}\left(y \cdot y\right)}}} - 3 \]
      17. lower-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{x}} \cdot \sqrt{\frac{\frac{x}{y \cdot y}}{\mathsf{neg}\left(y \cdot y\right)}} - 3 \]
      18. lower-sqrt.f64N/A

        \[\leadsto \sqrt{x} \cdot \color{blue}{\sqrt{\frac{\frac{x}{y \cdot y}}{\mathsf{neg}\left(y \cdot y\right)}}} - 3 \]
      19. lower-/.f64N/A

        \[\leadsto \sqrt{x} \cdot \sqrt{\color{blue}{\frac{\frac{x}{y \cdot y}}{\mathsf{neg}\left(y \cdot y\right)}}} - 3 \]
    4. Applied rewrites34.5%

      \[\leadsto \color{blue}{\sqrt{x} \cdot \sqrt{\frac{\frac{\frac{x}{y}}{y}}{y \cdot y}}} - 3 \]
    5. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot {\left(\sqrt{-1}\right)}^{2}}{{y}^{2}}} \]
    6. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(x \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{{y}^{2}}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x \cdot {\left(\sqrt{-1}\right)}^{2}\right)}}{{y}^{2}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{{\left(\sqrt{-1}\right)}^{2} \cdot x}\right)}{{y}^{2}} \]
      4. unpow2N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot x\right)}{{y}^{2}} \]
      5. rem-square-sqrtN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{-1} \cdot x\right)}{{y}^{2}} \]
      6. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{{y}^{2}} \]
      7. remove-double-negN/A

        \[\leadsto \frac{\color{blue}{x}}{{y}^{2}} \]
      8. unpow2N/A

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
      9. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} \]
      10. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} \]
      11. lower-/.f6499.0

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    7. Applied rewrites99.0%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} \]
    8. Step-by-step derivation
      1. Applied rewrites87.2%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]

      if -3 < (/.f64 x (*.f64 y y)) < 3

      1. Initial program 100.0%

        \[\frac{x}{y \cdot y} - 3 \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

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

          \[\leadsto \color{blue}{-3} \]
      5. Recombined 2 regimes into one program.
      6. Final simplification93.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y \cdot y} \leq -3 \lor \neg \left(\frac{x}{y \cdot y} \leq 3\right):\\ \;\;\;\;\frac{x}{y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;-3\\ \end{array} \]
      7. Add Preprocessing

      Alternative 3: 99.9% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \frac{\frac{x}{y}}{y} - 3 \end{array} \]
      (FPCore (x y) :precision binary64 (- (/ (/ x y) y) 3.0))
      double code(double x, double y) {
      	return ((x / y) / y) - 3.0;
      }
      
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          code = ((x / y) / y) - 3.0d0
      end function
      
      public static double code(double x, double y) {
      	return ((x / y) / y) - 3.0;
      }
      
      def code(x, y):
      	return ((x / y) / y) - 3.0
      
      function code(x, y)
      	return Float64(Float64(Float64(x / y) / y) - 3.0)
      end
      
      function tmp = code(x, y)
      	tmp = ((x / y) / y) - 3.0;
      end
      
      code[x_, y_] := N[(N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] - 3.0), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \frac{\frac{x}{y}}{y} - 3
      \end{array}
      
      Derivation
      1. Initial program 93.9%

        \[\frac{x}{y \cdot y} - 3 \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x}{y \cdot y}} - 3 \]
        2. lift-*.f64N/A

          \[\leadsto \frac{x}{\color{blue}{y \cdot y}} - 3 \]
        3. associate-/r*N/A

          \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} - 3 \]
        4. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} - 3 \]
        5. lower-/.f6499.9

          \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} - 3 \]
      4. Applied rewrites99.9%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y} - 3} \]
      5. Add Preprocessing

      Alternative 4: 94.1% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \frac{x}{y \cdot y} - 3 \end{array} \]
      (FPCore (x y) :precision binary64 (- (/ x (* y y)) 3.0))
      double code(double x, double y) {
      	return (x / (y * y)) - 3.0;
      }
      
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          code = (x / (y * y)) - 3.0d0
      end function
      
      public static double code(double x, double y) {
      	return (x / (y * y)) - 3.0;
      }
      
      def code(x, y):
      	return (x / (y * y)) - 3.0
      
      function code(x, y)
      	return Float64(Float64(x / Float64(y * y)) - 3.0)
      end
      
      function tmp = code(x, y)
      	tmp = (x / (y * y)) - 3.0;
      end
      
      code[x_, y_] := N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \frac{x}{y \cdot y} - 3
      \end{array}
      
      Derivation
      1. Initial program 93.9%

        \[\frac{x}{y \cdot y} - 3 \]
      2. Add Preprocessing
      3. Add Preprocessing

      Alternative 5: 49.6% accurate, 20.0× speedup?

      \[\begin{array}{l} \\ -3 \end{array} \]
      (FPCore (x y) :precision binary64 -3.0)
      double code(double x, double y) {
      	return -3.0;
      }
      
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          code = -3.0d0
      end function
      
      public static double code(double x, double y) {
      	return -3.0;
      }
      
      def code(x, y):
      	return -3.0
      
      function code(x, y)
      	return -3.0
      end
      
      function tmp = code(x, y)
      	tmp = -3.0;
      end
      
      code[x_, y_] := -3.0
      
      \begin{array}{l}
      
      \\
      -3
      \end{array}
      
      Derivation
      1. Initial program 93.9%

        \[\frac{x}{y \cdot y} - 3 \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

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

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

        Developer Target 1: 99.9% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \frac{\frac{x}{y}}{y} - 3 \end{array} \]
        (FPCore (x y) :precision binary64 (- (/ (/ x y) y) 3.0))
        double code(double x, double y) {
        	return ((x / y) / y) - 3.0;
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = ((x / y) / y) - 3.0d0
        end function
        
        public static double code(double x, double y) {
        	return ((x / y) / y) - 3.0;
        }
        
        def code(x, y):
        	return ((x / y) / y) - 3.0
        
        function code(x, y)
        	return Float64(Float64(Float64(x / y) / y) - 3.0)
        end
        
        function tmp = code(x, y)
        	tmp = ((x / y) / y) - 3.0;
        end
        
        code[x_, y_] := N[(N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] - 3.0), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \frac{\frac{x}{y}}{y} - 3
        \end{array}
        

        Reproduce

        ?
        herbie shell --seed 2024320 
        (FPCore (x y)
          :name "Statistics.Sample:$skurtosis from math-functions-0.1.5.2"
          :precision binary64
        
          :alt
          (! :herbie-platform default (- (/ (/ x y) y) 3))
        
          (- (/ x (* y y)) 3.0))