Average Error: 0.0 → 0.0
Time: 7.2s
Precision: binary64
Cost: 13248
\[\left(x + \sin y\right) + z \cdot \cos y \]
\[\left(\sin y + z \cdot \cos y\right) + x \]
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
(FPCore (x y z) :precision binary64 (+ (+ (sin y) (* z (cos y))) x))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
double code(double x, double y, double z) {
	return (sin(y) + (z * cos(y))) + x;
}
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 = (sin(y) + (z * cos(y))) + x
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 (Math.sin(y) + (z * Math.cos(y))) + x;
}
def code(x, y, z):
	return (x + math.sin(y)) + (z * math.cos(y))
def code(x, y, z):
	return (math.sin(y) + (z * math.cos(y))) + x
function code(x, y, z)
	return Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
end
function code(x, y, z)
	return Float64(Float64(sin(y) + Float64(z * cos(y))) + x)
end
function tmp = code(x, y, z)
	tmp = (x + sin(y)) + (z * cos(y));
end
function tmp = code(x, y, z)
	tmp = (sin(y) + (z * cos(y))) + x;
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[(N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\left(x + \sin y\right) + z \cdot \cos y
\left(\sin y + z \cdot \cos y\right) + x

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)))): 1 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, 0 points decrease in error
  3. Applied egg-rr0.0

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

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

Alternatives

Alternative 1
Error0.5
Cost13256
\[\begin{array}{l} \mathbf{if}\;z \leq -5700000000000:\\ \;\;\;\;x + z \cdot \cos y\\ \mathbf{elif}\;z \leq 0.9:\\ \;\;\;\;x + \left(z + \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, x\right)\\ \end{array} \]
Alternative 2
Error0.0
Cost13248
\[\left(\sin y + x\right) + z \cdot \cos y \]
Alternative 3
Error18.3
Cost7384
\[\begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;x \leq -2.7 \cdot 10^{-17}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;x \leq -1.35 \cdot 10^{-174}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.16 \cdot 10^{-233}:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-124}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-50}:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{-20}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;z + x\\ \end{array} \]
Alternative 4
Error14.5
Cost7120
\[\begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;x \leq -2.1 \cdot 10^{-15}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{-170}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{-49}:\\ \;\;\;\;z + \sin y\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-19}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;z + x\\ \end{array} \]
Alternative 5
Error9.8
Cost7120
\[\begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -6.5 \cdot 10^{+89}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-71}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-24}:\\ \;\;\;\;\sin y + x\\ \mathbf{elif}\;z \leq 1.08 \cdot 10^{+202}:\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error3.1
Cost6984
\[\begin{array}{l} t_0 := x + z \cdot \cos y\\ \mathbf{if}\;z \leq -1.9 \cdot 10^{-71}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-23}:\\ \;\;\;\;\sin y + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error0.5
Cost6984
\[\begin{array}{l} t_0 := x + z \cdot \cos y\\ \mathbf{if}\;z \leq -5700000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.45:\\ \;\;\;\;z + \left(\sin y + x\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error0.5
Cost6984
\[\begin{array}{l} t_0 := x + z \cdot \cos y\\ \mathbf{if}\;z \leq -5700000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.75:\\ \;\;\;\;x + \left(z + \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error18.9
Cost6728
\[\begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{+21}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;y \leq -7000:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+25}:\\ \;\;\;\;z + \left(y + x\right)\\ \mathbf{else}:\\ \;\;\;\;z + x\\ \end{array} \]
Alternative 10
Error18.8
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -5200000:\\ \;\;\;\;z + x\\ \mathbf{elif}\;y \leq 1.76 \cdot 10^{+25}:\\ \;\;\;\;z + \left(y + x\right)\\ \mathbf{else}:\\ \;\;\;\;z + x\\ \end{array} \]
Alternative 11
Error28.1
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-32}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1400000000000:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 12
Error21.4
Cost192
\[z + x \]
Alternative 13
Error36.1
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022329 
(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))))