chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Using epsilon in test egg


From: Alaric Snell-Pym
Subject: Re: [Chicken-users] Using epsilon in test egg
Date: Sun, 27 Jul 2014 01:57:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20140704 Thunderbird/17.0.11

On 27/07/14 01:42, Matt Gushee wrote:

> I can certainly define a custom equality predicate that will do what I
> need, but this is bugging me. I guess I don't really understand how
> epsilon is supposed to work. The test egg documentation says that
> applies to 'inexact comparisons', but I can't find a definition of
> 'inexact comparison'. I have also read that '=' may be unreliable for
> inexact numbers, but I don't know what else to use. Perhaps 'fp=' from
> the Chicken library? Then I would have to ensure that all numbers are
> expressed as floats, whereas currently my code has a number of cases
> where 1 and 0 are expressed as integers.

As I understand it, the test egg epsilon won't change the behaviour of =
- it's used purely internally by the test egg when you say the likes of:

(test 1.0 (+ 0.5 0.5))

It's probably best to define your own equality predicate, I think!

ABS

-- 
Alaric Snell-Pym
http://www.snell-pym.org.uk/alaric/

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]