You shouldn’t expect bit-for-bit identical results. Even ab + cd is alliedallowed by C, C++ and others to yield at least two different results.
You use different methods in different cases. For example, if you use floats instead of double, have a unit test that compares bithboth methods and checks whether results are acceptable.