inf -> 1./0.

cvs
Doug Coleman 2006-01-27 15:17:32 +00:00
parent 95b908479e
commit 5046604b01
2 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,7 @@ IN: math-contrib
#! gamma(x) = integral 0..inf [ t^(x-1) exp(-t) ] dt #! gamma(x) = integral 0..inf [ t^(x-1) exp(-t) ] dt
#! gamma(n+1) = n! for n > 0 #! gamma(n+1) = n! for n > 0
dup Z:(-inf,0]? [ dup Z:(-inf,0]? [
drop inf drop 1./0.
] [ ] [
dup abs gamma-lanczos6 swap dup 0 > [ drop ] [ gamma-neg ] if dup abs gamma-lanczos6 swap dup 0 > [ drop ] [ gamma-neg ] if
] if ; ] if ;
@ -50,7 +50,7 @@ IN: math-contrib
#! gammaln(x) is an alternative when gamma(x)'s range #! gammaln(x) is an alternative when gamma(x)'s range
#! varies too widely #! varies too widely
dup 0 < [ dup 0 < [
drop inf drop 1./0.
] [ ] [
dup abs gammaln-lanczos6 swap dup 0 > [ drop ] [ gamma-neg ] if dup abs gammaln-lanczos6 swap dup 0 > [ drop ] [ gamma-neg ] if
] if ; ] if ;

View File

@ -45,7 +45,7 @@ USING: errors kernel sequences math sequences-internals namespaces arrays ;
: minmax ( seq -- min max ) : minmax ( seq -- min max )
#! find the min and max of a seq in one pass #! find the min and max of a seq in one pass
inf -inf rot [ dup pick max -rot nip pick min -rot nip ] each ; 1./0. -1./0. rot [ dup pick max -rot nip pick min -rot nip ] each ;
: absminmax ( seq -- min max ) : absminmax ( seq -- min max )
#! find the absolute values of the min and max of a seq in one pass #! find the absolute values of the min and max of a seq in one pass