|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 694 (0x2b6)
Types: TextFile
Notes: UNIX file
Names: »modf.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦f4b8d8c84⟧ UNIX Filesystem
└─⟦this⟧ »libc/crt/modf.c«
/* modf( real, ip)
double real, *ip
returns real - g and stores g at ip
where g = greatest integer <= real
uses machine dependent subroutine modfs( real, ip, e)
which does modf assuming that d >= 0 1 <= e = exponent of real <= MBITS+1
*/
#include "fpformat.h"
extern double modfs(), frexp();
double
modf( d, dp)
double d;
register double *dp;
{
int e;
frexp( d, &e);
if( e >= MBITS+1) {
*dp = d;
return( 0.0);
}
if( e <= 0) {
if( d < 0) {
*dp = -1;
return( 1 - d);
}
*dp = 0;
return( d);
}
if( d >= 0)
return( modfs( d, dp, e));
d = modfs( -d, dp, e);
if( d != 0) {
*dp = -*dp - 1;
return( 1 - d);
} else {
*dp = -*dp;
return( d);
}
}