kFloat v1.0 - Improves execution time of some floating point words of ju:float.ffp Jerry Kallaus 05/08/89 JForth and assembly code which dramatically improves execution time of FFP floating point arithmetic of ju:float.ffp in JForth v2.0. When this code is "included", it "includes" ju:float.ffp if necessary and redefines several words. Functionally, everything should basically work as before. The floating point package contained in ju:float.ffp provides conditional operator words which check the condition code from the last floating point operation and leave a flag on the stack. These words are FLT FLE FEQ FNE FGE FGT FVC FVS. Unfortunately, while the code for these words is fast, providing them requires that the condition code resulting from every floating point operation must be retrieved and saved in case one of these words is used in following code. This can be eliminated in areas of the users code by setting the compile time flag FP-STATUS? OFF. When this flag is off, the condition checking words listed above may NOT be used. Note that FP-STATUS? ON must be used prior to the use of any floating point code for which the condition will be checked by one of the words listed above. Note also that there are several other floating point relational and condition checking words for which are NOT affected by any of this. In any case, a faster library interface is provided for the four arithmetic operators f+,f-,f* and f/. Faster code is also provided for the following words: FLOAT, INT, FIX, F2*, F2/, DEG>RAD, and RAD>DEG. The constant for RAD/DEG is added. None of the transcendental words have been changed. TIMING Timing comparison of words of ju:float.ffp (old) and words redefined by kFloat (new) with status saving (w/ stat) and without status saving (wo/ stat). Times are approximate in microseconds. op old new new w/ wo/ stat stat f+ 116 78 56 f- 116 78 58 f* 150 116 90 f/ 186 148 120 float 134 42 42 int 122 24 22 fix 150 38 38 f2* 54 32 4 f2/ 54 32 4 BUGS None known, but would appreciate knowing of any that are found. This package corrects the following problems in both the Amiga 1.3 mathtrans.library and JFORTH 2.0 ju:float.ffp. Amiga FFP floating point math library. _MathBase SPFix Any argument with a low order byte of zero results in the input returned as the result even though bits are set in the high order three bytes, a large integer. Should return zero since a ffp exponent of zero represents an exponent of 2**(-64). JForth ju:float.ffp floating point math utilities. ju:float.ffp F2* Given an argument of zero, F2* will increment the exponent part to a one and return $ 00000001 as a result; an attempt to print with F. will give the error message "...warning fp too large to fix". F2* should return zero for an argument of zero. ju:float.ffp FLOAT Has a problem with large negative integer arguments in the range $ ffdf,ffff through $ 8000,0001. For example $ 8000,0001 results in $ 8020,00E0, should be $ 8000,00E0 $ FFDF,FF00 results in $ 8000,02D7, should be $ 8000,04D6 The comments in the code for FLOAT suggest that it needs to do something special for arguments greater than 2**21 because the library FLOAT cannot handle them. Actually, the library code seems to work fine, but gets messed up by this special code??? Maybe the library was fixed from an earlier version. ju:float.ffp INT, and thus also FIX When an overflow occurs, returns a value of zero!? The library returns maximum positive or negative integer; this seems more appropriate to me.