repo.or.cz
/
factor
/
jcg.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
remove math.blas.syntax and merge parsing words into math.blas.vectors/matrices
[factor/jcg.git]
/
extra
/
math
/
compare
/
compare.factor
blob
826f0ecf165cd6f08094a9f5c82f8a7e0daee2e1
1
! Copyright (C) 2008 John Benediktsson.
2
! See http://factorcode.org/license.txt for BSD license
3
USING: math math.order kernel ;
4
IN: math.compare
5
6
: absmin ( a b -- x )
7
[ [ abs ] bi@ < ] 2keep ? ;
8
9
: absmax ( a b -- x )
10
[ [ abs ] bi@ > ] 2keep ? ;
11
12
: posmax ( a b -- x )
13
0 max max ;
14
15
: negmin ( a b -- x )
16
0 min min ;
17
18
: clamp ( a value b -- x )
19
min max ;