?

Average Accuracy: 99.5% → 99.6%
Time: 5.1s
Precision: binary64
Cost: 448

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original99.5%
Target99.6%
Herbie99.6%
\[\left(x \cdot \left(3 \cdot y\right)\right) \cdot y \]

Derivation?

  1. Initial program 99.5%

    \[\left(\left(x \cdot 3\right) \cdot y\right) \cdot y \]
  2. Applied egg-rr69.5%

    \[\leadsto \color{blue}{\left(\left(1 + x \cdot \left(3 \cdot y\right)\right) - 1\right)} \cdot y \]
    Proof

    [Start]99.5

    \[ \left(\left(x \cdot 3\right) \cdot y\right) \cdot y \]

    expm1-log1p-u [=>]82.1

    \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot 3\right) \cdot y\right)\right)} \cdot y \]

    expm1-udef [=>]52.0

    \[ \color{blue}{\left(e^{\mathsf{log1p}\left(\left(x \cdot 3\right) \cdot y\right)} - 1\right)} \cdot y \]

    log1p-udef [=>]52.0

    \[ \left(e^{\color{blue}{\log \left(1 + \left(x \cdot 3\right) \cdot y\right)}} - 1\right) \cdot y \]

    add-exp-log [<=]69.4

    \[ \left(\color{blue}{\left(1 + \left(x \cdot 3\right) \cdot y\right)} - 1\right) \cdot y \]

    associate-*l* [=>]69.5

    \[ \left(\left(1 + \color{blue}{x \cdot \left(3 \cdot y\right)}\right) - 1\right) \cdot y \]
  3. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\left(\left(3 \cdot y\right) \cdot x\right)} \cdot y \]
    Proof

    [Start]69.5

    \[ \left(\left(1 + x \cdot \left(3 \cdot y\right)\right) - 1\right) \cdot y \]

    add-exp-log [=>]52.0

    \[ \left(\color{blue}{e^{\log \left(1 + x \cdot \left(3 \cdot y\right)\right)}} - 1\right) \cdot y \]

    expm1-def [=>]52.0

    \[ \color{blue}{\mathsf{expm1}\left(\log \left(1 + x \cdot \left(3 \cdot y\right)\right)\right)} \cdot y \]

    log1p-def [=>]82.2

    \[ \mathsf{expm1}\left(\color{blue}{\mathsf{log1p}\left(x \cdot \left(3 \cdot y\right)\right)}\right) \cdot y \]

    expm1-log1p-u [<=]99.6

    \[ \color{blue}{\left(x \cdot \left(3 \cdot y\right)\right)} \cdot y \]

    *-commutative [=>]99.6

    \[ \color{blue}{\left(\left(3 \cdot y\right) \cdot x\right)} \cdot y \]
  4. Final simplification99.6%

    \[\leadsto y \cdot \left(\left(3 \cdot y\right) \cdot x\right) \]

Alternatives

Alternative 1
Accuracy99.6%
Cost448
\[3 \cdot \left(y \cdot \left(y \cdot x\right)\right) \]
Alternative 2
Accuracy99.6%
Cost448
\[y \cdot \left(3 \cdot \left(y \cdot x\right)\right) \]

Error

Reproduce?

herbie shell --seed 2023133 
(FPCore (x y)
  :name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, B"
  :precision binary64

  :herbie-target
  (* (* x (* 3.0 y)) y)

  (* (* (* x 3.0) y) y))