Prev Next a_double_compare_xam.pm Headings

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Perl: a_double Comparison Operators: Example and Test
package a_double_compare_xam;
sub a_double_compare_xam() {
     # check for standard perl programming conventions
     use strict;
     use warnings;
     #
     # load the Cppad Swig library
     use pm_cppad;
     #
     # initilaize return variable
     my $ok = 1;
     # ---------------------------------------------------------------------
     my $two = new pm_cppad::a_double(2.0);
     my $three = new pm_cppad::a_double(3.0);
     #
     $ok = $ok && $two   <  $three;
     $ok = $ok && $two   <= $three;
     $ok = $ok && $three >  $two;
     $ok = $ok && $three >= $two;
     $ok = $ok && $three != $two;
     $ok = $ok && $three == $three;
     #
     $ok = $ok && ! ($two >  $three) ;
     $ok = $ok && ! ($two >= $three) ;
     $ok = $ok && ! ($two == $three) ;
     #
     return( $ok );
}

Input File: build/lib/example/perl/a_double_compare_xam.pm