mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
convert ASCII TABs to ASCII SPACEs
Converted all ASCII tabs to ASCII spaces using a 8 character tab stop, for all files, except for all Makefiles (plus rpm.mk). The `git diff -w` reports no changes.
This commit is contained in:
102
help/appr
102
help/appr
@@ -5,11 +5,11 @@ SYNOPSIS
|
||||
appr(x [,y [,z]])
|
||||
|
||||
TYPES
|
||||
x real, complex, matrix, list
|
||||
y real
|
||||
z integer
|
||||
x real, complex, matrix, list
|
||||
y real
|
||||
z integer
|
||||
|
||||
return same type as x except that complex x may return a real number
|
||||
return same type as x except that complex x may return a real number
|
||||
|
||||
DESCRIPTION
|
||||
Return the approximate value of x as specified by a specific error
|
||||
@@ -24,77 +24,77 @@ DESCRIPTION
|
||||
In the following it is assumed y is nonzero and x is not a multiple of y.
|
||||
For real x:
|
||||
|
||||
appr(x,y,z) is either the nearest multiple of y greater
|
||||
than x or the nearest multiple of y less than x. Thus, if
|
||||
we write a = appr(x,y,z) and r = x - a, then a/y is an integer
|
||||
and abs(r) < abs(y). If r > 0, we say x has been "rounded down"
|
||||
to a; if r < 0, the rounding is "up". For particular x and y,
|
||||
whether the rounding is down or up is determined by z.
|
||||
appr(x,y,z) is either the nearest multiple of y greater
|
||||
than x or the nearest multiple of y less than x. Thus, if
|
||||
we write a = appr(x,y,z) and r = x - a, then a/y is an integer
|
||||
and abs(r) < abs(y). If r > 0, we say x has been "rounded down"
|
||||
to a; if r < 0, the rounding is "up". For particular x and y,
|
||||
whether the rounding is down or up is determined by z.
|
||||
|
||||
Only the 5 lowest bits of z are used, so we may assume z has been
|
||||
replaced by its value modulo 32. The type of rounding depends on
|
||||
z as follows:
|
||||
Only the 5 lowest bits of z are used, so we may assume z has been
|
||||
replaced by its value modulo 32. The type of rounding depends on
|
||||
z as follows:
|
||||
|
||||
z = 0 round down or up according as y is positive or negative,
|
||||
sgn(r) = sgn(y)
|
||||
z = 0 round down or up according as y is positive or negative,
|
||||
sgn(r) = sgn(y)
|
||||
|
||||
z = 1 round up or down according as y is positive or negative,
|
||||
sgn(r) = -sgn(y)
|
||||
z = 1 round up or down according as y is positive or negative,
|
||||
sgn(r) = -sgn(y)
|
||||
|
||||
z = 2 round towards zero, sgn(r) = sgn(x)
|
||||
z = 2 round towards zero, sgn(r) = sgn(x)
|
||||
|
||||
z = 3 round away from zero, sgn(r) = -sgn(x)
|
||||
z = 3 round away from zero, sgn(r) = -sgn(x)
|
||||
|
||||
z = 4 round down, r > 0
|
||||
z = 4 round down, r > 0
|
||||
|
||||
z = 5 round up, r < 0
|
||||
z = 5 round up, r < 0
|
||||
|
||||
z = 6 round towards or from zero according as y is positive or
|
||||
negative, sgn(r) = sgn(x/y)
|
||||
z = 6 round towards or from zero according as y is positive or
|
||||
negative, sgn(r) = sgn(x/y)
|
||||
|
||||
z = 7 round from or towards zero according as y is positive or
|
||||
negative, sgn(r) = -sgn(x/y)
|
||||
z = 7 round from or towards zero according as y is positive or
|
||||
negative, sgn(r) = -sgn(x/y)
|
||||
|
||||
z = 8 a/y is even
|
||||
z = 8 a/y is even
|
||||
|
||||
z = 9 a/y is odd
|
||||
z = 9 a/y is odd
|
||||
|
||||
z = 10 a/y is even or odd according as x/y is positive or negative
|
||||
z = 10 a/y is even or odd according as x/y is positive or negative
|
||||
|
||||
z = 11 a/y is odd or even according as x/y is positive or negative
|
||||
z = 11 a/y is odd or even according as x/y is positive or negative
|
||||
|
||||
z = 12 a/y is even or odd according as y is positive or negative
|
||||
z = 12 a/y is even or odd according as y is positive or negative
|
||||
|
||||
z = 13 a/y is odd or even according as y is positive or negative
|
||||
z = 13 a/y is odd or even according as y is positive or negative
|
||||
|
||||
z = 14 a/y is even or odd according as x is positive or negative
|
||||
z = 14 a/y is even or odd according as x is positive or negative
|
||||
|
||||
z = 15 a/y is odd or even according as x is positive or negative
|
||||
z = 15 a/y is odd or even according as x is positive or negative
|
||||
|
||||
z = 16 to 31 abs(r) <= abs(y)/2; if there is a unique multiple
|
||||
of y that is nearest x, appr(x,y,z) is that multiple of y
|
||||
and then abs(r) < abs(y)/2. If x is midway between
|
||||
successive multiples of y, then abs(r) = abs(y)/2 and
|
||||
the value of a is as given by appr(x, y, z-16).
|
||||
z = 16 to 31 abs(r) <= abs(y)/2; if there is a unique multiple
|
||||
of y that is nearest x, appr(x,y,z) is that multiple of y
|
||||
and then abs(r) < abs(y)/2. If x is midway between
|
||||
successive multiples of y, then abs(r) = abs(y)/2 and
|
||||
the value of a is as given by appr(x, y, z-16).
|
||||
|
||||
Matrix or List x:
|
||||
|
||||
appr(x,y,z) returns the matrix or list indexed in the same way as x,
|
||||
in which each element t has been replaced by appr(t,y,z).
|
||||
appr(x,y,z) returns the matrix or list indexed in the same way as x,
|
||||
in which each element t has been replaced by appr(t,y,z).
|
||||
|
||||
Complex x:
|
||||
|
||||
Returns appr(re(x), y, z) + appr(im(x), y, z) * 1i
|
||||
Returns appr(re(x), y, z) + appr(im(x), y, z) * 1i
|
||||
|
||||
PROPERTIES
|
||||
If appr(x,y,z) != x, then abs(x - appr(x,y,z)) < abs(y).
|
||||
If appr(x,y,z) != x, then abs(x - appr(x,y,z)) < abs(y).
|
||||
|
||||
If appr(x,y,z) != x and 16 <= z <= 31, abs(x - appr(x,y,z)) <= abs(y)/2.
|
||||
If appr(x,y,z) != x and 16 <= z <= 31, abs(x - appr(x,y,z)) <= abs(y)/2.
|
||||
|
||||
For z = 0, 1, 4, 5, 16, 17, 20 or 21, and any integer n,
|
||||
appr(x + n*y, y, z) = appr(x, y, z) + n * y.
|
||||
For z = 0, 1, 4, 5, 16, 17, 20 or 21, and any integer n,
|
||||
appr(x + n*y, y, z) = appr(x, y, z) + n * y.
|
||||
|
||||
If y is nonzero, appr(x,y,8)/y = an odd integer n only if x = n * y.
|
||||
If y is nonzero, appr(x,y,8)/y = an odd integer n only if x = n * y.
|
||||
|
||||
EXAMPLE
|
||||
; print appr(-5.44,0.1,0), appr(5.44,0.1,0), appr(5.7,1,0), appr(-5.7,1,0)
|
||||
@@ -159,7 +159,7 @@ SEE ALSO
|
||||
##
|
||||
## Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
## Public License for more details.
|
||||
##
|
||||
## A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
@@ -167,8 +167,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/25 17:18:21
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/25 17:18:21
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
Reference in New Issue
Block a user