This method considers special cases where a simpler algorithm would return "ugly" results.
For example when the expression (-1e40)^0.5 is evaluated without considering the special case, the argument of the base is the double number closest to pi. When Sin and cos are used for the final evaluation of the result, the slight difference of the argument from pi causes a non-zero value for the real component of the result. Because the value of the base is so high, the error is magnified. Although the error is normal for floating point calculations, the consideration of commonly occurring special cases improves the accuracy and aesthetics of the results.
If you know a more elegant way to solve this problem, please let me know at email@example.com .
Assembly: Jep (in Jep.dll) Version: 184.108.40.206 (1.0.0)
|Visual Basic (Declaration)|
- Type: System..::.Double