SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
Y0da
Topic Author
Posts: 387
Joined: August 7th, 2007, 4:48 pm

Do quants use high precision arithmetic in C++, or do they just stick to doubles?

August 29th, 2012, 11:36 am

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.
 
User avatar
Cuchulainn
Posts: 63232
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Do quants use high precision arithmetic in C++, or do they just stick to doubles?

August 29th, 2012, 12:18 pm

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
 
 
User avatar
OOglesby
Posts: 42
Joined: August 26th, 2011, 5:34 am

Do quants use high precision arithmetic in C++, or do they just stick to doubles?

August 29th, 2012, 11:25 pm

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
 
User avatar
stonybrooknick
Posts: 77
Joined: January 24th, 2011, 4:37 pm

Do quants use high precision arithmetic in C++, or do they just stick to doubles?

August 30th, 2012, 2:17 pm

Most Quant's stick to single precision,atleast where i worked... other places they will just declare everything double
 
User avatar
daveangel
Posts: 17031
Joined: October 20th, 2003, 4:05 pm

Do quants use high precision arithmetic in C++, or do they just stick to doubles?

August 30th, 2012, 3:02 pm

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
 
User avatar
Cuchulainn
Posts: 63232
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Do quants use high precision arithmetic in C++, or do they just stick to doubles?

August 30th, 2012, 5:07 pm

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
 
User avatar
DevonFangs
Posts: 3004
Joined: November 9th, 2009, 1:49 pm

Do quants use high precision arithmetic in C++, or do they just stick to doubles?

August 30th, 2012, 9:40 pm

Frankly, never seen anything but doubles nor necessity to go up in precision.
 
User avatar
Cuchulainn
Posts: 63232
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Do quants use high precision arithmetic in C++, or do they just stick to doubles?

August 31st, 2012, 8:43 am

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
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On