In Operators§

See primary documentation in context for infix =~=

multi sub infix:<=~=>(AnyAny)
multi sub infix:<=~=>(Int:DInt:D)
multi sub infix:<=~=>(Num:DNum:D)
multi sub infix:<=~=>(Rational:DRational:D)
multi sub infix:<=~=>(Real:DReal:D)
multi sub infix:<=~=>(Complex:DComplex:D)
multi sub infix:<=~=>(Numeric:DNumeric:D)

The approximately-equal operator , whose ASCII variant is =~=, calculates the relative difference between the left-hand and right-hand sides and returns True if the difference is less than $*TOLERANCE (which defaults to 1e-15). However, if either side is zero then it checks that the absolute difference between the sides is less than $*TOLERANCE. Note that this operator is not arithmetically symmetrical (doesn't do ± Δ):

my $x = 1;
say ($x + $*TOLERANCE=~= $x;   # OUTPUT: «False␤» 
say ($x - $*TOLERANCE=~= $x;   # OUTPUT: «True␤»

You can change $*TOLERANCE lexically:

    my $*TOLERANCE = .1;
    say 11 =~= 10;        # OUTPUT: «True␤» 

Note that setting $*TOLERANCE = 0 will cause all comparisons to fail.

    my $*TOLERANCE = 0;
    say 1 =~= 1;          # OUTPUT: «False␤»