• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Quad-Double

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 1059
27
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at BigDecimal and see if it will meet your needs. It's in the Java API.
 
Ranch Hand
Posts: 128
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Replace the word "snake" with "danger noodle" in all tiny ads.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic