campo-sirio/gfm/dmbyp10tc.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

54 lines
942 B
C
Executable File

/* int _DivUnsArrByPwrOf10(a,n,p)
*
* ARGUMENT
* unsigned a[];
* int p; power of 10 to divide by
* int n; number of digits
*
* DESCRIPTION
* Divides a number of n words (a) by a power of 10, c= a/10^p,
* a>=0, p>0, truncating the result, c is correct only if a/10^p<2^79.
*
* SIDE EFFECTS
* The value of a is destroyed.
*
* RETURNS
* None. (always succeeds)
*
* AUTHOR
* Brugnoli Giugno 1992
*
* MODIFICATIONS
*
*/
#include <stdio.h>
#include <math.h>
#include "gm.h"
#include "gmsystem.h"
extern double pow(double, double);
void _DivUnsArrByPwrOf10Trunc(a,n,p)
unsigned SHORT a[];
int n,p;
{
int ppdf,i;
while (p>4)
{
_DivUnsArrByUns(a,10000,n);
p-=4;
}
#ifdef SH_LIB
ppdf=1;
for (i=1;i<=p;i++) ppdf*=10;
#else
ppdf=(int)pow(10.,(double)p);
#endif
_DivUnsArrByUns(a,ppdf,n);
}