-
Notifications
You must be signed in to change notification settings - Fork 5
/
mod.c
35 lines (31 loc) · 862 Bytes
/
mod.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* $Id: mod.c,v 1.4 2008/07/15 07:40:54 bnv Exp $
* $Log: mod.c,v $
* Revision 1.4 2008/07/15 07:40:54 bnv
* #include changed from <> to ""
*
* Revision 1.3 2002/06/11 12:37:15 bnv
* Added: CDECL
*
* Revision 1.2 2001/06/25 18:49:48 bnv
* Header changed to Id
*
* Revision 1.1 1998/07/02 17:18:00 bnv
* Initial Version
*
*/
#include "lerror.h"
#include "lstring.h"
#include <cmssys.h>
/* ------------------ Lmod ----------------- */
void __CDECL
Lmod(const PLstr to, const PLstr A, const PLstr B) {
L2REAL(A);
L2REAL(B);
Context *context = (Context *) CMSGetPG();
if (LREAL(*B) == 0) (context->lstring_Lerror)(ERR_ARITH_OVERFLOW, 0);
LREAL(*to) = (double) (LREAL(*A) -
(long) (LREAL(*A) / LREAL(*B)) * LREAL(*B));
LTYPE(*to) = LREAL_TY;
LLEN(*to) = sizeof(double);
} /* Lmod */