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

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

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.

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

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

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

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.

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

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

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.

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

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

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

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

QuoteType generators are sometimes viewed as a workaround for the lack of ``templated typedefs'' in C++.

http://www.datasimfinancial.com

http://www.datasim.nl

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

what is the status of the uckly duckling std::valarray in C++11?

http://www.datasimfinancial.com

http://www.datasim.nl

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

You can see that this code is wrong, but why?

http://www.datasimfinancial.com

http://www.datasim.nl

GZIP: On