Prev Next a_double_unary_op_xam.pm Headings

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Perl: a_double Unary Plus and Minus: Example and Test
# This test fails in Octave and so is skipped by make check_lib_octave
package a_double_unary_op_xam;
sub a_double_unary_op_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 $plus_two = + $two ;
     my $minus_two = - $two ;
     #
     $ok = $ok && $plus_two->value() == 2.0;
     $ok = $ok && $minus_two->value() == -2.0;
     #
     return( $ok );
}

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