From: Kelly Murray
Subject: Re: Things like (floor (/ (- fixed-width comp-width) 2))
Date: 
Message-ID: <1995Jun22.004408.28622@franz.com>
>········@netcom.com:
> >···@franz.com:
> >but the fastest method is to use arithmetic shift instead of floor:
> >(defun f4 (a b) (ash (the fixnum (- a b)) -1)))

> AARRRRRRRGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!
> To quote from the PDP-10 hardware reference manual (OK, technically, this
> edition is the _DECsystem-10/DECSYSTEM-20 Processor Reference Manual, 1982):
>	An arithmetic right shift truncates a negative result differently
>	from IDIV if 1s are shifted out.  The result of the shift is more
>	negative by 1 than the quotient of IDIV.  Hence shifting -1 (all
>	1s) gives -1 as a result.

(ash -1 -1)      => -1
(floor -1 2)     => -1
(ceiling -1 2)   => 0
(truncate -1 2)  => 0
(round -1 2)     => 0

-Kelly Murray  ···@franz.com  Franz Inc.