campo-sirio/gfm/demo12.c
alex ba237a9d91 Patch level : no patch
Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Aggiunti i sorgenti per Greenleaf Math Library (gfm.dll)


git-svn-id: svn://10.65.10.50/trunk@10079 c028cbd2-c16b-5b4b-a496-9718f37d4682
2002-02-26 12:19:02 +00:00

45 lines
697 B
C
Executable File

#include <stdio.h>
#include "gm.h"
void SmartScan(char *,DEC *);
void main(void);
void main()
{
DECP x;
SmartScan("Type a number: ", x);
PrintDecimal("You typed a %t\n", x);
}
void SmartScan(s, pd)
char *s;
DEC *pd;
{
bool done;
int i;
if (!pd) {
printf("Error: null DEC pointer\n");
return;
}
ClearMathError();
done=FALSE;
while (!done) {
printf("%s",s);
ScanDecimal("%t",pd);
i = ReturnMathErrAndClear();
if (i==GM_SUCCESS)
done=TRUE;
if (i==GM_CNVRW) {
done=TRUE;
printf("Warning: Digit loss due to rounding\n");
}
if (i==GM_CNVRE)
printf("Error: Number out of range\n");
if (i==GM_NAN)
printf("Error: Not a number\n");
}
return;
}