#ident "@(#)testbcdmul.c	1.2 5/3/96 16:24:27"
/*
/* Copyright John Moyer 1996
/* permission is granted to use this for any purpose provided proper
/* credit is given to the author
*/

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <math.h>

#include "bignum.h"

int main (int argc, char *argv[])
{
int i, j, err;
BigNum x1, y1, z1;
char str[ISIZE+8];

z1.isign = 1;
if ( argc == 3 )
  {
  err = ascii2bcd(argv[1],&x1);
  err += ascii2bcd(argv[2],&y1);
  }
else
  err = 999;
if ( err )
  {
  fprintf(stderr,"%s: Could not get 2 numbers from command line\n",argv[0]);
  return 1;
  }


j = x1.c + y1.c ;
if ( j > ISIZE -1 )
  {
  fprintf( stderr,"%s: Numbers to large, x+y=%d, max=%d\n",argv[0],j,ISIZE-1);
  return 1;
  }

mulbignum(&x1, &y1, &z1);

bcd2ascii(str, sizeof(str), &x1);
fprintf(stdout,"%s",str);

fprintf(stdout," * ");

bcd2ascii(str, sizeof(str), &y1);
fprintf(stdout,"%s",str);

fprintf(stdout," = ");

bcd2ascii(str, sizeof(str), &z1);
fprintf(stdout,"%s",str);

fputc('\n',stdout);

return (0);
}


