Re: another newbie question
"Andreas Thiele" <andreas@atp-media.de> writes:
> (defun dround (num n)
> "round num to n digits"
> (let ((format-string (concatenate 'string "~," (format nil "~a" n)
> "f")))
> (read-from-string (format nil format-string num))))
>
> not very elegant, just a fast hack :))
>
>
> Andreas
or
(defun dround (num x)
(let ((by (expt 10 x)))
(float (/ (floor num (/ 1 by)) by))))
* (dround (+ (* 2 1.0001) 4.1) 2)
=> 6.1
Sean
--
"My doctor says that I have a malformed public-duty gland and a
natural deficiency in moral fibre," he muttered to himself, "and
that I am therefore excused from saving Universes."
- Life, the Universe, and Everything Douglas Adams.
Confidentiality Notice:
The above message and all attachments may contain privileged and confidential information intended only for the
person or entity to which it is addressed. Any review, retransmission, dissemination, copy or other use of, or
taking of any action in reliance upon this information by persons or entities other than the intended recipient is
prohibited. If you received this message in error, please notify the sender immediately by e-mail, facsimile or
telephone and thereafter delete the material from your computer. Any views expressed in this message are those of
the individual sender, except where the sender specifically states them to be the view of the entity transmitting
the message.UCS Group Limited and all of its subsidiary companies hereby distance themselves from and accept no
liability in respect of the unauthorised use of its e-mail facility or the sending of e-mail communications for
other than strictly business purposes