[SPARK-2479][MLlib] Comparing floating-point numbers using relative error in UnitTests

Floating point math is not exact, and most floating-point numbers end up being slightly imprecise due to rounding errors. 

Simple values like 0.1 cannot be precisely represented using binary floating point numbers, and the limited precision of floating point numbers means that slight changes in the order of operations or the precision of intermediates can change the result. 

That means that comparing two floats to see if they are equal is usually not what we want. As long as this imprecision stays small, it can usually be ignored.

Based on discussion in the community, we have implemented two different APIs for relative error, and absolute error. It makes sense that test writers should know which one they need depending on their circumstances. 

Developers also need to explicitly specify the eps, and there is no default value which will sometimes cause confusion. 

When comparing against zero using relative error, a exception will be raised to warn users that it's meaningless.

For relative error in percentage, users can now write 

    assert(23.1 ~== 23.52 %+- 2.0)
    assert(23.1 ~== 22.74 %+- 2.0)
    assert(23.1 ~= 23.52 %+- 2.0)
    assert(23.1 ~= 22.74 %+- 2.0)
    assert(!(23.1 !~= 23.52 %+- 2.0))
    assert(!(23.1 !~= 22.74 %+- 2.0))

    // This will throw exception with the following message.
    // "Did not expect 23.1 and 23.52 to be within 2.0% using relative error."
    assert(23.1 !~== 23.52 %+- 2.0)

    // "Expected 23.1 and 22.34 to be within 2.0% using relative error."
    assert(23.1 ~== 22.34 %+- 2.0)
      
For absolute error, 

    assert(17.8 ~== 17.99 +- 0.2)
    assert(17.8 ~== 17.61 +- 0.2)
    assert(17.8 ~= 17.99 +- 0.2)
    assert(17.8 ~= 17.61 +- 0.2)
    assert(!(17.8 !~= 17.99 +- 0.2))
    assert(!(17.8 !~= 17.61 +- 0.2))

    // This will throw exception with the following message.
    // "Did not expect 17.8 and 17.99 to be within 0.2 using absolute error."
    assert(17.8 !~== 17.99 +- 0.2)
     
    // "Expected 17.8 and 17.59 to be within 0.2 using absolute error."
    assert(17.8 ~== 17.59 +- 0.2)

Authors: 
  DB Tsai <dbtsai@alpinenow.com>
  Marek Kolodziej <marek@alpinenow.com>

move this line up?