SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
Polter
Posts: 2526
Joined: April 29th, 2008, 4:55 pm

ISO C++11 published

January 24th, 2016, 11:30 am

 
User avatar
Polter
Posts: 2526
Joined: April 29th, 2008, 4:55 pm

ISO C++11 published

January 25th, 2016, 10:34 am

That's a pretty interesting idea -- add warnings or errors when using a numerically unstable floating point expression: http://github.com/mcarton/rust-herbie-lint
 
User avatar
Cuchulainn
Posts: 60457
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

ISO C++11 published

January 25th, 2016, 10:56 am

QuoteOriginally posted by: PolterThat's a pretty interesting idea -- add warnings or errors when using a numerically unstable floating point expression: http://github.com/mcarton/rust-herbie-lintWhat is the definition of 'numerically unstable thing'Quotetest.rs:155:5: 155:30 warning: Numerically unstable expression, #[warn(herbie)] on by defaulttest.rs:155 (a+b).sin() - (a+b).cos(); ^~~~~~~~~~~~~~~~~~~~~~~~~test.rs:155:5: 155:30 help: Try thistest.rs: (b.sin() * (a.sin() + a.cos())) - ((a.cos() - a.sin()) * b.cos());Take b = 0, the answers are not even the same. Am I missing something subtle? Was it machine-produced code or written on the fly? Quotetest.rs:40:5: 40:18 warning: Numerically unstable expression, #[warn(herbie)] on by defaulttest.rs:40 (a/b + c) * b; ^~~~~~~~~~~~~test.rs:40:5: 40:18 help: Try thistest.rs: (c * b) + a;I agree with this one. But the algorithm should never get that far in the first place.
Last edited by Cuchulainn on January 24th, 2016, 11:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Polter
Posts: 2526
Joined: April 29th, 2008, 4:55 pm

ISO C++11 published

January 25th, 2016, 6:12 pm

QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: PolterThat's a pretty interesting idea -- add warnings or errors when using a numerically unstable floating point expression: http://github.com/mcarton/rust-herbie-lintWhat is the definition of 'numerically unstable thing'From the paper, the goal seems to be the following:QuoteTo correct inaccurate formulas, programmers must rearrange their computations to avoid rounding error. These rearrangements are often based on identities of real-number arithmetic. For example, to avoid catastrophic cancellation in (1+x)-x , one could reassociateinto 1+(x-x) , which simplifies to 1 and is exactly accurate.Quotetest.rs:155:5: 155:30 warning: Numerically unstable expression, #[warn(herbie)] on by defaulttest.rs:155 (a+b).sin() - (a+b).cos(); ^~~~~~~~~~~~~~~~~~~~~~~~~test.rs:155:5: 155:30 help: Try thistest.rs: (b.sin() * (a.sin() + a.cos())) - ((a.cos() - a.sin()) * b.cos());Take b = 0, the answers are not even the same. Am I missing something subtle? Was it machine-produced code or written on the fly?Seems to reduce to the same thing: http://www.wolframalpha.com/input/?i=Fu ... y%5bsin(b)+*+(sin(a)+%2b+cos(a))+-+(cos(a)+-+sin(a))+*+cos(b)%5d
 
User avatar
Cuchulainn
Posts: 60457
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

ISO C++11 published

January 25th, 2016, 7:54 pm

QuoteOriginally posted by: PolterQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: PolterThat's a pretty interesting idea -- add warnings or errors when using a numerically unstable floating point expression: http://github.com/mcarton/rust-herbie-lintWhat is the definition of 'numerically unstable thing'From the paper, the goal seems to be the following:QuoteTo correct inaccurate formulas, programmers must rearrange their computations to avoid rounding error. These rearrangements are often based on identities of real-number arithmetic. For example, to avoid catastrophic cancellation in (1+x)-x , one could reassociateinto 1+(x-x) , which simplifies to 1 and is exactly accurate.Quotetest.rs:155:5: 155:30 warning: Numerically unstable expression, #[warn(herbie)] on by defaulttest.rs:155 (a+b).sin() - (a+b).cos(); ^~~~~~~~~~~~~~~~~~~~~~~~~test.rs:155:5: 155:30 help: Try thistest.rs: (b.sin() * (a.sin() + a.cos())) - ((a.cos() - a.sin()) * b.cos());Take b = 0, the answers are not even the same. Am I missing something subtle? Was it machine-produced code or written on the fly?Seems to reduce to the same thing: http://www.wolframalpha.com/input/?i=Fu ... y%5bsin(b)+*+(sin(a)+%2b+cos(a))+-+(cos(a)+-+sin(a))+*+cos(b)%5dWhat if you do it by hand?? BTW I agree with Wolfram. I TAKE IT BACK it's notation!!!!(a+b)cos() == cos(a+b)LOL==It is not consistent with accepted mathematical notation, which is bad.
Last edited by Cuchulainn on January 25th, 2016, 11:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Posts: 60457
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

ISO C++11 published

January 26th, 2016, 10:52 am

I think this is the official/accepted term:Loss of significance
Last edited by Cuchulainn on January 25th, 2016, 11:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Posts: 60457
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

ISO C++11 published

February 4th, 2016, 9:16 pm

Does this class walk, talk and quack like an abstract class?
Last edited by Cuchulainn on February 3rd, 2016, 11:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Posts: 60457
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

ISO C++11 published

February 18th, 2016, 9:23 am

QuoteType generators are sometimes viewed as a workaround for the lack of ``templated typedefs'' in C++.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Posts: 60457
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

ISO C++11 published

February 26th, 2016, 10:02 am

what is the status of the uckly duckling std::valarray in C++11?
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Posts: 60457
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

ISO C++11 published

June 13th, 2016, 2:35 pm

You can see that this code is wrong, but why?
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
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