From: Ben Pfaff Date: Tue, 20 Dec 2005 19:47:32 +0000 (+0000) Subject: Fix description of rounding to nearest in fixed point to take into X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ec43d15667ab970015f0299463d16f190506bd0;p=pintos-anon Fix description of rounding to nearest in fixed point to take into account negative numbers. Thanks to Nishit Sureshchandra Shah for the correction. --- diff --git a/doc/44bsd.texi b/doc/44bsd.texi index 3f17918..fc619c1 100644 --- a/doc/44bsd.texi +++ b/doc/44bsd.texi @@ -318,11 +318,12 @@ q}: @item Convert @code{n} to fixed point: @tab @code{n * f} -@item Convert @code{x} to integer (rounding down): +@item Convert @code{x} to integer (rounding toward zero): @tab @code{x / f} @item Convert @code{x} to integer (rounding to nearest): -@tab @code{(x + f / 2) / f} +@tab @code{(x + f / 2) / f} if @code{x >= 0}, @* +@code{(x - f / 2) / f} if @code{x <= 0}. @item Add @code{x} and @code{y}: @tab @code{x + y}