History log of /netbsd-src/games/factor/factor.c (Results 1 – 25 of 38)
Revision Date Author Comments
# 5d858a7a 12-Oct-2020 christos <christos@NetBSD.org>

- remove duplicate comment
- flush after printing the number
(from kre@)


# 662c0e24 11-Oct-2020 christos <christos@NetBSD.org>

Remove is_hex_str() (trying to guess if a number was hex or not). It is not
documented and can lead to unexpected behavior.


# f1aebb0c 11-Oct-2020 christos <christos@NetBSD.org>

From gson@
- don't assume -h is always on for large factors
- fix saved large factors printing when -h


# 0540874b 07-Oct-2020 christos <christos@NetBSD.org>

- for readability when the exponent < 10 don't prefix it with 0x (from kre)
- fix usage
- merge printing code.


# c5aeb8a7 05-Oct-2020 christos <christos@NetBSD.org>

PR/55695: Andreas Gustafsson: factor(6) -h option doesn't always work
Handle -h for factors greater than the primes table.


# a17b1cd2 05-Oct-2020 christos <christos@NetBSD.org>

revert previous and don't parse octal


# 7f481043 05-Oct-2020 tnn <tnn@NetBSD.org>

factor: usage(): mark __dead


# 2c61d0e8 04-Oct-2020 christos <christos@NetBSD.org>

- Accept octal input.
- Don't play with the original string so we can print it.


# 5e85fe34 03-Oct-2020 christos <christos@NetBSD.org>

PR/55693: Andreas Gustafsson: factor(6) lists factors in wrong order
Sync with FreeBSD and change their -h (that printed hex) to -x because
we were already using -h.


# 64a90adb 06-Feb-2018 christos <christos@NetBSD.org>

fix for OpenSSL-1.1


# f345b5cb 11-Nov-2017 rin <rin@NetBSD.org>

Add -h option to factor(6): duplicate factors are printed in
"human-readable" form of x^n.


# bfe1fbfe 02-Oct-2014 ast <ast@NetBSD.org>

Imported and adapted from FreeBSD svn r272166 and r272207; this fixes
false positives for products of primes larger than 2^16. For example,
before this commit:

$ /usr/games/primes 4295360521 42953

Imported and adapted from FreeBSD svn r272166 and r272207; this fixes
false positives for products of primes larger than 2^16. For example,
before this commit:

$ /usr/games/primes 4295360521 4295360522
4295360521
but
$ /usr/games/factor 4295360521
4295360521: 65539 65539

or
$ /usr/games/primes 3825123056546413049 3825123056546413050
3825123056546413049
yet
$ /usr/games/factor 3825123056546413049
3825123056546413049: 165479 23115459100831

or
$ /usr/games/primes 18446744073709551577
18446744073709551577
although
$ /usr/games/factor 18446744073709551577
18446744073709551577: 139646831 132095686967

Incidentally, the above examples show the smallest and largest cases that
were erroneously stated as prime in the range 2^32 .. 3825123056546413049
.. 2^64; the primes(6) program now stops at 3825123056546413050 as
primality tests on larger integers would be by brute force factorization.

In addition, special to the NetBSD version:
. for -d option, skip first difference when start is >65537 as it is incorrect
. corrected usage to mention both the existing -d as well as the new -h option

For original FreeBSD commit message by Colin Percival, see:
http://svnweb.freebsd.org/base?view=revision&revision=272166

show more ...


# 7621b801 09-Nov-2011 drochner <drochner@NetBSD.org>

remove duplicated #defines (in a usually unused part of the code)


# cbd2e3d5 23-May-2011 joerg <joerg@NetBSD.org>

Properly print string.


# 6394298f 15-May-2010 joerg <joerg@NetBSD.org>

Follow the Fundamental Theory of Algebra. Disallow factorising of
numbers less than 2 as it is not
- naturally unique (negative numbers)
- finite (0)
- non-empty (1)

Discussed with the kristaps and

Follow the Fundamental Theory of Algebra. Disallow factorising of
numbers less than 2 as it is not
- naturally unique (negative numbers)
- finite (0)
- non-empty (1)

Discussed with the kristaps and wiz

show more ...


# 50eb6aad 13-May-2010 tnozaki <tnozaki@NetBSD.org>

cast isblank(3)'s argument to unsigned char.


# d184555b 28-Apr-2010 drochner <drochner@NetBSD.org>

rename pollard_pminus1->pollard_rho for consistency


# fe64100e 27-Apr-2010 drochner <drochner@NetBSD.org>

-Fix an old bug in the "pollard" code: it gets its argument passed
by reference, and changes the value behind the pointer under some
circumstances (basically if it finds more than 2 different facto

-Fix an old bug in the "pollard" code: it gets its argument passed
by reference, and changes the value behind the pointer under some
circumstances (basically if it finds more than 2 different factors).
It also calls itself if it finds a factor which is not considered prime
(by openssl's miller-rabin check) and uses the call argument afterwards.
This doesn't work -- we need to copy the argument into its own storage.
-Modify the code to do the "rho" algorithm as was initially announced.
It takes somewhat longer in rare cases, but still works in cases where
the "p-1" algorithm is unusable. This might fix PR misc/43192
by Luiz Henrique de Figueiredo.
-Add some optional debug support, minor cleanup.

show more ...


# f79e06d7 22-Apr-2010 drochner <drochner@NetBSD.org>

fix an obvious flaw in bounds check: the array of precomputed primes
could be overrun if its last entry (65537) was a factor of the input
(this does not affect PR misc/43192 -- the factors are much l

fix an obvious flaw in bounds check: the array of precomputed primes
could be overrun if its last entry (65537) was a factor of the input
(this does not affect PR misc/43192 -- the factors are much larger
here: 7742394596501*159455563099482401)

show more ...


# e0ba63fe 12-Aug-2009 dholland <dholland@NetBSD.org>

sprinkle static


# 2fe2731d 20-Jul-2008 lukem <lukem@NetBSD.org>

Remove the \n and tabs from the __COPYRIGHT() strings.


# 8b0f9554 15-Dec-2007 perry <perry@NetBSD.org>

convert __attribute__s to applicable cdefs.h macros


# 1a815e1f 27-Jun-2005 rillig <rillig@NetBSD.org>

Fixed a comment that said the factors in the output would be strictly
ascending.


# 4eec310a 08-Feb-2004 jsm <jsm@NetBSD.org>

Check large factor for being prime before applying Pollard's
algorithm; fixes "factor 2147483647111311". Correct comment;
algorithm is Pollard p-1, not Pollard rho. Increase base if p-1
algorithm r

Check large factor for being prime before applying Pollard's
algorithm; fixes "factor 2147483647111311". Correct comment;
algorithm is Pollard p-1, not Pollard rho. Increase base if p-1
algorithm reaches 1; fixes "factor 99999999999991". Testcases from
David A Bagley <bagleyd@tux.org>.

show more ...


# e5aeb4ea 07-Aug-2003 agc <agc@NetBSD.org>

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22269, verified by myself.


12