diff options
author | dos-reis <gdr@axiomatics.org> | 2011-03-12 17:04:43 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-03-12 17:04:43 +0000 |
commit | 52fddea19454dc2b9bcb54c6edd5a4cd4f5765a9 (patch) | |
tree | 4b13ccc6d57c7c1ee615c83615b246c98eae388a /src/algebra/color.spad.pamphlet | |
parent | 42d38bee45a64edfc12641053e58581c20584363 (diff) | |
download | open-axiom-52fddea19454dc2b9bcb54c6edd5a4cd4f5765a9.tar.gz |
* src/algebra/: Systematically use negative? when comparing for
less than 0.
Diffstat (limited to 'src/algebra/color.spad.pamphlet')
-rw-r--r-- | src/algebra/color.spad.pamphlet | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/algebra/color.spad.pamphlet b/src/algebra/color.spad.pamphlet index 4899d450..76b8ea9b 100644 --- a/src/algebra/color.spad.pamphlet +++ b/src/algebra/color.spad.pamphlet @@ -112,7 +112,7 @@ Color(): Exports == Implementation where x := y y := c diff := x.hue - y.hue - if (xHueSmaller:= (diff < 0)) then diff := -diff + if (xHueSmaller:= negative? diff) then diff := -diff if (moreThanHalf:=(diff > totalHues quo 2)) then diff := totalHues-diff offset : I := wholePart(round (diff::SF/(2::SF)**(x.weight/y.weight)) ) if (xHueSmaller and not moreThanHalf) @@ -121,7 +121,7 @@ Color(): Exports == Implementation where ans := x.hue + offset else ans := x.hue - offset - if (ans < 0) then ans := totalHues + ans + if negative? ans then ans := totalHues + ans else if (ans > totalHues) then ans := ans - totalHues [ans,1] @@ -136,7 +136,7 @@ Color(): Exports == Implementation where numberOfHues() == totalHues color i == - if (i<0) or (i>totalHues) then + if negative? i or (i>totalHues) then error concat("Color should be in the range 1..",totalHues::String) [i::I, 1] |