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
With floating point calculations, the actual result is hardware dependent. Two algebraically equivalent calculations may yield slightly different values.
Suggestion: add explicit support for testing such values.
In the first case, we're looking for an absolute difference less than the given constant. In the second case, we're looking for the ratio of the difference to the absolute value (of the second argument, say) to be less than the given constant.
This came up for me while working on word relevancy in vimium. Amazingly, my floating point tests using isEqual work. But I'd be more comfortable working with test which are more likely to succeed on a variety of hardware platforms.
You might argue that such tests don't make sense for floating point calculations: they're always hardware dependent. And you'd have a point.
Or you might argue that such tests can always be constructed using the existing isTrue. And you'd be right there, too. However, all tests can be constructed in terms of isTrue. But explicit support from shoulda makes such tests easier to write and easier to read.
The text was updated successfully, but these errors were encountered:
With floating point calculations, the actual result is hardware dependent. Two algebraically equivalent calculations may yield slightly different values.
Suggestion: add explicit support for testing such values.
Support might look something like:
In the first case, we're looking for an absolute difference less than the given constant. In the second case, we're looking for the ratio of the difference to the absolute value (of the second argument, say) to be less than the given constant.
This came up for me while working on word relevancy in vimium. Amazingly, my floating point tests using
isEqual
work. But I'd be more comfortable working with test which are more likely to succeed on a variety of hardware platforms.You might argue that such tests don't make sense for floating point calculations: they're always hardware dependent. And you'd have a point.
Or you might argue that such tests can always be constructed using the existing
isTrue
. And you'd be right there, too. However, all tests can be constructed in terms ofisTrue
. But explicit support from shoulda makes such tests easier to write and easier to read.The text was updated successfully, but these errors were encountered: