MathFP - WABA Version - |
A WABA version of MathFP was created after many requests to provide a version for the WABA platform. The reason why the standard version does not run on the WABA platform is related to the absence of Exceptions. MathFP for the KVM throws Arithmetic Exceptions when an invalid input is encountered or when an overflow is detected. The second cause is the difference in value conversions of a number to a string. Waba uses the Convert class.
To allow the WABA developer some form of failure detection an err_no flag is added. This flag will indicate the type of error that occured:
| Error Code | Description |
|---|---|
| 0 | No error |
| 1 | Invalid input |
| 2 | Overflow |
The err_no field is private and is accessible by calling public MathFP.stat().
WABA supports floats so why use this fixed point integer library. The answer to this question is related to number of available math functions which are not currently available in WABA.Secondly it will allow programs to be "more" portable between both the WABA platform and the KVM platform. Notice the word more. Since the call to retrieve the error status is not made available in the KVM version (Exceptions are used). So in order to run your program on both platforms minor adjustments will have to be made.
Why not use the err_no flag on both the WABA platform and the KVM platform? I have thought about this and have found no good argument besides the fact that I feel that Exceptions should be supported in WABA. I more or less see this as a core function of JAVA and don't want to take it out. If others have better arguments just let me know (Onno Hommes)
Onno Hommes, Rochester NY
jScience Technologies
www.jscience.net