Average Error: 0.0 → 0.0
Time: 10.7s
Precision: binary64
Cost: 13248
\[\left(x + \sin y\right) + z \cdot \cos y \]
\[\left(x + z \cdot \cos y\right) + \sin y \]
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
(FPCore (x y z) :precision binary64 (+ (+ x (* z (cos y))) (sin y)))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
double code(double x, double y, double z) {
	return (x + (z * cos(y))) + sin(y);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + sin(y)) + (z * cos(y))
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + (z * cos(y))) + sin(y)
end function
public static double code(double x, double y, double z) {
	return (x + Math.sin(y)) + (z * Math.cos(y));
}
public static double code(double x, double y, double z) {
	return (x + (z * Math.cos(y))) + Math.sin(y);
}
def code(x, y, z):
	return (x + math.sin(y)) + (z * math.cos(y))
def code(x, y, z):
	return (x + (z * math.cos(y))) + math.sin(y)
function code(x, y, z)
	return Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
end
function code(x, y, z)
	return Float64(Float64(x + Float64(z * cos(y))) + sin(y))
end
function tmp = code(x, y, z)
	tmp = (x + sin(y)) + (z * cos(y));
end
function tmp = code(x, y, z)
	tmp = (x + (z * cos(y))) + sin(y);
end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision]
\left(x + \sin y\right) + z \cdot \cos y
\left(x + z \cdot \cos y\right) + \sin y

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\left(x + \sin y\right) + z \cdot \cos y \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, \cos y, x + \sin y\right)} \]
    Proof
    (fma.f64 z (cos.f64 y) (+.f64 x (sin.f64 y))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= fma-def_binary64 (+.f64 (*.f64 z (cos.f64 y)) (+.f64 x (sin.f64 y)))): 3 points increase in error, 0 points decrease in error
    (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y)))): 0 points increase in error, 3 points decrease in error
  3. Applied egg-rr0.0

    \[\leadsto \color{blue}{\left(x + z \cdot \cos y\right) + \sin y} \]
  4. Final simplification0.0

    \[\leadsto \left(x + z \cdot \cos y\right) + \sin y \]

Alternatives

Alternative 1
Error11.7
Cost13649
\[\begin{array}{l} t_0 := x + \sin y\\ t_1 := z \cdot \cos y\\ \mathbf{if}\;y \leq -1.9 \cdot 10^{+127}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+38}:\\ \;\;\;\;\left(x + y\right) + t_1\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+142} \lor \neg \left(y \leq 1.75 \cdot 10^{+224}\right):\\ \;\;\;\;\sin y + t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.0
Cost13248
\[\left(x + \sin y\right) + z \cdot \cos y \]
Alternative 3
Error19.1
Cost7648
\[\begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;x \leq -62000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{-154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.08 \cdot 10^{-193}:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;x \leq 4.7 \cdot 10^{-306}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-215}:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-169}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.02 \cdot 10^{-61}:\\ \;\;\;\;y + \left(x + z\right)\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-11}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
Alternative 4
Error10.1
Cost6988
\[\begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -5.1 \cdot 10^{+91}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{-10}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{+42}:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error10.4
Cost6980
\[\begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -6.4 \cdot 10^{-10}:\\ \;\;\;\;\left(x + y\right) + t_0\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{+42}:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error19.7
Cost6860
\[\begin{array}{l} \mathbf{if}\;y \leq -1.85 \cdot 10^{+82}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+38}:\\ \;\;\;\;y + \left(x + z\right)\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{+89}:\\ \;\;\;\;\sin y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
Alternative 7
Error29.6
Cost592
\[\begin{array}{l} \mathbf{if}\;x \leq -190000:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-172}:\\ \;\;\;\;z\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{-62}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-15}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error19.3
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -1.85 \cdot 10^{+82}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 14800000:\\ \;\;\;\;y + \left(x + z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
Alternative 9
Error20.6
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -2.75 \cdot 10^{-170}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-132}:\\ \;\;\;\;z + y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
Alternative 10
Error31.2
Cost328
\[\begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{+141}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{+42}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 11
Error21.8
Cost192
\[x + z \]
Alternative 12
Error37.1
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022343 
(FPCore (x y z)
  :name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
  :precision binary64
  (+ (+ x (sin y)) (* z (cos y))))