summaryrefslogtreecommitdiffstats
path: root/factor
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2010-04-22 04:42:21 +0000
committerdholland <dholland@NetBSD.org>2010-04-22 04:42:21 +0000
commiteb31b3bcc14ed74d293c0d4da6ef8f76e4bbcee8 (patch)
tree9fd50f042b73fbc1174389536f83e6b058f7d231 /factor
parent8c18ea25f25726d33a02c812356d98714c3b71ad (diff)
downloadbsdgames-darwin-eb31b3bcc14ed74d293c0d4da6ef8f76e4bbcee8.tar.gz
bsdgames-darwin-eb31b3bcc14ed74d293c0d4da6ef8f76e4bbcee8.tar.zst
bsdgames-darwin-eb31b3bcc14ed74d293c0d4da6ef8f76e4bbcee8.zip
Sync with reality. Bump date.
Diffstat (limited to 'factor')
-rw-r--r--factor/factor.638
1 files changed, 27 insertions, 11 deletions
diff --git a/factor/factor.6 b/factor/factor.6
index 4600bd34..2cb75b75 100644
--- a/factor/factor.6
+++ b/factor/factor.6
@@ -1,4 +1,4 @@
-.\" $NetBSD: factor.6,v 1.9 2004/02/08 13:16:25 jsm Exp $
+.\" $NetBSD: factor.6,v 1.10 2010/04/22 04:42:21 dholland Exp $
.\"
.\" Copyright (c) 1989, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -37,7 +37,7 @@
.\"
.\" chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
.\"
-.Dd February 8, 2004
+.Dd April 22, 2010
.Dt FACTOR 6
.Os
.Sh NAME
@@ -49,10 +49,12 @@
.Sh DESCRIPTION
The
.Nm
-utility will factor integers between \-2147483648 and 2147483647 inclusive.
+utility factors positive integers.
When a number is factored, it is printed, followed by a
.Dq \&: ,
-and the list of factors on a single line.
+and the list of
+.Pq prime
+factors on a single line.
Factors are listed in ascending order, and are preceded by a space.
If a factor divides a value more than once, it will be printed more than once.
.Pp
@@ -66,16 +68,30 @@ is invoked with no arguments,
.Nm
reads numbers, one per line, from standard input, until end of file or error.
Leading white-space and empty lines are ignored.
-Numbers may be preceded by a single - or +.
+Numbers may be preceded by a single - or +, although negative numbers
+are rejected.
Numbers are terminated by a non-digit character (such as a newline).
After a number is read, it is factored.
-Input lines must not be longer than 255 characters.
+Input lines must not be longer than
+.Dv LINE_MAX - 1
+(currently 2047) characters.
+.Pp
+By default,
+.Nm
+is compiled against the OpenSSL bignum implementation
+.Xr openssl_bn 3 ,
+which lets it handle arbitrarily large values.
+.Pq Note however that very large values can take a very long time to factor.
+If
+.Nm
+is compiled without OpenSSL it is limited to the maximum value of
+.Vt unsigned long .
.Sh DIAGNOSTICS
Out of range or invalid input results in
an appropriate error message
being written to standard error.
-.Sh BUGS
-.Nm
-cannot handle the
-.Dq 10 most wanted
-factor list.
+.\".Sh BUGS
+.\".Nm
+.\"cannot handle the
+.\".Dq 10 most wanted
+.\"factor list.