1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/bin/sh
# autopkgtest check: run a class of apfloat-samples.jar to compute digits of
# Pi using 2 threads. We do not need to build anything on user's machine.
# (C) 2020 Pierre Gruet
# Author: Pierre Gruet <pgt@debian.org>
set -e
SOURCEDIR=$(pwd)
WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
# Create a file with the first 100 digits of Pi.
cat <<EOF > Pi100
3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067
EOF
# Getting the 100 first digits using apfloat, with 100 digits and
# Chudnovskys' binsplit, with radix 10.
java -cp /usr/share/java/apfloat-samples.jar org.apfloat.samples.PiParallel 100 0 10 2>&1 \
| tail -n 2 | head -n 1 > outPiChudnovsky
diff Pi100 outPiChudnovsky
if [ $? -ne 0 ]; then
exit 1
fi
|