Annotation of researchv10dc/man/adm/man3/arith.3, revision 1.1.1.1

1.1       root        1: .TH ARITH 3
                      2: .CT 2 math
                      3: .SH NAME
                      4: abs, sgn, gcd, lcm, min, max, labs \(mi integer arithmetic functions:
                      5: absolute value, sign,
                      6: greatest common divisor, least common multiple, minimum, maximum
                      7: .SH SYNOPSIS
                      8: .B int abs(a)
                      9: .PP
                     10: .B int sgn(a)
                     11: .PP
                     12: .B int gcd(a, b)
                     13: .PP
                     14: .B long lcm(a, b)
                     15: .PP
                     16: .B int min(a, b)
                     17: .PP
                     18: .B int max(a, b)
                     19: .PP
                     20: .B long labs(a)
                     21: .br
                     22: .B long a;
                     23: .SH DESCRIPTION
                     24: .I Abs
                     25: returns
                     26: the absolute value of
                     27: .I a.
                     28: .PP
                     29: .I Sgn
                     30: returns
                     31: \-1, 0, 1,
                     32: if
                     33: .L
                     34: \fIa\fR<0, \fIa\fR=0, \fIa\fR>0,
                     35: respectively.
                     36: .PP
                     37: .I Gcd
                     38: returns the greatest common divisor of
                     39: .I a
                     40: and
                     41: .I b.
                     42: More precisely,
                     43: .I gcd
                     44: returns the largest machine-representable
                     45: generator of the ideal generated by
                     46: .I a
                     47: and
                     48: .I b.
                     49: This means that 
                     50: .B gcd(0,0)
                     51: = 0, and
                     52: .B gcd(N,0)
                     53: =
                     54: .B gcd(N,N)
                     55: =
                     56: .BR N ,
                     57: where 
                     58: .B N
                     59: is the most negative integer.
                     60: .PP
                     61: .I Lcm
                     62: returns the least common multiple of
                     63: .I a
                     64: and
                     65: .I b.
                     66: When the result is representable, it satisfies
                     67: .BR "abs(a*b)== lcm(a,b)*gcd(a,b)" .
                     68: .PP
                     69: .I Min
                     70: .RI ( max )
                     71: returns the minimum (maximum) of
                     72: .I a
                     73: and
                     74: .I b.
                     75: .SH SEE ALSO
                     76: .IR floor (3)
                     77: for
                     78: .I fabs
                     79: .SH DIAGNOSTICS
                     80: .I Abs
                     81: returns
                     82: the most negative integer when the true result is unrepresentable.
                     83: .PP
                     84: There are no guarantees about the value of
                     85: .I lcm
                     86: when the true value is unrepresentable.
                     87: .SH BUGS
                     88: The result of
                     89: .I lcm
                     90: is undefined when it doesn't fit in a long.
                     91: .br
                     92: .I Labs,
                     93: provided for
                     94: .SM ANSI
                     95: compatibility, is lonely; there is no
                     96: .I lsign, lmax,
                     97: etc.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.