简体   繁体   English

Java相当于C#Big Rational

[英]Java's equivalent of C# Big Rational

I'm currently working on project which needs absolutely exact precision - no approximation at all. 我目前正在从事需要绝对精确的项目-完全没有近似值。 Is there in Java anything like BigRational in C# ? Java中是否有C#中的BigRational之类的东西? Java's BigDecimal doesn't seem like good enough. Java的BigDecimal似乎还不够好。

There is not (if you don't like BigDecimal); 没有(如果您不喜欢BigDecimal); however, you can make a class to represent it using BigInteger and BigDecimal. 但是,您可以使用BigInteger和BigDecimal制作一个类来表示它。 An example is found here. 这里找到一个例子

The Uncommons Maths library has a Rational type, which is probably what you're looking for. Uncommons Maths库具有一个Rational类型,这可能正是您要查找的。 It avoids loss of precision. 这样可以避免精度损失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM