Implement FROUND
authorPhil Burk <philburk@mobileer.com>
Wed, 27 Apr 2016 16:14:49 +0000 (09:14 -0700)
committerPhil Burk <philburk@mobileer.com>
Wed, 27 Apr 2016 16:14:49 +0000 (09:14 -0700)
csrc/pf_float.h
csrc/pf_save.c
csrc/pfinnrfp.h

index 1e4439e967e81542358920aca1f043712bfa6193..4a7f4b68fb2e750846c02502299df01c2094cb04 100644 (file)
@@ -39,5 +39,6 @@ typedef double PF_FLOAT;
 #define fp_sqrt   sqrt
 #define fp_tan    tan
 #define fp_tanh   tanh
+#define fp_round  round
 
 #endif
index 2baf29763e42b1e0028a516f4d3d250e85663908..455b8475b6b3f8f7fc769bfb5194d58528d21bdf 100644 (file)
@@ -486,7 +486,7 @@ cell_t ffSaveForth( const char *FileName, ExecToken EntryPoint, cell_t NameSize,
     if( WriteChunkToFile( fid, ID_P4CD, (char *) CODE_BASE,
         CodeChunkSize ) < 0 ) goto error;
 
-    FormSize = sdTellFile( fid ) - 8;
+    FormSize = (uint32_t) sdTellFile( fid ) - 8;
     sdSeekFile( fid, 4, PF_SEEK_SET );
     if( Write32ToFile( fid, FormSize ) < 0 ) goto error;
 
index b74b0454a6f6f7812682336e489079697e9836c1..6e2c6284a7500d7b35c29de1cba9e7cc21959770 100644 (file)
         break;
 
     case ID_FP_FROUND:
-        ERR("\nID_FP_FROUND -  Not Yet!! FIXME\n");
+        PUSH_TOS;
+        TOS = fp_round(FP_TOS);
+        M_FP_DROP;
         break;
 
     case ID_FP_FSWAP: /* ( -- ) ( F: r1 r2 -- r2 r1 ) */