Development.Shake.Progress:message from shake-0.15.5

Percentage Accurate: 99.4% → 99.8%
Time: 3.6s
Alternatives: 5
Speedup: 1.0×

Specification

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

\\
\frac{x \cdot 100}{x + y}
\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: 99.4% accurate, 1.0× speedup?

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

\\
\frac{x \cdot 100}{x + y}
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

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

\\
x \cdot \frac{100}{y + x}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{x \cdot 100}{x + y} \]
  2. Step-by-step derivation
    1. associate-/l*99.7%

      \[\leadsto \color{blue}{\frac{x}{\frac{x + y}{100}}} \]
  3. Simplified99.7%

    \[\leadsto \color{blue}{\frac{x}{\frac{x + y}{100}}} \]
  4. Step-by-step derivation
    1. clear-num99.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{x + y}{100}}{x}}} \]
    2. associate-/r/99.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{100}} \cdot x} \]
    3. clear-num99.8%

      \[\leadsto \color{blue}{\frac{100}{x + y}} \cdot x \]
    4. +-commutative99.8%

      \[\leadsto \frac{100}{\color{blue}{y + x}} \cdot x \]
  5. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\frac{100}{y + x} \cdot x} \]
  6. Final simplification99.8%

    \[\leadsto x \cdot \frac{100}{y + x} \]

Alternative 2: 73.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.15 \cdot 10^{+136} \lor \neg \left(y \leq -4.1 \cdot 10^{+128} \lor \neg \left(y \leq -2.9 \cdot 10^{+45}\right) \land y \leq 1.6 \cdot 10^{+31}\right):\\ \;\;\;\;100 \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -2.15e+136)
         (not
          (or (<= y -4.1e+128) (and (not (<= y -2.9e+45)) (<= y 1.6e+31)))))
   (* 100.0 (/ x y))
   100.0))
double code(double x, double y) {
	double tmp;
	if ((y <= -2.15e+136) || !((y <= -4.1e+128) || (!(y <= -2.9e+45) && (y <= 1.6e+31)))) {
		tmp = 100.0 * (x / y);
	} else {
		tmp = 100.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-2.15d+136)) .or. (.not. (y <= (-4.1d+128)) .or. (.not. (y <= (-2.9d+45))) .and. (y <= 1.6d+31))) then
        tmp = 100.0d0 * (x / y)
    else
        tmp = 100.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -2.15e+136) || !((y <= -4.1e+128) || (!(y <= -2.9e+45) && (y <= 1.6e+31)))) {
		tmp = 100.0 * (x / y);
	} else {
		tmp = 100.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -2.15e+136) or not ((y <= -4.1e+128) or (not (y <= -2.9e+45) and (y <= 1.6e+31))):
		tmp = 100.0 * (x / y)
	else:
		tmp = 100.0
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -2.15e+136) || !((y <= -4.1e+128) || (!(y <= -2.9e+45) && (y <= 1.6e+31))))
		tmp = Float64(100.0 * Float64(x / y));
	else
		tmp = 100.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -2.15e+136) || ~(((y <= -4.1e+128) || (~((y <= -2.9e+45)) && (y <= 1.6e+31)))))
		tmp = 100.0 * (x / y);
	else
		tmp = 100.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -2.15e+136], N[Not[Or[LessEqual[y, -4.1e+128], And[N[Not[LessEqual[y, -2.9e+45]], $MachinePrecision], LessEqual[y, 1.6e+31]]]], $MachinePrecision]], N[(100.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 100.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+136} \lor \neg \left(y \leq -4.1 \cdot 10^{+128} \lor \neg \left(y \leq -2.9 \cdot 10^{+45}\right) \land y \leq 1.6 \cdot 10^{+31}\right):\\
\;\;\;\;100 \cdot \frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;100\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.1499999999999999e136 or -4.10000000000000012e128 < y < -2.8999999999999997e45 or 1.6e31 < y

    1. Initial program 99.7%

      \[\frac{x \cdot 100}{x + y} \]
    2. Step-by-step derivation
      1. *-commutative99.7%

        \[\leadsto \frac{\color{blue}{100 \cdot x}}{x + y} \]
      2. +-commutative99.7%

        \[\leadsto \frac{100 \cdot x}{\color{blue}{y + x}} \]
      3. associate-/l*97.8%

        \[\leadsto \color{blue}{\frac{100}{\frac{y + x}{x}}} \]
      4. remove-double-neg97.8%

        \[\leadsto \frac{100}{\frac{y + \color{blue}{\left(-\left(-x\right)\right)}}{x}} \]
      5. unsub-neg97.8%

        \[\leadsto \frac{100}{\frac{\color{blue}{y - \left(-x\right)}}{x}} \]
      6. div-sub97.8%

        \[\leadsto \frac{100}{\color{blue}{\frac{y}{x} - \frac{-x}{x}}} \]
      7. distribute-frac-neg97.8%

        \[\leadsto \frac{100}{\frac{y}{x} - \color{blue}{\left(-\frac{x}{x}\right)}} \]
      8. *-inverses97.8%

        \[\leadsto \frac{100}{\frac{y}{x} - \left(-\color{blue}{1}\right)} \]
      9. metadata-eval97.8%

        \[\leadsto \frac{100}{\frac{y}{x} - \color{blue}{-1}} \]
    3. Simplified97.8%

      \[\leadsto \color{blue}{\frac{100}{\frac{y}{x} - -1}} \]
    4. Taylor expanded in y around inf 77.1%

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

    if -2.1499999999999999e136 < y < -4.10000000000000012e128 or -2.8999999999999997e45 < y < 1.6e31

    1. Initial program 99.8%

      \[\frac{x \cdot 100}{x + y} \]
    2. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \frac{\color{blue}{100 \cdot x}}{x + y} \]
      2. +-commutative99.8%

        \[\leadsto \frac{100 \cdot x}{\color{blue}{y + x}} \]
      3. associate-/l*99.5%

        \[\leadsto \color{blue}{\frac{100}{\frac{y + x}{x}}} \]
      4. remove-double-neg99.5%

        \[\leadsto \frac{100}{\frac{y + \color{blue}{\left(-\left(-x\right)\right)}}{x}} \]
      5. unsub-neg99.5%

        \[\leadsto \frac{100}{\frac{\color{blue}{y - \left(-x\right)}}{x}} \]
      6. div-sub99.5%

        \[\leadsto \frac{100}{\color{blue}{\frac{y}{x} - \frac{-x}{x}}} \]
      7. distribute-frac-neg99.5%

        \[\leadsto \frac{100}{\frac{y}{x} - \color{blue}{\left(-\frac{x}{x}\right)}} \]
      8. *-inverses99.5%

        \[\leadsto \frac{100}{\frac{y}{x} - \left(-\color{blue}{1}\right)} \]
      9. metadata-eval99.5%

        \[\leadsto \frac{100}{\frac{y}{x} - \color{blue}{-1}} \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\frac{100}{\frac{y}{x} - -1}} \]
    4. Taylor expanded in y around 0 76.2%

      \[\leadsto \color{blue}{100} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.15 \cdot 10^{+136} \lor \neg \left(y \leq -4.1 \cdot 10^{+128} \lor \neg \left(y \leq -2.9 \cdot 10^{+45}\right) \land y \leq 1.6 \cdot 10^{+31}\right):\\ \;\;\;\;100 \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \]

Alternative 3: 74.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+135} \lor \neg \left(y \leq -4 \cdot 10^{+128} \lor \neg \left(y \leq -2.1 \cdot 10^{+46}\right) \land y \leq 2.95 \cdot 10^{+31}\right):\\ \;\;\;\;x \cdot \frac{100}{y}\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -3.2e+135)
         (not (or (<= y -4e+128) (and (not (<= y -2.1e+46)) (<= y 2.95e+31)))))
   (* x (/ 100.0 y))
   100.0))
double code(double x, double y) {
	double tmp;
	if ((y <= -3.2e+135) || !((y <= -4e+128) || (!(y <= -2.1e+46) && (y <= 2.95e+31)))) {
		tmp = x * (100.0 / y);
	} else {
		tmp = 100.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-3.2d+135)) .or. (.not. (y <= (-4d+128)) .or. (.not. (y <= (-2.1d+46))) .and. (y <= 2.95d+31))) then
        tmp = x * (100.0d0 / y)
    else
        tmp = 100.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -3.2e+135) || !((y <= -4e+128) || (!(y <= -2.1e+46) && (y <= 2.95e+31)))) {
		tmp = x * (100.0 / y);
	} else {
		tmp = 100.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -3.2e+135) or not ((y <= -4e+128) or (not (y <= -2.1e+46) and (y <= 2.95e+31))):
		tmp = x * (100.0 / y)
	else:
		tmp = 100.0
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -3.2e+135) || !((y <= -4e+128) || (!(y <= -2.1e+46) && (y <= 2.95e+31))))
		tmp = Float64(x * Float64(100.0 / y));
	else
		tmp = 100.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -3.2e+135) || ~(((y <= -4e+128) || (~((y <= -2.1e+46)) && (y <= 2.95e+31)))))
		tmp = x * (100.0 / y);
	else
		tmp = 100.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -3.2e+135], N[Not[Or[LessEqual[y, -4e+128], And[N[Not[LessEqual[y, -2.1e+46]], $MachinePrecision], LessEqual[y, 2.95e+31]]]], $MachinePrecision]], N[(x * N[(100.0 / y), $MachinePrecision]), $MachinePrecision], 100.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+135} \lor \neg \left(y \leq -4 \cdot 10^{+128} \lor \neg \left(y \leq -2.1 \cdot 10^{+46}\right) \land y \leq 2.95 \cdot 10^{+31}\right):\\
\;\;\;\;x \cdot \frac{100}{y}\\

\mathbf{else}:\\
\;\;\;\;100\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.19999999999999975e135 or -4.0000000000000003e128 < y < -2.1e46 or 2.9500000000000002e31 < y

    1. Initial program 99.7%

      \[\frac{x \cdot 100}{x + y} \]
    2. Step-by-step derivation
      1. associate-/l*99.7%

        \[\leadsto \color{blue}{\frac{x}{\frac{x + y}{100}}} \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\frac{x}{\frac{x + y}{100}}} \]
    4. Step-by-step derivation
      1. clear-num98.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{x + y}{100}}{x}}} \]
      2. associate-/r/99.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{100}} \cdot x} \]
      3. clear-num99.9%

        \[\leadsto \color{blue}{\frac{100}{x + y}} \cdot x \]
      4. +-commutative99.9%

        \[\leadsto \frac{100}{\color{blue}{y + x}} \cdot x \]
    5. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{100}{y + x} \cdot x} \]
    6. Taylor expanded in y around inf 77.5%

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

    if -3.19999999999999975e135 < y < -4.0000000000000003e128 or -2.1e46 < y < 2.9500000000000002e31

    1. Initial program 99.8%

      \[\frac{x \cdot 100}{x + y} \]
    2. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \frac{\color{blue}{100 \cdot x}}{x + y} \]
      2. +-commutative99.8%

        \[\leadsto \frac{100 \cdot x}{\color{blue}{y + x}} \]
      3. associate-/l*99.5%

        \[\leadsto \color{blue}{\frac{100}{\frac{y + x}{x}}} \]
      4. remove-double-neg99.5%

        \[\leadsto \frac{100}{\frac{y + \color{blue}{\left(-\left(-x\right)\right)}}{x}} \]
      5. unsub-neg99.5%

        \[\leadsto \frac{100}{\frac{\color{blue}{y - \left(-x\right)}}{x}} \]
      6. div-sub99.5%

        \[\leadsto \frac{100}{\color{blue}{\frac{y}{x} - \frac{-x}{x}}} \]
      7. distribute-frac-neg99.5%

        \[\leadsto \frac{100}{\frac{y}{x} - \color{blue}{\left(-\frac{x}{x}\right)}} \]
      8. *-inverses99.5%

        \[\leadsto \frac{100}{\frac{y}{x} - \left(-\color{blue}{1}\right)} \]
      9. metadata-eval99.5%

        \[\leadsto \frac{100}{\frac{y}{x} - \color{blue}{-1}} \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\frac{100}{\frac{y}{x} - -1}} \]
    4. Taylor expanded in y around 0 76.2%

      \[\leadsto \color{blue}{100} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+135} \lor \neg \left(y \leq -4 \cdot 10^{+128} \lor \neg \left(y \leq -2.1 \cdot 10^{+46}\right) \land y \leq 2.95 \cdot 10^{+31}\right):\\ \;\;\;\;x \cdot \frac{100}{y}\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \]

Alternative 4: 74.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{100}{y}\\ \mathbf{if}\;y \leq -4.9 \cdot 10^{+135}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -4.1 \cdot 10^{+128}:\\ \;\;\;\;\frac{100 \cdot x}{x}\\ \mathbf{elif}\;y \leq -2.95 \cdot 10^{+47} \lor \neg \left(y \leq 3.7 \cdot 10^{+32}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* x (/ 100.0 y))))
   (if (<= y -4.9e+135)
     t_0
     (if (<= y -4.1e+128)
       (/ (* 100.0 x) x)
       (if (or (<= y -2.95e+47) (not (<= y 3.7e+32))) t_0 100.0)))))
double code(double x, double y) {
	double t_0 = x * (100.0 / y);
	double tmp;
	if (y <= -4.9e+135) {
		tmp = t_0;
	} else if (y <= -4.1e+128) {
		tmp = (100.0 * x) / x;
	} else if ((y <= -2.95e+47) || !(y <= 3.7e+32)) {
		tmp = t_0;
	} else {
		tmp = 100.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 * (100.0d0 / y)
    if (y <= (-4.9d+135)) then
        tmp = t_0
    else if (y <= (-4.1d+128)) then
        tmp = (100.0d0 * x) / x
    else if ((y <= (-2.95d+47)) .or. (.not. (y <= 3.7d+32))) then
        tmp = t_0
    else
        tmp = 100.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x * (100.0 / y);
	double tmp;
	if (y <= -4.9e+135) {
		tmp = t_0;
	} else if (y <= -4.1e+128) {
		tmp = (100.0 * x) / x;
	} else if ((y <= -2.95e+47) || !(y <= 3.7e+32)) {
		tmp = t_0;
	} else {
		tmp = 100.0;
	}
	return tmp;
}
def code(x, y):
	t_0 = x * (100.0 / y)
	tmp = 0
	if y <= -4.9e+135:
		tmp = t_0
	elif y <= -4.1e+128:
		tmp = (100.0 * x) / x
	elif (y <= -2.95e+47) or not (y <= 3.7e+32):
		tmp = t_0
	else:
		tmp = 100.0
	return tmp
function code(x, y)
	t_0 = Float64(x * Float64(100.0 / y))
	tmp = 0.0
	if (y <= -4.9e+135)
		tmp = t_0;
	elseif (y <= -4.1e+128)
		tmp = Float64(Float64(100.0 * x) / x);
	elseif ((y <= -2.95e+47) || !(y <= 3.7e+32))
		tmp = t_0;
	else
		tmp = 100.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x * (100.0 / y);
	tmp = 0.0;
	if (y <= -4.9e+135)
		tmp = t_0;
	elseif (y <= -4.1e+128)
		tmp = (100.0 * x) / x;
	elseif ((y <= -2.95e+47) || ~((y <= 3.7e+32)))
		tmp = t_0;
	else
		tmp = 100.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(100.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.9e+135], t$95$0, If[LessEqual[y, -4.1e+128], N[(N[(100.0 * x), $MachinePrecision] / x), $MachinePrecision], If[Or[LessEqual[y, -2.95e+47], N[Not[LessEqual[y, 3.7e+32]], $MachinePrecision]], t$95$0, 100.0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \frac{100}{y}\\
\mathbf{if}\;y \leq -4.9 \cdot 10^{+135}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq -4.1 \cdot 10^{+128}:\\
\;\;\;\;\frac{100 \cdot x}{x}\\

\mathbf{elif}\;y \leq -2.95 \cdot 10^{+47} \lor \neg \left(y \leq 3.7 \cdot 10^{+32}\right):\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;100\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.9000000000000001e135 or -4.10000000000000012e128 < y < -2.95000000000000017e47 or 3.7e32 < y

    1. Initial program 99.7%

      \[\frac{x \cdot 100}{x + y} \]
    2. Step-by-step derivation
      1. associate-/l*99.7%

        \[\leadsto \color{blue}{\frac{x}{\frac{x + y}{100}}} \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\frac{x}{\frac{x + y}{100}}} \]
    4. Step-by-step derivation
      1. clear-num98.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{x + y}{100}}{x}}} \]
      2. associate-/r/99.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{100}} \cdot x} \]
      3. clear-num99.9%

        \[\leadsto \color{blue}{\frac{100}{x + y}} \cdot x \]
      4. +-commutative99.9%

        \[\leadsto \frac{100}{\color{blue}{y + x}} \cdot x \]
    5. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{100}{y + x} \cdot x} \]
    6. Taylor expanded in y around inf 77.5%

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

    if -4.9000000000000001e135 < y < -4.10000000000000012e128

    1. Initial program 99.7%

      \[\frac{x \cdot 100}{x + y} \]
    2. Step-by-step derivation
      1. associate-/l*99.1%

        \[\leadsto \color{blue}{\frac{x}{\frac{x + y}{100}}} \]
    3. Simplified99.1%

      \[\leadsto \color{blue}{\frac{x}{\frac{x + y}{100}}} \]
    4. Step-by-step derivation
      1. clear-num99.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{x + y}{100}}{x}}} \]
      2. associate-/r/98.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{100}} \cdot x} \]
      3. clear-num99.7%

        \[\leadsto \color{blue}{\frac{100}{x + y}} \cdot x \]
      4. +-commutative99.7%

        \[\leadsto \frac{100}{\color{blue}{y + x}} \cdot x \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{100}{y + x} \cdot x} \]
    6. Taylor expanded in y around 0 88.1%

      \[\leadsto \color{blue}{\frac{100}{x}} \cdot x \]
    7. Step-by-step derivation
      1. associate-*l/88.4%

        \[\leadsto \color{blue}{\frac{100 \cdot x}{x}} \]
    8. Applied egg-rr88.4%

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

    if -2.95000000000000017e47 < y < 3.7e32

    1. Initial program 99.8%

      \[\frac{x \cdot 100}{x + y} \]
    2. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \frac{\color{blue}{100 \cdot x}}{x + y} \]
      2. +-commutative99.8%

        \[\leadsto \frac{100 \cdot x}{\color{blue}{y + x}} \]
      3. associate-/l*99.5%

        \[\leadsto \color{blue}{\frac{100}{\frac{y + x}{x}}} \]
      4. remove-double-neg99.5%

        \[\leadsto \frac{100}{\frac{y + \color{blue}{\left(-\left(-x\right)\right)}}{x}} \]
      5. unsub-neg99.5%

        \[\leadsto \frac{100}{\frac{\color{blue}{y - \left(-x\right)}}{x}} \]
      6. div-sub99.5%

        \[\leadsto \frac{100}{\color{blue}{\frac{y}{x} - \frac{-x}{x}}} \]
      7. distribute-frac-neg99.5%

        \[\leadsto \frac{100}{\frac{y}{x} - \color{blue}{\left(-\frac{x}{x}\right)}} \]
      8. *-inverses99.5%

        \[\leadsto \frac{100}{\frac{y}{x} - \left(-\color{blue}{1}\right)} \]
      9. metadata-eval99.5%

        \[\leadsto \frac{100}{\frac{y}{x} - \color{blue}{-1}} \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\frac{100}{\frac{y}{x} - -1}} \]
    4. Taylor expanded in y around 0 75.9%

      \[\leadsto \color{blue}{100} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification76.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.9 \cdot 10^{+135}:\\ \;\;\;\;x \cdot \frac{100}{y}\\ \mathbf{elif}\;y \leq -4.1 \cdot 10^{+128}:\\ \;\;\;\;\frac{100 \cdot x}{x}\\ \mathbf{elif}\;y \leq -2.95 \cdot 10^{+47} \lor \neg \left(y \leq 3.7 \cdot 10^{+32}\right):\\ \;\;\;\;x \cdot \frac{100}{y}\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \]

Alternative 5: 50.0% accurate, 7.0× speedup?

\[\begin{array}{l} \\ 100 \end{array} \]
(FPCore (x y) :precision binary64 100.0)
double code(double x, double y) {
	return 100.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 100.0d0
end function
public static double code(double x, double y) {
	return 100.0;
}
def code(x, y):
	return 100.0
function code(x, y)
	return 100.0
end
function tmp = code(x, y)
	tmp = 100.0;
end
code[x_, y_] := 100.0
\begin{array}{l}

\\
100
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{x \cdot 100}{x + y} \]
  2. Step-by-step derivation
    1. *-commutative99.8%

      \[\leadsto \frac{\color{blue}{100 \cdot x}}{x + y} \]
    2. +-commutative99.8%

      \[\leadsto \frac{100 \cdot x}{\color{blue}{y + x}} \]
    3. associate-/l*98.9%

      \[\leadsto \color{blue}{\frac{100}{\frac{y + x}{x}}} \]
    4. remove-double-neg98.9%

      \[\leadsto \frac{100}{\frac{y + \color{blue}{\left(-\left(-x\right)\right)}}{x}} \]
    5. unsub-neg98.9%

      \[\leadsto \frac{100}{\frac{\color{blue}{y - \left(-x\right)}}{x}} \]
    6. div-sub98.9%

      \[\leadsto \frac{100}{\color{blue}{\frac{y}{x} - \frac{-x}{x}}} \]
    7. distribute-frac-neg98.9%

      \[\leadsto \frac{100}{\frac{y}{x} - \color{blue}{\left(-\frac{x}{x}\right)}} \]
    8. *-inverses98.9%

      \[\leadsto \frac{100}{\frac{y}{x} - \left(-\color{blue}{1}\right)} \]
    9. metadata-eval98.9%

      \[\leadsto \frac{100}{\frac{y}{x} - \color{blue}{-1}} \]
  3. Simplified98.9%

    \[\leadsto \color{blue}{\frac{100}{\frac{y}{x} - -1}} \]
  4. Taylor expanded in y around 0 56.0%

    \[\leadsto \color{blue}{100} \]
  5. Final simplification56.0%

    \[\leadsto 100 \]

Developer target: 99.8% accurate, 0.8× speedup?

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

\\
\frac{x}{1} \cdot \frac{100}{x + y}
\end{array}

Reproduce

?
herbie shell --seed 2023318 
(FPCore (x y)
  :name "Development.Shake.Progress:message from shake-0.15.5"
  :precision binary64

  :herbie-target
  (* (/ x 1.0) (/ 100.0 (+ x y)))

  (/ (* x 100.0) (+ x y)))