gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] float's in surround.c


From: Arend Bayer
Subject: Re: [gnugo-devel] float's in surround.c
Date: Mon, 18 Nov 2002 20:29:50 +0100 (CET)

>
> > Dan, are you sure you aren't introducing new potential floating point
> > problems in surround.c?
> > It seems trivial to implicitly use rational numbers instead.
> >
> > Yes I know, it would be pretty strange for a floating point calculation
> > to come up e.g. with
> >
> >     15.0/5.0 = 2.99999998,
> >
> > but...I wouldn't like to bet 10:1 that this cannot happen on any
>
> I'm not sure what you are referring to. I don't see anything in
> the surround_3_12.1 that this comment could apply to.

I wasn't referring to surround_3_12.1, sorry to make that unclear.
What I am referring to is the computation of the convex hull:

surround.c:229
        /* left edge in this row is on segment (ti,tj) -> (bi, bj) */

        left_boundary = ceil(tj + (m - ti) * (bj - tj) / (bi - ti));

(Similar at analogous places.)
This could be changed to (everything int):
        left_boundary = 1 + (tj * (bi-ti) - 1 + (m - ti) * (bj - tj)
                            / (bi-ti);
Not as readable, unfortunately.


> Where floating point will be necessary is in computing the
> strategic effect when a surround escape move reason is found,
> but that is not very  different from what we already do with the
> strategic attack/defend move reasons.

Agreed, that should not be a problem.

Arend






reply via email to

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