You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I spent some time thinking about this, then suddenly got really busy and couldn't respond.
The reason why this wasn't a no-brainer change was that it isn't quite so simple as to add a float overload for the function, because that would trigger compile-time error for code like Approx(2).margin(2). The solution that we are using is to add a templated overload, that uses SFINAE to only work with types that can be converted to double.
Now, for Approx::margin this isn't semantically problematic, as Approx(temperature(72)).margin(temperature(2)), makes perfect sense. However for Approx::epsilon the situation is not quite so clear-cut, as Approx(temperature(72)).epsilon(temperature(0.001)) does not make semantic sense.
This could be solved in two ways.
Specifically make Approx::epsilon only accept floating point types (using std::is_floating_point).
Damn the semantics, make Approx::epsilon accept anything.
Personally I like the second option better.
There is also Approx::scale, but I don't think anybody is actually using that one.
Description
Approx::Approx
and its comparison operators can now takefloat
Approx::epsilon
would improve consistency and codeSomehow related to #873
Extra information
The text was updated successfully, but these errors were encountered: