This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

fractional part of a number

4 posts · 3722 views

Hi,
Is there a simple way to return the fractional part of a number in common lisp?
At the moment I am using
(multiple-value-call (lambda (x y)(declare (ignore x)) y) (floor 1.5))
but this seems a bit verbose.

Re: fractional part of a number

stackman wrote:Hi,
Is there a simple way to return the fractional part of a number in common lisp?
At the moment I am using
(multiple-value-call (lambda (x y)(declare (ignore x)) y) (floor 1.5))
but this seems a bit verbose.
FWIW, (nth-value 1 (floor 1.5))

Re: fractional part of a number

Thanks for the replies, this is definitely better.