[racket] a function for a generalization of permutations for floats without going to +inf.0?

From: Alexander D. Knauth (alexander at knauth.org)
Date: Sat Jan 24 13:18:11 EST 2015

Is there a way to define a function for a generalization of permutations for flonums using gamma?
This doesn’t work because if n is >=171 and k is a float it just returns +inf.0:
#lang racket
(require math/special-functions)
(define (my-factorial x) (gamma (+ x 1)))
(define (my-permutations n k) (/ (my-factorial n) (my-factorial (- n k))))

Is there a better way to do this without it returning +inf.0, or is there a library function anywhere that does this?




Posted on the users mailing list.