[Mybusinessbasic-devel] mybb utilities.c,1.5,1.6
Status: Alpha
Brought to you by:
mikecurry1974
|
From: <mti...@us...> - 2003-12-31 17:35:49
|
Update of /cvsroot/mybusinessbasic/mybb
In directory sc8-pr-cvs1:/tmp/cvs-serv30383
Modified Files:
utilities.c
Log Message:
added ITR() function and also reworked RTI()
Index: utilities.c
===================================================================
RCS file: /cvsroot/mybusinessbasic/mybb/utilities.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** utilities.c 30 Dec 2003 03:52:28 -0000 1.5
--- utilities.c 31 Dec 2003 17:35:45 -0000 1.6
***************
*** 514,517 ****
--- 514,532 ----
}
+
+ //-----
+ // Convert a long into an mybbfloat
+ //-----
+ mybbfloat long2flt(long num)
+ {
+ mybbfloat flt;
+
+ flt.mantisa.i = num;
+ flt.exp = 0;
+
+ return flt;
+ }
+
+
mybbfloat asc2flt(char *str)
{
***************
*** 610,613 ****
--- 625,649 ----
return x;
}
+
+
+ //-----
+ // Return a float cast as an long
+ //-----
+ long flt2long(mybbfloat flt)
+ {
+ long x, y;
+ char tmp[32], tmp2[32];
+
+ if (flt.exp)
+ {
+ sprintf(tmp, "%ld", flt.mantisa.i);
+ for (y=0; y<strlen(tmp)+flt.exp; y++) { tmp2[y] = tmp[y]; }
+ x = atoi(tmp2);
+ }
+ else x = flt.mantisa.i;
+
+ return x;
+ }
+
double flt2dbl(mybbfloat flt)
|