• Post Reply Bookmark Topic Watch Topic
  • New Topic

Quad-Double  RSS feed

 
Jeremy Watts
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone know of a library for the 'extended precision' type 'quad double', which is an
unevaluated sum of four IEEE double precision numbers, capable of representing at least 212 bits
of significand?
 
Les Morgan
Rancher
Posts: 779
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at BigDecimal and see if it will meet your needs. It's in the Java API.
 
Gary W. Lucas
Ranch Hand
Posts: 67
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If BigDecimal isn't what you need, you could look at the "Double Double" class in the JTS Topology Suite. I've used it extensively and have found it to be fast and reliable.

The DD.java class is pure Java and has no dependencies on other classes, so you can just lift it out and use it (with proper attribution, of course).

The downside is that it only provides 106 digits of precision. However, the author considerately included citations to the literature that may help you find something you can use or give you the information to implement your own code. Also, the version in the 1.8.0 release has a limitation in that each arithmetic operation (i.e. "an add") creates a new object. Their development branch on the JTS SourceForge page has modifications that permit DD objects to be reused. This is important if you are doing intense computations and don't want to incur the overhead for short-lived objects (which is a lot less than it used to be in Java, so may not be a consideration for you).

Finally, if you do go modifying their code, be sure you understand the role of the Java strictfp keyword in the class specification.

Gary
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!