ba237a9d91
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
66 lines
1.3 KiB
C
Executable File
66 lines
1.3 KiB
C
Executable File
/* DEC **MultiplyDecimalArrays(pDst,pSrc1,pSrc2,n)
|
|
*
|
|
* ARGUMENT
|
|
* pDst is a ptr to the array of destination DEC pointers.
|
|
* pSrc1 and pSrc2 are ptrs to the arrays of source DEC pointers
|
|
* n is the number of elements in pSrc
|
|
*
|
|
* DESCRIPTION
|
|
* Sets pDst[i] = pSrc1[i] * pSrc2[i]. If pDst is null, tries to create a
|
|
* DEC structure, then multiply. If some of the pSrc structures
|
|
* are null, the non-null ones are still multiplied.
|
|
*
|
|
* SIDE EFFECTS
|
|
* None.
|
|
*
|
|
* RETURNS
|
|
* Returns pointer to the new structure if successful, otherwise
|
|
* returns GM_NULLARR.
|
|
*
|
|
* POSSIBLE ERROR CODES
|
|
*
|
|
* GM_NULLPOINTER
|
|
* GM_OVERFLOW
|
|
* GM_UNDERFLOW
|
|
* GM_ARGVAL
|
|
*
|
|
* AUTHOR
|
|
* Jared Levy
|
|
* Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved.
|
|
*
|
|
* MODIFICATIONS
|
|
*
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include "gm.h"
|
|
#include "gmsystem.h"
|
|
|
|
DEC **MultiplyDecimalArrays(pDst,pSrc1,pSrc2,n)
|
|
DEC **pDst;
|
|
DEC **pSrc1, **pSrc2;
|
|
int n;
|
|
{
|
|
int i;
|
|
|
|
/* source must be supplied !! */
|
|
_MacStart(GM_MULARR);
|
|
|
|
if (!pSrc1 || !pSrc2 || !pDst) {
|
|
_MacErr(GM_NULLPOINTER);
|
|
_MacRet(GM_NULLARR);
|
|
}
|
|
|
|
if (n<0) {
|
|
_MacErr(GM_ARGVAL);
|
|
_MacRet(GM_NULLARR);
|
|
}
|
|
|
|
/* Multiply the numbers */
|
|
for (i=0; i<n; i++)
|
|
(void) MultiplyDecimal(pDst[i], pSrc1[i], pSrc2[i]);
|
|
/* MultiplyDecimal sets the error flag each time an error occurs */
|
|
|
|
_MacRet(pDst);
|
|
}
|