HH\Lib\Math\almost_equals

Meta Engineer?

This is available as Math\almost_equals in the www repository.

Compares two numbers to see if they are within epsilon of each other

namespace HH\Lib\Math;

function almost_equals(
  num $num_one,
  num $num_two,
  num $epsilon = 1.0E-8,
): bool;

If the difference equals epsilon this returns false.

default epsilon of .00000001.

When comparing large numbers consider passing in a large epsilon

Parameters

  • num $num_one
  • num $num_two
  • num $epsilon = 1.0E-8

Returns

  • bool