my $d_1 = 0.1e0; # double 0.1 ( == 3602879701896397/36028797018963968 )
my $r_1 = 0.1; # rational 1/10
my $d_2 = 0.10000000000000001e0;# double, same value as $d_1
my $r_2 = 0.10000000000000001; # rational 10000000000000001/100000000000000000
# check that $d_1 == 3602879701896397/36028797018963968
say "not ok 0" if $d_1 != 3602879701896397/36028797018963968;
# Check that $d_1 != 1 / 10;
say "not ok 1" if $d_1 == 1 / 10;
# Check that $d_1 and $d_2 are assigned to exactly the same value:
say "not ok 2" if $d_1 != $d_2;
# Check that $r_ and $r_2 are assigned different values:
say "not ok 3" if $r_1 == $r_2;
# Since $r_1 and $r_2 are unequal, $d_1 should not be equal to both $r_1 && $r_2.
# We check this, interchanging lhs and rhs operands in case that makes a
# difference:
say "not ok 4" if ($d_1 == $r_1 && $d_1 == $r_2);
say "not ok 5" if ($r_1 == $d_1 && $r_2 == $d_1);
# Similarly $d_2 should not be equal to both $r_1 and $r_2:
say "not ok 6" if ($d_2 == $r_1 && $d_2 == $r_2);
say "not ok 7" if ($r_1 == $d_2 && $r_2 == $d_2);
say Rat($d_1);
say Rat($d_2);