bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12350: Composites identified as primes in factor.c (when HAVE_GMP)


From: Jim Meyering
Subject: bug#12350: Composites identified as primes in factor.c (when HAVE_GMP)
Date: Fri, 14 Sep 2012 14:48:00 +0200

Torbjorn Granlund wrote:

> I merged your changes, and made several analogous changes.
> The code now passes strict compilation with and without HAVE_GMP.
>
> I did not merge the tests changes yet.
>
> Please grab our version from our repo.
>
> If your repo is public, please let me now how to access it.  Else,
> please either send a diff -c between your version and our repo version,
> or your full file.

Thanks for finishing the job!
Regarding the "full file", I presume you mean the Makefile,
since you've integrated all of my changes in factor.c.
Included below.

Though note that I've replaced the use of ./ourseq with simply "seq",
which depends on your having the very latest version of seq.c from
coreutils v8.19-129-g77f89d0 or newer built and first in your path.

With that Makefile, you can remove the entire tests/ directory.

# Developement Makefile for the NT factor project

# Copyright 2012 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.

# This program 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 General Public License for more
# details.

# You should have received a copy of the GNU General Public License along with
# this program.  If not, see http://www.gnu.org/licenses/.  */


CC = gcc
CFLAGS = -std=gnu99 -O2 -g -Werror -W -Wall -Wno-unused-but-set-variable

all: factor make-prime-list

factor: factor.o

factor.o: factor.c primes.h

primes.h: make-prime-list
        ./make-prime-list 5000 >primes.h

%: %.c
.PRECIOUS: %.o

%.o: %.c
        $(CC) $(CFLAGS) -c $< -o $@

%: %.o
        $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@

clean:
        rm -f make-prime-list factor primes.h ourseq *.o

# Use make check CHECK_FLAGS=-s to check squfof
CHECK_FLAGS=

p = 1844674407370
q = 792281625142643375935438

args = $(word 2,$(subst -, ,$@)) $(word 3,$(subst -, ,$@))
tests = \
  t-0-10000000-a451244522b1b662c86cb3cbb55aee3e085a61a0 \
  t-10000000-20000000-c792a2e02f1c8536b5121f624b04039d20187016 \
  t-20000000-30000000-8115e8dff97d1674134ec054598d939a2a5f6113 \
  t-30000000-40000000-fe7b832c8e0ed55035152c0f9ebd59de73224a60 \
  t-40000000-50000000-b8786d66c432e48bc5b342ee3c6752b7f096f206 \
  t-50000000-60000000-a74fe518c5f79873c2b9016745b88b42c8fd3ede \
  t-60000000-70000000-689bc70d681791e5d1b8ac1316a05d0c4473d6db \
  t-70000000-80000000-d370808f2ab8c865f64c2ff909c5722db5b7d58d \
  t-80000000-90000000-7978aa66bf2bdb446398336ea6f02605e9a77581 \
  t-$(p)8551616-$(p)8651615-66c57cd58f4fb572df7f088d17e4f4c1d4f01bb1 \
  t-$(p)8551616-$(p)8651615-66c57cd58f4fb572df7f088d17e4f4c1d4f01bb1 \
  t-$(p)8651616-$(p)8751615-729228e693b1a568ecc85b199927424c7d16d410 \
  t-$(p)8751616-$(p)8851615-5a0c985017c2d285e4698f836f5a059e0b684563 \
  t-$(p)8851616-$(p)8951615-0482295c514e371c98ce9fd335deed0c9c44a4f4 \
  t-$(p)8951616-$(p)9051615-9c0e1105ac7c45e27e7bbeb5e213f530d2ad1a71 \
  t-$(p)9051616-$(p)9151615-604366d2b1d75371d0679e6a68962d66336cd383 \
  t-$(p)9151616-$(p)9251615-9192d2bdee930135b28d7160e6d395a7027871da \
  t-$(p)9251616-$(p)9351615-bcf56ae55d20d700690cff4d3327b78f83fc01bf \
  t-$(p)9351616-$(p)9451615-16b106398749e5f24d278ba7c58229ae43f650ac \
  t-$(p)9451616-$(p)9551615-ad2c6ed63525f8e7c83c4c416e7715fa1bebc54c \
  t-$(p)9551616-$(p)9651615-2b6f9c11742d9de045515a6627c27a042c49f8ba \
  t-$(p)9651616-$(p)9751615-54851acd51c4819beb666e26bc0100dc9adbc310 \
  t-$(p)9751616-$(p)9851615-6939c2a7afd2d81f45f818a159b7c5226f83a50b \
  t-$(p)9851616-$(p)9951615-0f2c8bc011d2a45e2afa01459391e68873363c6c \
  t-$(p)9951616-18446744073710051615-630dc2ad72f4c222bad1405e6c5bea590f92a98c \
  t-$(q)50336-$(q)60335-51ccb201e35599d545cb942e2bb31aba5bce4fc5

$(tests): factor ourseq
        @echo '$(lastword $(subst -, ,$@))  -' > exp.$@
        @echo $(args)
        @seq $(args) | ./factor $(CHECK_FLAGS) | shasum -c --status exp.$@
        @rm exp.$@

check: $(tests) factor ourseq

ver = `cat ver`
dist:
        mkdir nt-factor-$(ver)
        cp -pr factor.c ChangeLog README Makefile make-prime-list.c ourseq.c 
longlong.h tests nt-factor-$(ver)
        tar cf - nt-factor-$(ver) | lzip >nt-factor-$(ver).tar.lz
        rm -rf nt-factor-$(ver)
        ./incr ver

reply via email to

[Prev in Thread] Current Thread [Next in Thread]