function jacobi_cnk_test ( )

%*****************************************************************************80
%
%% jacobi_cnk_test() tests jacobi_cnk().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 November 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'jacobi_cnk_test():\n' );
  fprintf ( 1, '  jacobi_cnk(u,k) returns values of\n' );
  fprintf ( 1, '  the Jacobi elliptic CN function.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '        U           K              ' );
  fprintf ( 1, '     CN(U,K)                 CN(U,K)             |Diff|\n' );
  fprintf ( 1, '                                   ' );
  fprintf ( 1, '    Computed                 Tabulated\n' );
  fprintf ( 1, '\n' );

  n_data = 0;

  while ( true )

    [ n_data, u, a, k, m, fx2 ] = jacobi_cn_values ( n_data );

    if ( n_data == 0 )
      break
    end

    fx1 = jacobi_cnk ( u, k );

    fprintf ( 1, '  %12f  %12f  %24.16f  %24.16f  %8.2g\n', u, k, fx1, fx2, abs ( fx1 - fx2 ) );

  end

  return
end
