approximately

.approximately is a word indicating an approximate value comparison. When using .approximately, only the words .be and .equal may be used, though they may appear before or after. Each must be called with an additional parameter, error = <float>, indicating the amount of permissible error.

  1. auto approximately(Should should, double expected, ErrorValue error, Fence _, string file, size_t line)
    approximately
    (
    Should
    )
    (
    Should should
    ,
    double expected
    ,
    ErrorValue error
    ,
    Fence _ = Fence()
    ,
    string file = __FILE__
    ,
    size_t line = __LINE__
    )
    if (
    isInstanceOf!(ShouldType, Should)
    )
  2. auto approximately(Should should)

Examples

5.should.be.approximately(5.1, error = 0.11);
5.should.approximately.be(5.1, error = 0.11);
0.should.approximately.equal(1.0, error = 1.1);
0.should.approximately.equal(-1.0, error = 1.1);
0.should.not.approximately.equal(1, error = 0.1);
42.3.should.be.approximately(42.3, error = 1e-3);

Meta