Octave: a_double Binary Operators With AD Result: Example and Test
function ok = a_double_ad_binary_xam()
%% load the Cppad Swig library
m_cppad
%% initialize return variable
ok = true;
% -----------------------------------------------------------------------
two = m_cppad.a_double(2.0);
three = m_cppad.a_double(3.0);
%
five = two + three;
six = two * three;
neg_one = two - three;
two_thirds = two / three;
%
ok = ok && five.value() == 5.0;
ok = ok && six.value() == 6.0;
ok = ok && neg_one.value() == -1.0;
ok = ok && 0.5 < two_thirds.value();
ok = ok && two_thirds.value() < 1.0;
ok = ok && five < six;
%return;
end