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
44 lines
724 B
C
Executable File
44 lines
724 B
C
Executable File
#include <stdio.h>
|
|
#include "gm.h"
|
|
void printres(char *,DEC *);
|
|
void main(void);
|
|
|
|
void main()
|
|
{
|
|
DEC *x, *y, *p;
|
|
|
|
x = AllocateDecimal();
|
|
y = AllocateDecimal();
|
|
|
|
p = ConvAsciiToDecimal(x, "19.88");
|
|
printres("x = ", p);
|
|
p = AbsoluteDecimal(y, x);
|
|
printres("abs(x) = ", p);
|
|
p = ChangeSignDecimal(y, x);
|
|
printres("-x = ", p);
|
|
p = FractionDecimal(y, x);
|
|
printres("fract(x) = ", p);
|
|
p = IntegerPartDecimal(y, x);
|
|
printres("int(x) = ", p);
|
|
p = SquareRootDecimal(y, x);
|
|
printres("sqrt(x) = ", p);
|
|
|
|
FreeDecimal(x);
|
|
FreeDecimal(y);
|
|
}
|
|
|
|
void printres(str, pd)
|
|
char *str;
|
|
DEC *pd;
|
|
{
|
|
char sd[22];
|
|
|
|
printf("%12s", str);
|
|
if (pd) {
|
|
ConvDecimalToAscii(sd, pd);
|
|
printf("%s\n", sd);
|
|
}
|
|
else
|
|
printf("undefined\n");
|
|
}
|