Thanks, Larry!  I appreciate the alert.

[EMAIL PROTECTED] wrote:
> 
> ... The problems are due to a flaw in the mathematical comparison
> functions (< > <> = <= >=) in REBOL when they are applied to the
> decimal! type...
> 

So, to avoid stepping on this land-mine, I should either define the
"safe" comparisons per your note or rewrite

> >
> >     signum: func [n [number!]] [
> >         ewd/if [
> >             n < 0 [-1]
> >             n = 0 [ 0]
> >             n > 0 [ 1]
> >         ]
> >     ]

    signum: func [n [number!]] [
        ewd/if [
            negative? n [-1]
            zero?     n [ 0]
            positive? n [ 1]
        ]
    ]

and

> >
> >     medianof3: func [a b c] [
> >         ewd/do [
> >             a > b [set [a b] reduce [b a]]
> >             b > c [set [b c] reduce [c b]]
> >         ]
> >         b
> >     ]
> >

    medianof3: func [a b c] [
        ewd/do [
            positive? a - b [set [a b] reduce [b a]]
            positive? b - c [set [b c] reduce [c b]]
        ]
        b
    ]

and so on for the other examples...  right?

Hmmm...  Those definitions for 'gt? 'eq? 'lt? (etc.) are looking
better all the time!

-jn-

Reply via email to