Re: Microrant on Ruy's Math Skills
Yong Li <gilbertly <at> gmail.com>
2012-02-01 01:31:51 GMT
On Wed, Feb 1, 2012 at 12:49 AM, Chad Perrin <code <at> apotheon.net> wrote:
> On Tue, Jan 31, 2012 at 06:35:29PM +0900, Yong Li wrote:
>> On Tue, Jan 31, 2012 at 4:03 PM, Chad Perrin <code <at> apotheon.net> wrote:
>> >
>> > What exactly are you arguing here -- that there's no such thing as a
>> > solution that is easier to evaluate in one's head so that the results are
>> > not surprising a lot of the time?
>>
>> suppose we are writing a unit test method
>> def test_something() do
>> a = pre_condition() # => a is a Float
>> assert_approx_equal a, expected1 # => ok
>> a = process a # => do the real work
>> assert_approx_equal a, expected2 # => the assertion may fail, if
>> expected 2 is evaluated in my head
>> end
>>
>> do you consider this as a surprising result that may happen a lot?
>
> Yeah, basically. Of course, "a lot" is relative -- but the upshot is
> that it happens enough to be a problem when offering an additional
> comparison method should yield something much easier to evaluate in one's
> head.
>
> Of course, I don't know how you get a unit test to make use of your
> brain's arithmetic capabilities. . . .
>
Sorry, my bad for confusing you. Second try:
# process(Fixnum i) is supposed to return 100.0 * i
(Continue reading)