home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
sa104os2.zip
/
SATHR104.ZIP
/
SATHER
/
SYSTEM
/
FLTD.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-12-22
|
1KB
|
57 lines
#include "header.h"
#include <string.h>
FLTD c_fltd_aset(FLTD f, INT bit, BOOL val)
{
sbi_aset(&f, bit, val, 64);
return f;
}
BOOL c_fltd_aget(FLTD f, INT bit)
{
return sbi_aget(&f, bit, 64);
}
INT c_fltd_int(FLTD d) {
return (INT) d;
}
int c_fltd_str_in(FLTD f, char* store_in) {
/* Store the floating point value f in the string store_in */
/* store_in must have the maximum storage that may be needed?
Return the actual length of store_in */
sprintf(store_in,"%g",f);
return(strlen(store_in));
}
int c_fltd_str_in_prec(FLTD f, char* store_in, INT precision) {
/* Store the floating point value f in the string store_in with
precision = "precision". Return the used length of store_in*/
/* store_in must have the maximum storage that may be needed? */
char buf[20];
sprintf(buf,"%%.%dg",precision);
sprintf(store_in,buf,f);
return(strlen(store_in));
}
#if defined(_AIX) || defined(SUNOS5) || defined(__NeXT__)
FLTD exp10(FLTD f) {
return pow(10.0, f);
}
#endif
#if defined(__hpux) || defined(SCO)
/* This is just a quick hack - real rint does something better
for rounding - somebody send me a correct version. */
double rint(double x)
{
double tmp = floor(x);
if (fabs(x - tmp) < 0.5)
return tmp;
else
return tmp + 1;
}
#endif