in reply to perl numeric expressions
outputs:#!/usr/bin/perl use strict; use warnings; use Test::More qw(no_plan); my $x1 = 44.7; my $x2 = 44.9-0.2; is($x1,$x2, "44.7 is 44.9-0.2"); #succeeds. because is uses the eq ope +rator... cmp_ok($x1,'==',$x2, "44.7 == 44.9-0.2"); # fails. but the diagnostic +isn't real helpful.
E:\data\learning>perl scratch.pl ok 1 - 44.7 is 44.9-0.2 not ok 2 - 44.7 == 44.9-0.2 # Failed test (scratch.pl at line 10) # got: 44.7 # expected: 44.7 1..2 # Looks like you failed 1 tests of 2.
|
|---|