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

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[x \cdot \sin y + z \cdot \cos y \]
  2. Final simplification0.1

    \[\leadsto z \cdot \cos y + x \cdot \sin y \]

Alternatives

Alternative 1
Error18.5
Cost8296
\[\begin{array}{l} t_0 := z \cdot \cos y\\ t_1 := z + x \cdot y\\ t_2 := x \cdot \sin y\\ t_3 := z + x \cdot \left(\left(\sin y + 1\right) + -1\right)\\ \mathbf{if}\;z \leq -9.3 \cdot 10^{+120}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2 \cdot 10^{+28}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-28}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-113}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-157}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{-218}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-232}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-257}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-241}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-173}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-154}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error15.7
Cost7508
\[\begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;y \leq -2.25 \cdot 10^{+235}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.66 \cdot 10^{+15}:\\ \;\;\;\;x \cdot \sin y\\ \mathbf{elif}\;y \leq -0.000245:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{\frac{1}{x \cdot y} + 0.16666666666666666 \cdot \frac{y}{x}}\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;z + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{\sin y}}{x}}\\ \end{array} \]
Alternative 3
Error15.7
Cost7252
\[\begin{array}{l} t_0 := z \cdot \cos y\\ t_1 := x \cdot \sin y\\ \mathbf{if}\;y \leq -1.3 \cdot 10^{+235}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -8.5 \cdot 10^{+26}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -0.0011:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{\frac{1}{x \cdot y} + 0.16666666666666666 \cdot \frac{y}{x}}\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-6}:\\ \;\;\;\;z + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error15.9
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.0013 \lor \neg \left(y \leq 0.00074\right):\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;z + x \cdot y\\ \end{array} \]
Alternative 5
Error37.7
Cost588
\[\begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{+172}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+131}:\\ \;\;\;\;z\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{+230}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 6
Error30.1
Cost320
\[z + x \cdot y \]
Alternative 7
Error39.1
Cost64
\[z \]

Error

Reproduce

herbie shell --seed 2022340 
(FPCore (x y z)
  :name "Diagrams.ThreeD.Transform:aboutX from diagrams-lib-1.3.0.3, B"
  :precision binary64
  (+ (* x (sin y)) (* z (cos y))))