Prev Next a_double_property_xam.pm Headings

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Perl: a_double Properties: Example and Test
package a_double_property_xam;
sub a_double_property_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 $three = new pm_cppad::a_double(3.0);
     #
     $ok = $ok && $three->value()   == 3.0;
     $ok = $ok && $three->parameter();
     $ok = $ok && ! $three->variable();
     #
     # near_equal
     my $r3 = $three->sqrt() ;
     $ok = $ok && $three->near_equal( $r3 * $r3) ;;
     #
     return( $ok );
}

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