Do quants tend to use any high precision arithmetic libraries in C++ (in order to prevent things like rounding errors, and other floating point problems)? Or do they just trust that double will always work fine?If the former, can you recommend some good high precision libraries out there for C++? In your experience, what are the tradeoffs in terms of performance?For further information: en.wikipedia.org/wiki/Arbitrary-precision_arithmetic

Last edited by Y0da on August 28th, 2012, 10:00 pm, edited 1 time in total.

- Cuchulainn
**Posts:**63232**Joined:****Location:**Amsterdam-
**Contact:**

In numerical analysis, you first try to design algorithms so that you don't get rounding errors but this is less of an issues with current technology using 32 and 64 bit doubles (compare this with olde days of doing it with 4-bit floats).BIGNUM stuff is probably a performance hit but I suppose it's trade-off between performance and accuracy. Computations with rational numbers could be useful.And Interval Arithmetic is used in Numerics but is not well-known. //Do you have a specific application in mind or is a general ballpark question?

Last edited by Cuchulainn on August 28th, 2012, 10:00 pm, edited 1 time in total.

Step over the gap, not into it. Watch the space between platform and train.

http://www.datasimfinancial.com

http://www.datasim.nl

http://www.datasimfinancial.com

http://www.datasim.nl

As an engineer/programmer and not a quant, I have found that many cases sufficient accuracy can be obtained using doubles or even floats. Many accuracy problems can be solved be changing the order of operations, grouping different quantities together, or reversing loops to sum smallest to largest values. I have developed physics simulations that use both very large (1e9 to 1e15) numbers and very small numbers (1e-17 to 1e-6) using double precession arithmetic.The blog that Polter linked to is a very good resource for learning how to code and preserve as much accuracy as possible. Another good resource is: What Every Computer Scientist Should Know About Floating Point Arithmetic

- stonybrooknick
**Posts:**77**Joined:**

Most Quant's stick to single precision,atleast where i worked... other places they will just declare everything double

QuoteOriginally posted by: CuchulainnIn numerical analysis, you first try to design algorithms so that you don't get rounding errors but this is less of an issues with current technology using 32 and 64 bit doubles (compare this with olde days of doing it with 4-bit floats).When did we ever use 4bits for a float ? It must be impossible to store a mantinssa and an exponent in 4 bits !

knowledge comes, wisdom lingers

- Cuchulainn
**Posts:**63232**Joined:****Location:**Amsterdam-
**Contact:**

QuoteOriginally posted by: daveangelQuoteOriginally posted by: CuchulainnIn numerical analysis, you first try to design algorithms so that you don't get rounding errors but this is less of an issues with current technology using 32 and 64 bit doubles (compare this with olde days of doing it with 4-bit floats).When did we ever use 4bits for a float ? It must be impossible to store a mantinssa and an exponent in 4 bits !You are right.I was thinking about 4-figure floating-decimal arithmetic which lead to ill-conditioned system long ag (and it was my 60th birthday yesterday).This is a flashback when you had to explicitly model round-off errors!http://books.google.nl/books/about/Comp ... edir_esc=y

Last edited by Cuchulainn on August 29th, 2012, 10:00 pm, edited 1 time in total.

Step over the gap, not into it. Watch the space between platform and train.

http://www.datasimfinancial.com

http://www.datasim.nl

http://www.datasimfinancial.com

http://www.datasim.nl

- DevonFangs
**Posts:**3004**Joined:**

Frankly, never seen anything but doubles nor necessity to go up in precision.

- Cuchulainn
**Posts:**63232**Joined:****Location:**Amsterdam-
**Contact:**

Things can become nasty with recurrence relations involving 0 - 0, 1 +- 0, 0/0 etc, when bits start falling off the radar screen.

Step over the gap, not into it. Watch the space between platform and train.

http://www.datasimfinancial.com

http://www.datasim.nl

http://www.datasimfinancial.com

http://www.datasim.nl

GZIP: On