Java BigDecimal triangulation

I am developing a mathematical parser that can evaluate strings, such as' 5 b * sqrt (C ^ 2) ' I am using ANTLR for parsing and have made good progress Now I fall on the Java class BigDecimal and think: Hey, why not consider precision here

My problem is that the Java API does not provide trigonometry for bigdecimals (such as Java. Lang. math) Do you know if there is a good math library, such as Apache commons, to deal with this problem?

The other problem is how to implement the power method so that I can calculate 4.9 ^ 1.4 with bigdecimals Is that possible?

We also appreciate the book request on numerical calculation

Solution

Apfloat is a library that contains arbitrary precision approximations of trigonometric functions and non integer powers; However, it uses its own internal representation instead of BigDecimal and BigInteger I haven't used it before, so I can't guarantee its correctness or performance characteristics, but the API seems quite complete

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>