0s autopkgtest [16:33:59]: starting date and time: 2025-03-15 16:33:59+0000 0s autopkgtest [16:33:59]: git checkout: 325255d2 Merge branch 'pin-any-arch' into 'ubuntu/production' 0s autopkgtest [16:33:59]: host juju-7f2275-prod-proposed-migration-environment-9; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.u91wua4i/out --timeout-copy=6000 --setup-commands 'ln -s /dev/null /etc/systemd/system/bluetooth.service; printf "http_proxy=http://squid.internal:3128\nhttps_proxy=http://squid.internal:3128\nno_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com,radosgw.ps5.canonical.com\n" >> /etc/environment' --apt-pocket=proposed=src:glibc --apt-upgrade r-cran-rmpfr --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=glibc/2.41-1ubuntu2 -- lxd -r lxd-armhf-10.145.243.158 lxd-armhf-10.145.243.158:autopkgtest/ubuntu/plucky/armhf 21s autopkgtest [16:34:20]: testbed dpkg architecture: armhf 23s autopkgtest [16:34:22]: testbed apt version: 2.9.33 27s autopkgtest [16:34:26]: @@@@@@@@@@@@@@@@@@@@ test bed setup 29s autopkgtest [16:34:28]: testbed release detected to be: None 36s autopkgtest [16:34:35]: updating testbed package index (apt update) 38s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [126 kB] 39s Get:2 http://ftpmaster.internal/ubuntu plucky InRelease [257 kB] 39s Get:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease [126 kB] 39s Get:4 http://ftpmaster.internal/ubuntu plucky-security InRelease [126 kB] 39s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [379 kB] 40s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [99.7 kB] 40s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.8 kB] 40s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf Packages [114 kB] 40s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf c-n-f Metadata [1832 B] 40s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/restricted armhf c-n-f Metadata [116 B] 40s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/universe armhf Packages [312 kB] 40s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/universe armhf c-n-f Metadata [11.1 kB] 40s Get:13 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse armhf Packages [3472 B] 40s Get:14 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse armhf c-n-f Metadata [240 B] 40s Get:15 http://ftpmaster.internal/ubuntu plucky/multiverse Sources [299 kB] 41s Get:16 http://ftpmaster.internal/ubuntu plucky/universe Sources [21.0 MB] 65s Get:17 http://ftpmaster.internal/ubuntu plucky/main Sources [1394 kB] 67s Get:18 http://ftpmaster.internal/ubuntu plucky/main armhf Packages [1378 kB] 68s Get:19 http://ftpmaster.internal/ubuntu plucky/main armhf c-n-f Metadata [29.4 kB] 68s Get:20 http://ftpmaster.internal/ubuntu plucky/restricted armhf c-n-f Metadata [108 B] 68s Get:21 http://ftpmaster.internal/ubuntu plucky/universe armhf Packages [15.1 MB] 86s Get:22 http://ftpmaster.internal/ubuntu plucky/multiverse armhf Packages [172 kB] 88s Fetched 41.0 MB in 49s (833 kB/s) 89s Reading package lists... 101s autopkgtest [16:35:40]: upgrading testbed (apt dist-upgrade and autopurge) 103s Reading package lists... 103s Building dependency tree... 103s Reading state information... 104s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 104s Starting 2 pkgProblemResolver with broken count: 0 104s Done 104s Entering ResolveByKeep 105s 105s Calculating upgrade... 105s The following packages will be upgraded: 105s libc-bin libc6 locales pinentry-curses python3-jinja2 sos strace 106s 7 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 106s Need to get 8683 kB of archives. 106s After this operation, 23.6 kB of additional disk space will be used. 106s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf libc6 armhf 2.41-1ubuntu2 [2932 kB] 110s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf libc-bin armhf 2.41-1ubuntu2 [545 kB] 111s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf locales all 2.41-1ubuntu2 [4246 kB] 118s Get:4 http://ftpmaster.internal/ubuntu plucky/main armhf strace armhf 6.13+ds-1ubuntu1 [445 kB] 119s Get:5 http://ftpmaster.internal/ubuntu plucky/main armhf pinentry-curses armhf 1.3.1-2ubuntu3 [40.6 kB] 119s Get:6 http://ftpmaster.internal/ubuntu plucky/main armhf python3-jinja2 all 3.1.5-2ubuntu1 [109 kB] 119s Get:7 http://ftpmaster.internal/ubuntu plucky/main armhf sos all 4.9.0-5 [365 kB] 120s Preconfiguring packages ... 120s Fetched 8683 kB in 14s (601 kB/s) 121s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 64655 files and directories currently installed.) 121s Preparing to unpack .../libc6_2.41-1ubuntu2_armhf.deb ... 121s Unpacking libc6:armhf (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 121s Setting up libc6:armhf (2.41-1ubuntu2) ... 121s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 64655 files and directories currently installed.) 121s Preparing to unpack .../libc-bin_2.41-1ubuntu2_armhf.deb ... 121s Unpacking libc-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 121s Setting up libc-bin (2.41-1ubuntu2) ... 121s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 64655 files and directories currently installed.) 121s Preparing to unpack .../locales_2.41-1ubuntu2_all.deb ... 121s Unpacking locales (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 122s Preparing to unpack .../strace_6.13+ds-1ubuntu1_armhf.deb ... 122s Unpacking strace (6.13+ds-1ubuntu1) over (6.11-0ubuntu1) ... 122s Preparing to unpack .../pinentry-curses_1.3.1-2ubuntu3_armhf.deb ... 122s Unpacking pinentry-curses (1.3.1-2ubuntu3) over (1.3.1-2ubuntu2) ... 122s Preparing to unpack .../python3-jinja2_3.1.5-2ubuntu1_all.deb ... 122s Unpacking python3-jinja2 (3.1.5-2ubuntu1) over (3.1.5-2) ... 122s Preparing to unpack .../archives/sos_4.9.0-5_all.deb ... 122s Unpacking sos (4.9.0-5) over (4.9.0-4) ... 122s Setting up sos (4.9.0-5) ... 123s Setting up pinentry-curses (1.3.1-2ubuntu3) ... 123s Setting up locales (2.41-1ubuntu2) ... 124s Generating locales (this might take a while)... 126s en_US.UTF-8... done 126s Generation complete. 126s Setting up python3-jinja2 (3.1.5-2ubuntu1) ... 126s Setting up strace (6.13+ds-1ubuntu1) ... 126s Processing triggers for man-db (2.13.0-1) ... 127s Processing triggers for systemd (257.3-1ubuntu3) ... 129s Reading package lists... 130s Building dependency tree... 130s Reading state information... 130s Starting pkgProblemResolver with broken count: 0 130s Starting 2 pkgProblemResolver with broken count: 0 130s Done 131s Solving dependencies... 131s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 133s autopkgtest [16:36:12]: rebooting testbed after setup commands that affected boot 172s autopkgtest [16:36:51]: testbed running kernel: Linux 6.8.0-52-generic #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 18:10:51 UTC 2 196s autopkgtest [16:37:15]: @@@@@@@@@@@@@@@@@@@@ apt-source r-cran-rmpfr 206s Get:1 http://ftpmaster.internal/ubuntu plucky/universe r-cran-rmpfr 0.9-5-1 (dsc) [2135 B] 206s Get:2 http://ftpmaster.internal/ubuntu plucky/universe r-cran-rmpfr 0.9-5-1 (tar) [608 kB] 206s Get:3 http://ftpmaster.internal/ubuntu plucky/universe r-cran-rmpfr 0.9-5-1 (diff) [2684 B] 206s gpgv: Signature made Thu Feb 1 16:01:12 2024 UTC 206s gpgv: using RSA key F1F007320A035541F0A663CA578A0494D1C646D1 206s gpgv: issuer "tille@debian.org" 206s gpgv: Can't check signature: No public key 206s dpkg-source: warning: cannot verify inline signature for ./r-cran-rmpfr_0.9-5-1.dsc: no acceptable signature found 207s autopkgtest [16:37:26]: testing package r-cran-rmpfr version 0.9-5-1 209s autopkgtest [16:37:28]: build not needed 212s autopkgtest [16:37:31]: test run-unit-test: preparing testbed 213s Reading package lists... 214s Building dependency tree... 214s Reading state information... 214s Starting pkgProblemResolver with broken count: 0 214s Starting 2 pkgProblemResolver with broken count: 0 214s Done 215s The following NEW packages will be installed: 215s fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono libblas3 215s libcairo2 libdatrie1 libdeflate0 libfontconfig1 libfreetype6 libgfortran5 215s libgomp1 libgraphite2-3 libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 215s libjpeg8 liblapack3 liblerc4 libpango-1.0-0 libpangocairo-1.0-0 215s libpangoft2-1.0-0 libpaper-utils libpaper2 libpixman-1-0 libsharpyuv0 libsm6 215s libtcl8.6 libthai-data libthai0 libtiff6 libtk8.6 libwebp7 libxcb-render0 215s libxcb-shm0 libxft2 libxrender1 libxss1 libxt6t64 r-base-core r-cran-gmp 215s r-cran-mass r-cran-polynom r-cran-rmpfr r-cran-sfsmisc unzip x11-common 215s xdg-utils zip 215s 0 upgraded, 50 newly installed, 0 to remove and 0 not upgraded. 215s Need to get 41.0 MB of archives. 215s After this operation, 75.0 MB of additional disk space will be used. 215s Get:1 http://ftpmaster.internal/ubuntu plucky/main armhf libfreetype6 armhf 2.13.3+dfsg-1 [330 kB] 216s Get:2 http://ftpmaster.internal/ubuntu plucky/main armhf fonts-dejavu-mono all 2.37-8 [502 kB] 216s Get:3 http://ftpmaster.internal/ubuntu plucky/main armhf fonts-dejavu-core all 2.37-8 [835 kB] 217s Get:4 http://ftpmaster.internal/ubuntu plucky/main armhf fontconfig-config armhf 2.15.0-2ubuntu1 [37.5 kB] 217s Get:5 http://ftpmaster.internal/ubuntu plucky/main armhf libfontconfig1 armhf 2.15.0-2ubuntu1 [114 kB] 217s Get:6 http://ftpmaster.internal/ubuntu plucky/main armhf fontconfig armhf 2.15.0-2ubuntu1 [190 kB] 217s Get:7 http://ftpmaster.internal/ubuntu plucky/main armhf libblas3 armhf 3.12.1-2 [132 kB] 218s Get:8 http://ftpmaster.internal/ubuntu plucky/main armhf libpixman-1-0 armhf 0.44.0-3 [183 kB] 218s Get:9 http://ftpmaster.internal/ubuntu plucky/main armhf libxcb-render0 armhf 1.17.0-2 [15.3 kB] 218s Get:10 http://ftpmaster.internal/ubuntu plucky/main armhf libxcb-shm0 armhf 1.17.0-2 [5774 B] 218s Get:11 http://ftpmaster.internal/ubuntu plucky/main armhf libxrender1 armhf 1:0.9.10-1.1build1 [16.0 kB] 218s Get:12 http://ftpmaster.internal/ubuntu plucky/main armhf libcairo2 armhf 1.18.2-2 [484 kB] 218s Get:13 http://ftpmaster.internal/ubuntu plucky/main armhf libdatrie1 armhf 0.2.13-3build1 [15.7 kB] 218s Get:14 http://ftpmaster.internal/ubuntu plucky/main armhf libdeflate0 armhf 1.23-1 [38.5 kB] 218s Get:15 http://ftpmaster.internal/ubuntu plucky/main armhf libgfortran5 armhf 15-20250222-0ubuntu1 [330 kB] 219s Get:16 http://ftpmaster.internal/ubuntu plucky/main armhf libgomp1 armhf 15-20250222-0ubuntu1 [128 kB] 219s Get:17 http://ftpmaster.internal/ubuntu plucky/main armhf libgraphite2-3 armhf 1.3.14-2ubuntu1 [64.8 kB] 219s Get:18 http://ftpmaster.internal/ubuntu plucky/main armhf libharfbuzz0b armhf 10.2.0-1 [464 kB] 220s Get:19 http://ftpmaster.internal/ubuntu plucky/main armhf x11-common all 1:7.7+23ubuntu3 [21.7 kB] 220s Get:20 http://ftpmaster.internal/ubuntu plucky/main armhf libice6 armhf 2:1.1.1-1 [36.5 kB] 220s Get:21 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg-turbo8 armhf 2.1.5-3ubuntu2 [127 kB] 220s Get:22 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg8 armhf 8c-2ubuntu11 [2148 B] 220s Get:23 http://ftpmaster.internal/ubuntu plucky/main armhf liblapack3 armhf 3.12.1-2 [2091 kB] 222s Get:24 http://ftpmaster.internal/ubuntu plucky/main armhf liblerc4 armhf 4.0.0+ds-5ubuntu1 [160 kB] 222s Get:25 http://ftpmaster.internal/ubuntu plucky/main armhf libthai-data all 0.1.29-2build1 [158 kB] 222s Get:26 http://ftpmaster.internal/ubuntu plucky/main armhf libthai0 armhf 0.1.29-2build1 [15.2 kB] 222s Get:27 http://ftpmaster.internal/ubuntu plucky/main armhf libpango-1.0-0 armhf 1.56.2-1 [216 kB] 223s Get:28 http://ftpmaster.internal/ubuntu plucky/main armhf libpangoft2-1.0-0 armhf 1.56.2-1 [43.6 kB] 223s Get:29 http://ftpmaster.internal/ubuntu plucky/main armhf libpangocairo-1.0-0 armhf 1.56.2-1 [25.1 kB] 223s Get:30 http://ftpmaster.internal/ubuntu plucky/main armhf libpaper2 armhf 2.2.5-0.3 [16.3 kB] 223s Get:31 http://ftpmaster.internal/ubuntu plucky/main armhf libpaper-utils armhf 2.2.5-0.3 [14.2 kB] 223s Get:32 http://ftpmaster.internal/ubuntu plucky/main armhf libsharpyuv0 armhf 1.5.0-0.1 [16.4 kB] 223s Get:33 http://ftpmaster.internal/ubuntu plucky/main armhf libsm6 armhf 2:1.2.4-1 [15.1 kB] 223s Get:34 http://ftpmaster.internal/ubuntu plucky/main armhf libtcl8.6 armhf 8.6.16+dfsg-1 [909 kB] 224s Get:35 http://ftpmaster.internal/ubuntu plucky/main armhf libjbig0 armhf 2.1-6.1ubuntu2 [24.9 kB] 224s Get:36 http://ftpmaster.internal/ubuntu plucky/main armhf libwebp7 armhf 1.5.0-0.1 [188 kB] 224s Get:37 http://ftpmaster.internal/ubuntu plucky/main armhf libtiff6 armhf 4.5.1+git230720-4ubuntu4 [179 kB] 225s Get:38 http://ftpmaster.internal/ubuntu plucky/main armhf libxft2 armhf 2.3.6-1build1 [37.4 kB] 225s Get:39 http://ftpmaster.internal/ubuntu plucky/main armhf libxss1 armhf 1:1.2.3-1build3 [6500 B] 225s Get:40 http://ftpmaster.internal/ubuntu plucky/main armhf libtk8.6 armhf 8.6.16-1 [686 kB] 225s Get:41 http://ftpmaster.internal/ubuntu plucky/main armhf libxt6t64 armhf 1:1.2.1-1.2build1 [145 kB] 226s Get:42 http://ftpmaster.internal/ubuntu plucky/main armhf zip armhf 3.0-14ubuntu2 [164 kB] 226s Get:43 http://ftpmaster.internal/ubuntu plucky/main armhf unzip armhf 6.0-28ubuntu6 [167 kB] 226s Get:44 http://ftpmaster.internal/ubuntu plucky/main armhf xdg-utils all 1.2.1-2ubuntu1 [66.0 kB] 226s Get:45 http://ftpmaster.internal/ubuntu plucky/universe armhf r-base-core armhf 4.4.3-1 [28.2 MB] 257s Get:46 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-gmp armhf 0.7-5-1 [299 kB] 257s Get:47 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-mass armhf 7.3-64-1 [1105 kB] 258s Get:48 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-polynom all 1.4-1+dfsg-1 [89.7 kB] 259s Get:49 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-rmpfr armhf 0.9-5-1 [1219 kB] 260s Get:50 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-sfsmisc all 1.1-20-1 [674 kB] 261s Preconfiguring packages ... 261s Fetched 41.0 MB in 45s (901 kB/s) 261s Selecting previously unselected package libfreetype6:armhf. 261s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 64655 files and directories currently installed.) 261s Preparing to unpack .../00-libfreetype6_2.13.3+dfsg-1_armhf.deb ... 261s Unpacking libfreetype6:armhf (2.13.3+dfsg-1) ... 261s Selecting previously unselected package fonts-dejavu-mono. 261s Preparing to unpack .../01-fonts-dejavu-mono_2.37-8_all.deb ... 261s Unpacking fonts-dejavu-mono (2.37-8) ... 261s Selecting previously unselected package fonts-dejavu-core. 261s Preparing to unpack .../02-fonts-dejavu-core_2.37-8_all.deb ... 261s Unpacking fonts-dejavu-core (2.37-8) ... 261s Selecting previously unselected package fontconfig-config. 261s Preparing to unpack .../03-fontconfig-config_2.15.0-2ubuntu1_armhf.deb ... 261s Unpacking fontconfig-config (2.15.0-2ubuntu1) ... 261s Selecting previously unselected package libfontconfig1:armhf. 261s Preparing to unpack .../04-libfontconfig1_2.15.0-2ubuntu1_armhf.deb ... 261s Unpacking libfontconfig1:armhf (2.15.0-2ubuntu1) ... 261s Selecting previously unselected package fontconfig. 261s Preparing to unpack .../05-fontconfig_2.15.0-2ubuntu1_armhf.deb ... 261s Unpacking fontconfig (2.15.0-2ubuntu1) ... 261s Selecting previously unselected package libblas3:armhf. 261s Preparing to unpack .../06-libblas3_3.12.1-2_armhf.deb ... 261s Unpacking libblas3:armhf (3.12.1-2) ... 261s Selecting previously unselected package libpixman-1-0:armhf. 261s Preparing to unpack .../07-libpixman-1-0_0.44.0-3_armhf.deb ... 261s Unpacking libpixman-1-0:armhf (0.44.0-3) ... 261s Selecting previously unselected package libxcb-render0:armhf. 261s Preparing to unpack .../08-libxcb-render0_1.17.0-2_armhf.deb ... 261s Unpacking libxcb-render0:armhf (1.17.0-2) ... 261s Selecting previously unselected package libxcb-shm0:armhf. 261s Preparing to unpack .../09-libxcb-shm0_1.17.0-2_armhf.deb ... 261s Unpacking libxcb-shm0:armhf (1.17.0-2) ... 262s Selecting previously unselected package libxrender1:armhf. 262s Preparing to unpack .../10-libxrender1_1%3a0.9.10-1.1build1_armhf.deb ... 262s Unpacking libxrender1:armhf (1:0.9.10-1.1build1) ... 262s Selecting previously unselected package libcairo2:armhf. 262s Preparing to unpack .../11-libcairo2_1.18.2-2_armhf.deb ... 262s Unpacking libcairo2:armhf (1.18.2-2) ... 262s Selecting previously unselected package libdatrie1:armhf. 262s Preparing to unpack .../12-libdatrie1_0.2.13-3build1_armhf.deb ... 262s Unpacking libdatrie1:armhf (0.2.13-3build1) ... 262s Selecting previously unselected package libdeflate0:armhf. 262s Preparing to unpack .../13-libdeflate0_1.23-1_armhf.deb ... 262s Unpacking libdeflate0:armhf (1.23-1) ... 262s Selecting previously unselected package libgfortran5:armhf. 262s Preparing to unpack .../14-libgfortran5_15-20250222-0ubuntu1_armhf.deb ... 262s Unpacking libgfortran5:armhf (15-20250222-0ubuntu1) ... 262s Selecting previously unselected package libgomp1:armhf. 262s Preparing to unpack .../15-libgomp1_15-20250222-0ubuntu1_armhf.deb ... 262s Unpacking libgomp1:armhf (15-20250222-0ubuntu1) ... 262s Selecting previously unselected package libgraphite2-3:armhf. 262s Preparing to unpack .../16-libgraphite2-3_1.3.14-2ubuntu1_armhf.deb ... 262s Unpacking libgraphite2-3:armhf (1.3.14-2ubuntu1) ... 262s Selecting previously unselected package libharfbuzz0b:armhf. 262s Preparing to unpack .../17-libharfbuzz0b_10.2.0-1_armhf.deb ... 262s Unpacking libharfbuzz0b:armhf (10.2.0-1) ... 262s Selecting previously unselected package x11-common. 262s Preparing to unpack .../18-x11-common_1%3a7.7+23ubuntu3_all.deb ... 262s Unpacking x11-common (1:7.7+23ubuntu3) ... 262s Selecting previously unselected package libice6:armhf. 262s Preparing to unpack .../19-libice6_2%3a1.1.1-1_armhf.deb ... 262s Unpacking libice6:armhf (2:1.1.1-1) ... 262s Selecting previously unselected package libjpeg-turbo8:armhf. 262s Preparing to unpack .../20-libjpeg-turbo8_2.1.5-3ubuntu2_armhf.deb ... 262s Unpacking libjpeg-turbo8:armhf (2.1.5-3ubuntu2) ... 262s Selecting previously unselected package libjpeg8:armhf. 262s Preparing to unpack .../21-libjpeg8_8c-2ubuntu11_armhf.deb ... 262s Unpacking libjpeg8:armhf (8c-2ubuntu11) ... 262s Selecting previously unselected package liblapack3:armhf. 262s Preparing to unpack .../22-liblapack3_3.12.1-2_armhf.deb ... 262s Unpacking liblapack3:armhf (3.12.1-2) ... 262s Selecting previously unselected package liblerc4:armhf. 262s Preparing to unpack .../23-liblerc4_4.0.0+ds-5ubuntu1_armhf.deb ... 262s Unpacking liblerc4:armhf (4.0.0+ds-5ubuntu1) ... 262s Selecting previously unselected package libthai-data. 262s Preparing to unpack .../24-libthai-data_0.1.29-2build1_all.deb ... 262s Unpacking libthai-data (0.1.29-2build1) ... 262s Selecting previously unselected package libthai0:armhf. 262s Preparing to unpack .../25-libthai0_0.1.29-2build1_armhf.deb ... 262s Unpacking libthai0:armhf (0.1.29-2build1) ... 262s Selecting previously unselected package libpango-1.0-0:armhf. 262s Preparing to unpack .../26-libpango-1.0-0_1.56.2-1_armhf.deb ... 262s Unpacking libpango-1.0-0:armhf (1.56.2-1) ... 262s Selecting previously unselected package libpangoft2-1.0-0:armhf. 262s Preparing to unpack .../27-libpangoft2-1.0-0_1.56.2-1_armhf.deb ... 262s Unpacking libpangoft2-1.0-0:armhf (1.56.2-1) ... 262s Selecting previously unselected package libpangocairo-1.0-0:armhf. 262s Preparing to unpack .../28-libpangocairo-1.0-0_1.56.2-1_armhf.deb ... 262s Unpacking libpangocairo-1.0-0:armhf (1.56.2-1) ... 262s Selecting previously unselected package libpaper2:armhf. 262s Preparing to unpack .../29-libpaper2_2.2.5-0.3_armhf.deb ... 262s Unpacking libpaper2:armhf (2.2.5-0.3) ... 262s Selecting previously unselected package libpaper-utils. 262s Preparing to unpack .../30-libpaper-utils_2.2.5-0.3_armhf.deb ... 262s Unpacking libpaper-utils (2.2.5-0.3) ... 262s Selecting previously unselected package libsharpyuv0:armhf. 262s Preparing to unpack .../31-libsharpyuv0_1.5.0-0.1_armhf.deb ... 262s Unpacking libsharpyuv0:armhf (1.5.0-0.1) ... 262s Selecting previously unselected package libsm6:armhf. 262s Preparing to unpack .../32-libsm6_2%3a1.2.4-1_armhf.deb ... 262s Unpacking libsm6:armhf (2:1.2.4-1) ... 262s Selecting previously unselected package libtcl8.6:armhf. 262s Preparing to unpack .../33-libtcl8.6_8.6.16+dfsg-1_armhf.deb ... 262s Unpacking libtcl8.6:armhf (8.6.16+dfsg-1) ... 262s Selecting previously unselected package libjbig0:armhf. 262s Preparing to unpack .../34-libjbig0_2.1-6.1ubuntu2_armhf.deb ... 262s Unpacking libjbig0:armhf (2.1-6.1ubuntu2) ... 262s Selecting previously unselected package libwebp7:armhf. 262s Preparing to unpack .../35-libwebp7_1.5.0-0.1_armhf.deb ... 262s Unpacking libwebp7:armhf (1.5.0-0.1) ... 262s Selecting previously unselected package libtiff6:armhf. 262s Preparing to unpack .../36-libtiff6_4.5.1+git230720-4ubuntu4_armhf.deb ... 262s Unpacking libtiff6:armhf (4.5.1+git230720-4ubuntu4) ... 262s Selecting previously unselected package libxft2:armhf. 262s Preparing to unpack .../37-libxft2_2.3.6-1build1_armhf.deb ... 262s Unpacking libxft2:armhf (2.3.6-1build1) ... 263s Selecting previously unselected package libxss1:armhf. 263s Preparing to unpack .../38-libxss1_1%3a1.2.3-1build3_armhf.deb ... 263s Unpacking libxss1:armhf (1:1.2.3-1build3) ... 263s Selecting previously unselected package libtk8.6:armhf. 263s Preparing to unpack .../39-libtk8.6_8.6.16-1_armhf.deb ... 263s Unpacking libtk8.6:armhf (8.6.16-1) ... 263s Selecting previously unselected package libxt6t64:armhf. 263s Preparing to unpack .../40-libxt6t64_1%3a1.2.1-1.2build1_armhf.deb ... 263s Unpacking libxt6t64:armhf (1:1.2.1-1.2build1) ... 263s Selecting previously unselected package zip. 263s Preparing to unpack .../41-zip_3.0-14ubuntu2_armhf.deb ... 263s Unpacking zip (3.0-14ubuntu2) ... 263s Selecting previously unselected package unzip. 263s Preparing to unpack .../42-unzip_6.0-28ubuntu6_armhf.deb ... 263s Unpacking unzip (6.0-28ubuntu6) ... 263s Selecting previously unselected package xdg-utils. 263s Preparing to unpack .../43-xdg-utils_1.2.1-2ubuntu1_all.deb ... 263s Unpacking xdg-utils (1.2.1-2ubuntu1) ... 263s Selecting previously unselected package r-base-core. 263s Preparing to unpack .../44-r-base-core_4.4.3-1_armhf.deb ... 263s Unpacking r-base-core (4.4.3-1) ... 263s Selecting previously unselected package r-cran-gmp. 263s Preparing to unpack .../45-r-cran-gmp_0.7-5-1_armhf.deb ... 263s Unpacking r-cran-gmp (0.7-5-1) ... 263s Selecting previously unselected package r-cran-mass. 263s Preparing to unpack .../46-r-cran-mass_7.3-64-1_armhf.deb ... 263s Unpacking r-cran-mass (7.3-64-1) ... 263s Selecting previously unselected package r-cran-polynom. 263s Preparing to unpack .../47-r-cran-polynom_1.4-1+dfsg-1_all.deb ... 263s Unpacking r-cran-polynom (1.4-1+dfsg-1) ... 263s Selecting previously unselected package r-cran-rmpfr. 263s Preparing to unpack .../48-r-cran-rmpfr_0.9-5-1_armhf.deb ... 263s Unpacking r-cran-rmpfr (0.9-5-1) ... 263s Selecting previously unselected package r-cran-sfsmisc. 263s Preparing to unpack .../49-r-cran-sfsmisc_1.1-20-1_all.deb ... 263s Unpacking r-cran-sfsmisc (1.1-20-1) ... 263s Setting up libgraphite2-3:armhf (1.3.14-2ubuntu1) ... 263s Setting up libpixman-1-0:armhf (0.44.0-3) ... 263s Setting up libsharpyuv0:armhf (1.5.0-0.1) ... 263s Setting up liblerc4:armhf (4.0.0+ds-5ubuntu1) ... 263s Setting up libxrender1:armhf (1:0.9.10-1.1build1) ... 263s Setting up libdatrie1:armhf (0.2.13-3build1) ... 263s Setting up libxcb-render0:armhf (1.17.0-2) ... 263s Setting up unzip (6.0-28ubuntu6) ... 263s Setting up x11-common (1:7.7+23ubuntu3) ... 264s Setting up libdeflate0:armhf (1.23-1) ... 264s Setting up libxcb-shm0:armhf (1.17.0-2) ... 264s Setting up libgomp1:armhf (15-20250222-0ubuntu1) ... 264s Setting up libjbig0:armhf (2.1-6.1ubuntu2) ... 264s Setting up zip (3.0-14ubuntu2) ... 264s Setting up libblas3:armhf (3.12.1-2) ... 264s update-alternatives: using /usr/lib/arm-linux-gnueabihf/blas/libblas.so.3 to provide /usr/lib/arm-linux-gnueabihf/libblas.so.3 (libblas.so.3-arm-linux-gnueabihf) in auto mode 264s Setting up libfreetype6:armhf (2.13.3+dfsg-1) ... 264s Setting up fonts-dejavu-mono (2.37-8) ... 264s Setting up libtcl8.6:armhf (8.6.16+dfsg-1) ... 264s Setting up fonts-dejavu-core (2.37-8) ... 264s Setting up libjpeg-turbo8:armhf (2.1.5-3ubuntu2) ... 264s Setting up libgfortran5:armhf (15-20250222-0ubuntu1) ... 264s Setting up libwebp7:armhf (1.5.0-0.1) ... 264s Setting up libharfbuzz0b:armhf (10.2.0-1) ... 264s Setting up libthai-data (0.1.29-2build1) ... 264s Setting up libxss1:armhf (1:1.2.3-1build3) ... 264s Setting up libpaper2:armhf (2.2.5-0.3) ... 264s Setting up xdg-utils (1.2.1-2ubuntu1) ... 264s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 264s Setting up libjpeg8:armhf (8c-2ubuntu11) ... 264s Setting up libice6:armhf (2:1.1.1-1) ... 264s Setting up liblapack3:armhf (3.12.1-2) ... 264s update-alternatives: using /usr/lib/arm-linux-gnueabihf/lapack/liblapack.so.3 to provide /usr/lib/arm-linux-gnueabihf/liblapack.so.3 (liblapack.so.3-arm-linux-gnueabihf) in auto mode 264s Setting up fontconfig-config (2.15.0-2ubuntu1) ... 264s Setting up libpaper-utils (2.2.5-0.3) ... 264s Setting up libthai0:armhf (0.1.29-2build1) ... 264s Setting up libtiff6:armhf (4.5.1+git230720-4ubuntu4) ... 264s Setting up libfontconfig1:armhf (2.15.0-2ubuntu1) ... 264s Setting up libsm6:armhf (2:1.2.4-1) ... 264s Setting up fontconfig (2.15.0-2ubuntu1) ... 266s Regenerating fonts cache... done. 266s Setting up libxft2:armhf (2.3.6-1build1) ... 266s Setting up libtk8.6:armhf (8.6.16-1) ... 266s Setting up libpango-1.0-0:armhf (1.56.2-1) ... 266s Setting up libcairo2:armhf (1.18.2-2) ... 266s Setting up libxt6t64:armhf (1:1.2.1-1.2build1) ... 266s Setting up libpangoft2-1.0-0:armhf (1.56.2-1) ... 266s Setting up libpangocairo-1.0-0:armhf (1.56.2-1) ... 266s Setting up r-base-core (4.4.3-1) ... 266s Creating config file /etc/R/Renviron with new version 267s Setting up r-cran-polynom (1.4-1+dfsg-1) ... 267s Setting up r-cran-gmp (0.7-5-1) ... 267s Setting up r-cran-sfsmisc (1.1-20-1) ... 267s Setting up r-cran-mass (7.3-64-1) ... 267s Setting up r-cran-rmpfr (0.9-5-1) ... 267s Processing triggers for libc-bin (2.41-1ubuntu2) ... 267s Processing triggers for man-db (2.13.0-1) ... 267s Processing triggers for install-info (7.1.1-1) ... 275s autopkgtest [16:38:34]: test run-unit-test: [----------------------- 277s BEGIN TEST arith-ex.R 277s 277s R version 4.4.3 (2025-02-28) -- "Trophy Case" 277s Copyright (C) 2025 The R Foundation for Statistical Computing 277s Platform: arm-unknown-linux-gnueabihf (32-bit) 277s 277s R is free software and comes with ABSOLUTELY NO WARRANTY. 277s You are welcome to redistribute it under certain conditions. 277s Type 'license()' or 'licence()' for distribution details. 277s 277s R is a collaborative project with many contributors. 277s Type 'contributors()' for more information and 277s 'citation()' on how to cite R or R packages in publications. 277s 277s Type 'demo()' for some demos, 'help()' for on-line help, or 277s 'help.start()' for an HTML browser interface to help. 277s Type 'q()' to quit R. 277s 277s > require("Rmpfr") 277s Loading required package: Rmpfr 277s Loading required package: gmp 277s 277s Attaching package: ‘gmp’ 277s 277s The following objects are masked from ‘package:base’: 277s 277s %*%, apply, crossprod, matrix, tcrossprod 277s 278s C code of R package 'Rmpfr': GMP using 32 bits per limb 278s 278s 278s Attaching package: ‘Rmpfr’ 278s 278s The following object is masked from ‘package:gmp’: 278s 278s outer 278s 278s The following objects are masked from ‘package:stats’: 278s 278s dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm 278s 278s The following objects are masked from ‘package:base’: 278s 278s cbind, pmax, pmin, rbind 278s 278s > ## includes ("gmp")# want to check "mixed arithmetic" too __ TODO __ 278s > 278s > `%=N=%` <- function(x,y) (x == y) | (is.na(x) & is.na(y)) 278s > all.EQ <- function(x,y, tolerance = 2^-98, ...) # very small tol. for MPFR 278s + all.equal(x, y, tolerance=tolerance, ...) 278s > warningI <- function(...) warning(..., immediate. = TRUE) 278s > 278s > unlist(.Platform) 278s OS.type file.sep dynlib.ext GUI endian pkgType path.sep 278s "unix" "/" ".so" "X11" "little" "source" ":" 278s r_arch 278s "" 278s > 278s > ## Check that we got the "which.*" methods also from "bigq": 278s > bcl <- c("ANY", "bigq", "bigz", "mpfr") 278s > ##if(packageVersion("gmp") >= "0.5-8") { 278s > stopifnot(identical(bcl, 278s + sort(unlist(findMethods("which.max")@signatures))), 278s + identical(bcl, 278s + sort(unlist(findMethods("which.min")@signatures)))) 278s > ##} 278s > 278s > options(warn = 1)# warnings *immediately* 278s > (doExtras <- Rmpfr:::doExtras()) 278s [1] FALSE 278s > eps2 <- 2 * .Machine$double.eps 278s > eps8 <- 8 * .Machine$double.eps 278s > eps32 <- 32 * .Machine$double.eps 278s > 278s > ## must take the *larger* of the two precisions: 278s > stopifnot(substr(format(mpfr(1, 60)/mpfr(7, 160)), 1,51) == # format() may show more digits 278s + "0.1428571428571428571428571428571428571428571428571")# again has extra "2" at end 278s > 278s > (x <- mpfr(0:7, 100) / 7) 278s 8 'mpfr' numbers of precision 100 bits 278s [1] 0 0.14285714285714285714285714285711 278s [3] 0.28571428571428571428571428571423 0.42857142857142857142857142857154 278s [5] 0.57142857142857142857142857142846 0.71428571428571428571428571428538 278s [7] 0.85714285714285714285714285714308 1 278s > ix <- x^-1000 278s > iX <- asNumeric(ix) 278s > 278s > stopifnot( mpfrIs0(x - x), # badly failed on 64-bit 278s + identical(-x, 0-x),# testing "- x" 278s + all.equal(ix, (1/x)^1000, tol= 1e-25), 278s + is.numeric(iX), iX[1:4] == Inf, # failed previously as we used RNDD (downward rounding) 278s + all.equal(log(iX[5:8]), c(559.6157879, 336.4722366, 154.1506798, 0), 278s + tol = 1e-9)) 278s > 278s > ## checking hexadecimal input : 278s > stopifnot(mpfr("0xFFFFFFFFFFFFFFFFFFFF", base=16) + 1 == 2^80, 278s + ## sign(0) == 0: 278s + identical(sign(as(-1:1, "mpfr")), -1:1 + 0)) 278s > 278s > stopifnot(all.equal(as.numeric(x+ 1L), 278s + as.numeric(x)+1L, tol = eps2), 278s + as.integer( x [x < 1]) == 0,# was *wrong* {we round()ed; previously "down"!} 278s + as.integer((-x)[x < 1]) == 0,# (ditto) 278s + (3 * x)/3 <= x, 278s + all.equal(as.numeric(x * 2L), 278s + as.numeric(x + x), tol = 0)) 278s > 278s > u <- mpfr(0:17, 128)/17 278s > two <- mpfr(2,100) 278s > stopifnot(all.EQ(u ^ two, u ^ 2), 278s + identical(u ^ 2, u ^ 2L), 278s + all.EQ(two ^ u, 2 ^ u), 278s + identical(2 ^ u, 2L ^ u), 278s + floor (3*u) == floor (3/17*(0:17)), 278s + ceiling(u*5) == ceiling(5/17*(0:17)) 278s + ) 278s > 278s > i7 <- mpfr(0:7, 200)/ 7 278s > i17 <- mpfr(0:17, 300)/17 278s > stopifnot(all.equal(as.numeric(x+1), 278s + as.numeric(x)+1), 278s + all.equal(round(x,2), round(asNumeric(x), 2), tol=1e-15), 278s + all.equal(round(mpfr(1.152, 80), 2), 1.15), # was wrong {as.integer() bug} 278s + all.equal(0:7, 7 * round ( i7, 25), tol = 2e-25), 278s + all.equal(0:7, 7 * round ( i7, 50), tol = 2e-50), 278s + all.equal(0:17, 17 * signif(i17,100), tol = 2e-100), 278s + all.equal(0:17, 17 * signif(i17, 20), tol = 2e-20) 278s + ) 278s > 278s > ## When we compute with 100 bits, 278s > ## we should compare relative errors with 2^-100 : 278s > del <- abs((x+pi)-pi - x) / 2^-100 278s > stopifnot(del <= 4) ## <= 2 already 278s > (fd <- format(del, drop0 = TRUE)) 278s [1] "0" "1.75" "0.5" "1" "1" "1" "2" "0" 278s > stopifnot(all.equal(as.numeric(del), 278s + as.numeric(fd), tol = 1e-15)) 278s > if(print(Sys.info()[["machine"]]) == "x86_64") 278s + stopifnot(fd %in% as.character(c(0:2, c(2,7)/4))) 278s [1] "armv7l" 278s > 278s > 278s > checkPmin <- function(x, nx = as(x, "numeric")) { 278s + rx <- if(is(x,"mpfr")) round(x, 25) else x 278s + isZ <- is(x, "bigz") || is(nx, "bigz") 278s + M.X <- max(x, na.rm=TRUE) 278s + m.x <- min(x, na.rm=TRUE) 278s + stopifnot(all.equal(x, nx), 278s + pmin(x, x, M.X) %=N=% x, x %=N=% pmax(x, m.x, x), 278s + all.equal(x, pmin(x, nx, x, M.X)), 278s + all.equal(x, pmax(m.x, nx, x, rx, m.x)), 278s + if(isZ)TRUE else all.equal(pmin(x, 0.75), pmin(nx, 0.75)), 278s + if(isZ)TRUE else all.equal(pmax(x, 0.25), pmax(nx, 0.25))) 278s + } 278s > 278s > x <- mpfr(0:7, 100) / 7 278s > checkPmin(x) 278s > 278s > nx <- (0:7)/7 278s > (qx <- as.bigq(0:7, 7)) 278s Big Rational ('bigq') object of length 8: 278s [1] 0 1/7 2/7 3/7 4/7 5/7 6/7 1 278s > x[c(2,5)] <- NA 278s > nx[c(2,5)] <- NA 278s > qx[c(2,5)] <- NA 278s > 278s > Z <- as.bigz(1:7) 278s > mZ <- mpfr(Z, 64) 278s > stopifnot(Z == mZ, mZ == Z) 278s > 278s > checkPmin(x, nx) 279s > cat("checking pmin(. bigq ): ") 279s checking pmin(. bigq ): > ## FIXME checkPmin(x, qx); cat("[Ok]\n") 279s > ## 279s > print( base::pmin(Z, Z, max(Z)) )# via gmp:: rep.bigz(x, length.out = *) 279s Big Integer ('bigz') object of length 7: 279s [1] 1 2 3 4 5 6 7 279s > cat("checking pmin(. bigz ) 279s + [currently with lots of pmin() and pmax(...) warnings 'incompatible methods]:\n ") 279s checking pmin(. bigz ) 279s [currently with lots of pmin() and pmax(...) warnings 'incompatible methods]: 279s > checkPmin(Z); cat("[Ok]\n") # via gmp:: all.equal.bigz() 279s [Ok] 279s > 279s > stopifnot(all.equal( round(x, 10), round(nx, 10)), 279s + all.equal(signif(x, 10), signif(nx, 10))) 279s > 279s > ## L & x , x & L failed in Rmpfr 0.2* and 0.4-2 279s > stopifnot(identical(L <- x > 0.5, L & x), 279s + identical(L, x & L), 279s + identical(x > 0, x | L)) 279s > 279s > ## Summary() methods {including NA 279s > stopifnot(exprs = { 279s + is.na(min(x)) 279s + is.na(max(x)) 279s + is.na(range(x)) 279s + is.na(sum(x)) 279s + is.na(prod(x)) 279s + min(x, na.rm=TRUE) == 0 279s + max(x, na.rm=TRUE) == 1 279s + range(x, na.rm=TRUE) == 0:1 279s + all.equal(sum (x, na.rm=TRUE)*7, 2+3+5+6+7, tolerance = 1e-28) # 1.0975e-30 279s + prod(x, na.rm=TRUE) == 0 279s + all.equal(180, prod(x[-1], na.rm=TRUE)*7^4, tol = 1e-15) # 1.579e-16 279s + ## 279s + ## all(), any() had memory bug [PROTECT missing, but more, somehow] 279s + !all(x) 279s + is.na( all(x[-1]) ) 279s + any(x) 279s + is.na(any(x[c(2,5)])) 279s + ## do these *twice* {that triggered R-forge bug #6764 } 279s + ! all(x, na.rm=TRUE) 279s + any(x, na.rm=TRUE) 279s + ## 279s + ! all(x, na.rm=TRUE) 279s + any(x, na.rm=TRUE) 279s + }) 279s > 279s > ##-------------- Modulo and "integer division" ------------- 279s > 279s > ## R's ?Arithmetic : 279s > ## 279s > ## ‘%%’ indicates ‘x mod y’ and ‘%/%’ indicates integer division. It 279s > ## is guaranteed that ‘x == (x %% y) + y * ( x %/% y )’ (up to 279s > ## rounding error) unless ‘y == 0’ where the result of ‘%%’ is 279s > ## ‘NA_integer_’ or ‘NaN’ (depending on the ‘typeof’ of the 279s > ## arguments). 279s > ## 279s > ## and has 'details' about how non-integer 'y' works 279s > ## 279s > (N <- if(doExtras) 1000 else 200) 279s [1] 200 279s > (todays.seed <- eval(parse(text=Sys.Date())))# so this is reproducible 279s [1] 20162 279s > # (and constant within one day) 279s > set.seed(todays.seed) 279s > mm <- c(-4:4, sample(50, N-9, replace=TRUE)) 279s > for(n in seq_len(N)) { 279s + cat("."); if(n %% 50 == 0) cat(n,"\n") 279s + m <- mm[n] 279s + prec <- sample(52:200, 1)# "high precision" ==> can use small tol 279s + x <- sample(100, 50) - 20 279s + for(kind in c('int','real')) { 279s + if(kind == "real") { 279s + m <- jitter(m) 279s + x <- jitter(x) 279s + tol.1 <- eps32 * pmax(1, 1/abs(m)) 279s + EQ <- function(x,y, tol = tol.1) 279s + isTRUE(all.equal(x, as.numeric(y), tol=tol)) 279s + EQ2 <- function(x,y, tol = tol.1) { 279s + ## for the DIV - MOD identity, a small x leads to cancellation 279s + all((x %=N=% y) | abs(x - y) < tol*pmax(abs(x), 1)) || 279s + isTRUE(all.equal(x, as.numeric(y), tol=tol)) 279s + } 279s + } else { ## "integer" 279s + EQ2 <- EQ <- function(x,y, tol) all(x %=N=% y) 279s + } 279s + i.m <- mpfr(x, prec) %% mpfr(m, prec) 279s + if(!EQ2(x %% m, i.m)) { 279s + cat("\n -- m = ",m," (prec = ",prec,")\n") 279s + rE <- range(rel.E <- as.numeric(1 - (x %% m)/i.m)) 279s + print(cbind(x, 'R.%%' = x %% m, rel.E)) 279s + MSG <- if(max(abs(rE)) < 1e-10) warningI else stop 279s + MSG(sprintf("not all equal: range(rel.Err.) = [%g, %g]", rE[1],rE[2])) 279s + } 279s + ## 279s + if(m != 0) { 279s + ##---Check the x == (x %% m) + m * ( x %/% m ) assertion ------ 279s + ## 279s + if(EQ2(x, (x %% m) + m*( x %/% m ), tol = 1e-12)) { ## ok for R 279s + ## --> also ok for mpfr ? 279s + iDm <- mpfr(x, prec) %/% mpfr(m, prec) 279s + rhs <- i.m + m*iDm 279s + if(!EQ2(x, i.m + m*iDm)) { 279s + cat("\n -- m = ",m," (prec = ",prec,")\n") 279s + print(cbind(x,' MPFR[ x%%m + m(x %/% m) ]' = as.numeric(rhs), rel.E)) 279s + MSG <- if(max(abs(rE)) < 1e-10) warningI else stop 279s + MSG(sprintf("Identity(MOD - DIV) not all eq.: range(rel.Err.) = [%g, %g]", 279s + rE[1],rE[2])) 279s + } 279s + } else { 279s + cat("\n hmm.. the basic %% <-> %/% assertion 'fails' in *R* :\n") 279s + rhs <- (x %% m) + m * ( x %/% m ) 279s + rel.E <- (1 - rhs/x) 279s + print(cbind(x, 'x%%m + m(x %/% m)' = rhs, rel.E)) 279s + } 279s + } 279s + } 279s + } 280s ..................................................50 280s ..................................................100 281s ..................................................150 282s ..................................................200 282s > 282s > ## mpfr o now implemented, for '%%', too : 282s > r <- as.double(i <- -10:20) 282s > 282s > stopifnot( 282s + ## %% ------------------------------------- 282s + mpfr(i, prec=99) %% 7 == i %% 7 282s + , ## 282s + mpfr(i, prec=99) %% 7 == 282s + mpfr(i, prec=99) %% 7L 282s + , ## 282s + i %% mpfr(27, prec=99) == i %% 27 282s + , ## 282s + r %% mpfr(27, prec=99) == r %% 27 282s + , ## %/% ------------------------------------- 282s + mpfr(i, prec=99) %/% 7 == i %/% 7 282s + , ## 282s + mpfr(i, prec=99) %/% 7 == 282s + mpfr(i, prec=99) %/% 7L 282s + , ## 282s + mpfr(i, prec=99) %/% mpfr(27, prec=99) == i %/% 27 282s + , ## 282s + i %/% mpfr(27, prec=99) == i %/% 27 282s + , ## 282s + i %/% mpfr(27, prec=99) == 282s + r %/% mpfr(27, prec=99) 282s + , TRUE ## 282s + ) 282s > 282s > cat('Time elapsed: ', proc.time(),'\n') # "stats" 282s Time elapsed: 5.394 0.103 5.489 0 0.005 282s > 282s > ## Was reproducible BUG in Rmpfr-addition (on Linux, MPFR 4.x.y) -- ## but the bug was Rmpfr, 282s > ## in ../src/Ops.c, detecting if *integer*, i.e., long can be used 282s > dn <- 1e20 282s > dOO <- 9223372036854775808; formatC(dOO) # "9.2...e18" 282s [1] "9.223e+18" 282s > (r <- dn / (dn + dOO)) # 0.915555 (double prec arithmetic) 282s [1] 0.915555 282s > ## but *so* strange when switching to Rmpfr : addition accidentally *subtract*!! 282s > n <- mpfr(dn, precBits = 99) 282s > (rM <- n / (n + dOO)) # wrongly gave " 1 'mpfr' .... 99 bits; 1.101605140483951..... 282s 1 'mpfr' number of precision 99 bits 282s [1] 0.9155549598510603146342174205907 282s > stopifnot(exprs = { 282s + all.equal(n + dOO, dn + dOO) 282s + all.equal(n / (n + dOO), r) 282s + }) 282s > 282s > ## log(., base) : 282s > (ten40 <- as.bigz(10)^40) 282s Big Integer ('bigz') : 282s [1] 10000000000000000000000000000000000000000 282s > ten40m <- mpfr(ten40) 282s > (lt40 <- log(ten40m, 10)) # gave Error in ... : base != exp(1) is not yet implemented 282s 1 'mpfr' number of precision 133 bits 282s [1] 40 282s > ## 'mpfr' .. 133 bits \\ [1] 40 282s > stopifnot(exprs = { 282s + grepl("^40[.]000+$", print(format(lt40, digits = 60))) 282s + identical(lt40, log10(ten40m)) 282s + identical(log(ten40m, 2), log2(ten40m)) 282s + inherits(Pi <- Const("pi", 140), "mpfr") 282s + all.equal(show(log(ten40m, Pi)), 282s + log(ten40m)/log(Pi), tol = 1e-40) 282s + }) 282s [1] "40.0000000000000000000000000000000000000000000000000000000000" 282s 1 'mpfr' number of precision 133 bits 282s [1] 80.45863470352243755058888189154834786778 282s > 282s > 282s > 282s > ###------Standard Statistics Functions -------------------------------------------------------- 282s > 282s > x <- c(del, 1000) 282s > stopifnot(identical(mean(x), mean(x, trim=0))) 282s > for(tr in (0:8)/16) 282s + stopifnot(all.equal(mean( x, trim = tr), 282s + mean(asNumeric(x), trim = tr), tol=1e-15)) 282s > 282s > cat('Time elapsed: ', proc.time(),'\n') # "stats" 282s Time elapsed: 5.491 0.103 5.585 0 0.005 282s > 282s BEGIN TEST binomial-etc.R 282s 282s R version 4.4.3 (2025-02-28) -- "Trophy Case" 282s Copyright (C) 2025 The R Foundation for Statistical Computing 282s Platform: arm-unknown-linux-gnueabihf (32-bit) 282s 282s R is free software and comes with ABSOLUTELY NO WARRANTY. 282s You are welcome to redistribute it under certain conditions. 282s Type 'license()' or 'licence()' for distribution details. 282s 282s R is a collaborative project with many contributors. 282s Type 'contributors()' for more information and 282s 'citation()' on how to cite R or R packages in publications. 282s 282s Type 'demo()' for some demos, 'help()' for on-line help, or 282s 'help.start()' for an HTML browser interface to help. 282s Type 'q()' to quit R. 282s 282s > stopifnot(require("Rmpfr")) 282s Loading required package: Rmpfr 282s Loading required package: gmp 282s 282s Attaching package: ‘gmp’ 282s 282s The following objects are masked from ‘package:base’: 282s 282s %*%, apply, crossprod, matrix, tcrossprod 282s 283s C code of R package 'Rmpfr': GMP using 32 bits per limb 283s 283s 283s Attaching package: ‘Rmpfr’ 283s 283s The following object is masked from ‘package:gmp’: 283s 283s outer 283s 283s The following objects are masked from ‘package:stats’: 283s 283s dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm 283s 283s The following objects are masked from ‘package:base’: 283s 283s cbind, pmax, pmin, rbind 283s 283s > 283s > n <- 10000 + 0:10 283s > stopifnot(exprs = { 283s + chooseMpfr(1:10, 0) == 1 # failed earlier 283s + chooseMpfr(20, 0:20) == choose(20, 0:20) 283s + chooseMpfr(19, 0:20) == choose(19, 0:20) 283s + chooseMpfr (30, 4:30) * (-1)^(4:30) == 283s + chooseMpfr.all(30, k0=4, alternating=TRUE) 283s + chooseMpfr(mpfr(1111, 2^8), 1111) == 1 283s + chooseMpfr(mpfr(n,256), n ) == 1 # was wrong in <= 2023 283s + chooseMpfr(mpfr(n,256), n-1) == n # " " 283s + }) 283s > cat('Time elapsed: ', proc.time(),'\n') # "stats" 283s Time elapsed: 0.586 0.033 0.616 0 0.005 283s > 283s > ## sumBinomMpfr() ... had embarrasing bug for a while 283s > sBn <- Rmpfr:::sumBinomMpfr.v1 283s > stopifnot( 283s + all.equal( sBn(10, sqrt), 283s + sumBinomMpfr(10, sqrt), tol=1e-77) , 283s + all.equal( sBn(10, log, n0=1, alternating=FALSE), 283s + sumBinomMpfr(10, log, n0=1, alternating=FALSE), tol=1e-77) 283s + ) 283s > 283s > fBin <- function(k) x^k * (1-x)^(n-k) 283s > ## \sum_{k=0}^n (n \\ k) x^k (1-x)^{n-k} == sum(dbinom(0:n, n, prob=x)) == 1 : 283s > for(x in runif(50)) { 283s + n <- 1 + rpois(1, lambda=10) 283s + cat(".") 283s + stopifnot(all.equal(1, sumBinomMpfr(n, fBin, alternating=FALSE), 283s + tol = 1e-15)) 283s + };cat("\n") 283s .................................................. 283s > 283s > 283s > cat('Time elapsed: ', proc.time(),'\n') # "stats" 283s Time elapsed: 1.022 0.047 1.067 0 0.005 283s > 283s > if(!interactive()) warnings() 283s > 283s BEGIN TEST bit-repr.R 283s 283s R version 4.4.3 (2025-02-28) -- "Trophy Case" 283s Copyright (C) 2025 The R Foundation for Statistical Computing 283s Platform: arm-unknown-linux-gnueabihf (32-bit) 283s 283s R is free software and comes with ABSOLUTELY NO WARRANTY. 283s You are welcome to redistribute it under certain conditions. 283s Type 'license()' or 'licence()' for distribution details. 283s 283s R is a collaborative project with many contributors. 283s Type 'contributors()' for more information and 283s 'citation()' on how to cite R or R packages in publications. 283s 283s Type 'demo()' for some demos, 'help()' for on-line help, or 283s 'help.start()' for an HTML browser interface to help. 283s Type 'q()' to quit R. 283s 284s > stopifnot(suppressPackageStartupMessages(require("Rmpfr"))) 284s > ## (checking that the 32 / 64 bit GMP message does *not* show here) 284s > 284s > ### Try to look at the internal bit-representation of the limbs 284s > 284s > .limbs <- function(x) { 284s + stopifnot(is(x, "mpfr")) 284s + lapply(x@.Data, slot, "d") # not sapply() each can have different prec. & #{limbs} 284s + } 284s > .expo <- function(x) { 284s + stopifnot(is(x, "mpfr")) 284s + sapply(x@.Data, slot, "exp") 284s + } 284s > 284s > Bits <- function(x) { 284s + L <- .limbs(x)# list(length n) each of "k(prec)" 32-bit ints 284s + ## NB: mpfr(2, .) and all mpfr(2^k, .) also have a 'd' ending in NA integer! 284s + ## [reason: after all, R's NA_integer_ is INT_MAX+1 = 2^31 ] 284s + ## and the mpfr(c(NA,NaN, Inf, -Inf), .) have *no* NA in 'd' (but all in 'exp'! 284s + ## see .mpfr2list() example below 284s + 284s + hasNA <- any(iNA <- sapply(lapply(L, is.na), any)) # iNA: TRUE if there's an NA 284s + ## need to catch them later 284s + CC <- function(ch) paste(ch, collapse="") 284s + hex <- sapply(L, function(.) CC(sprintf("%x", rev(.)))) 284s + if(hasNA) hex[iNA] <- NA_character_ 284s + hex <- strsplit(hex, NULL) 284s + 284s + db <- t(expand.grid(0:1,0:1,0:1,0:1, KEEP.OUT.ATTRS=FALSE)[,4:1]) 284s + storage.mode(db) <- "character" # "0" or "1" 284s + dimnames(db) <- list(NULL, c(paste(0:9), letters[1:6])) 284s + ## db is 4 x 16 matrix with col.names "0" "1" .. "9" "a" "b" ... "f" 284s + 284s + ex <- .expo(x) 284s + if(is.matrix(ex)) { 284s + ## 64-bit case: exponent is long == two ints 284s + ## ----------- the 2nd int is in {0, -1, NA} (NA : for 0) 284s + ex2 <- ex[2,] 284s + ex <- ex[1,] 284s + } 284s + pat <- paste("(", sapply(pmax(0, ex), 284s + function(n) CC(rep.int(".", n))), 284s + ")0+$", sep="") 284s + ## pat <- ifelse(iNA, NA_character_, pat) 284s + 284s + getbits <- function(ch) CC(as.vector(db[,ch])) 284s + 284s + ## drop trailing zeros (from r[[i]], via pat[i]), keeping correct number: 284s + drop0.r <- function(i) sub(pat[i], "\\1", r[[i]]) 284s + 284s + if(hasNA) { 284s + r <- as.list(iNA) 284s + r[!iNA] <- lapply(hex[!iNA], getbits) 284s + r[!iNA] <- lapply(which(!iNA), drop0.r) 284s + ## FIXME this is wrong -- really have powers of 2, and want their (easy) bits : 284s + r[iNA ] <- NA_character_ 284s + unlist(r) 284s + } 284s + else { 284s + r <- lapply(hex, getbits) 284s + sapply(seq_along(r), drop0.r) 284s + } 284s + 284s + } 284s > 284s > x <- mpfr(r <- c(NA,NaN, Inf, -Inf), 64) 284s > stopifnot(identical(asNumeric(x), # mpfr has no NA, just NaN's: 284s + c(NaN,NaN, Inf, -Inf)), 284s + identical(as.character(fDec <- formatDec(x)), 284s + as.character(asNumeric(x))) # of different nchar() for now 284s + ) 284s > formatDec(x) # should print fine (no quotes) 284s [1] NaN NaN Inf -Inf 284s > 284s > 284s > if(FALSE) # platform dependent: 284s + ## The "non-finite" mpfr value internals (in 64-bit: 'exp' has NA): 284s + str(.mpfr2list(x)) 284s > 284s > 284s > ## bug in Bits(): all (exact) powers of 2 will show as NA: 284s > 284s > x <- mpfr(c(3:5,11:16, 59, 125:128, 1024:1025), 64) 284s > x 284s 16 'mpfr' numbers of precision 64 bits 284s [1] 3 4 5 11 12 13 14 15 16 59 125 126 127 128 1024 284s [16] 1025 284s > data.frame(x= as.numeric(x), I(Bits(x))) 284s x Bits.x. 284s 1 3 11 284s 2 4 284s 3 5 101 284s 4 11 1011 284s 5 12 1100 284s 6 13 1101 284s 7 14 1110 284s 8 15 1111 284s 9 16 284s 10 59 111011 284s 11 125 1111101 284s 12 126 1111110 284s 13 127 1111111 284s 14 128 284s 15 1024 284s 16 1025 10000000001 284s > 284s > x <- mpfr(c(-20:-1, 1:30),64)# w/o 0 - as its mantissa is "random" (in 64-bit) 284s > data.frame(x= as.numeric(x), I(Bits(x))) 284s x Bits.x. 284s 1 -20 10100 284s 2 -19 10011 284s 3 -18 10010 284s 4 -17 10001 284s 5 -16 284s 6 -15 1111 284s 7 -14 1110 284s 8 -13 1101 284s 9 -12 1100 284s 10 -11 1011 284s 11 -10 1010 284s 12 -9 1001 284s 13 -8 284s 14 -7 111 284s 15 -6 110 284s 16 -5 101 284s 17 -4 284s 18 -3 11 284s 19 -2 284s 20 -1 284s 21 1 284s 22 2 284s 23 3 11 284s 24 4 284s 25 5 101 284s 26 6 110 284s 27 7 111 284s 28 8 284s 29 9 1001 284s 30 10 1010 284s 31 11 1011 284s 32 12 1100 284s 33 13 1101 284s 34 14 1110 284s 35 15 1111 284s 36 16 284s 37 17 10001 284s 38 18 10010 284s 39 19 10011 284s 40 20 10100 284s 41 21 10101 284s 42 22 10110 284s 43 23 10111 284s 44 24 11000 284s 45 25 11001 284s 46 26 11010 284s 47 27 11011 284s 48 28 11100 284s 49 29 11101 284s 50 30 11110 284s > b0 <- Bits(mpfr(0, 64)) # not printing it here -- they are "random" for this special case! 284s > 284s > (half <- mpfr(0.5, 64)*(1 + mpfr(2, 64)^-16 * (-3:3))) 284s 7 'mpfr' numbers of precision 64 bits 284s [1] 0.49997711181640625 0.4999847412109375 0.49999237060546875 284s [4] 0.5 0.50000762939453125 0.5000152587890625 284s [7] 0.50002288818359375 284s > Bits(half) 284s [1] "1111111111111101" "111111111111111" "1111111111111111" 284s [4] NA "10000000000000001" "1000000000000001" 284s [7] "10000000000000011" 284s > 284s > ## pi, in varying number of bits : 284s > p. <- round(pi* 2^c(10,16,5*(4:8))) 284s > dput(p.)#-> the definition of p : 284s c(3217, 205887, 3294199, 105414357, 3373259426, 107944301636, 284s 3454217652358) 284s > p <- mpfr(c(3217, 205887, 3294199, 105414357, 284s + 3373259426, 107944301636, 3454217652358), 64) 284s > stopifnot(all.equal(p., p, tolerance = 1e-15)) 284s > ## all the mantissas are those of pi, rounded differently: 284s > Bits(c(p, Const("pi", 64))) 284s [1] "110010010001" 284s [2] "110010010000111111" 284s [3] "1100100100001111110111" 284s [4] "110010010000111111011010101" 284s [5] "11001001000011111101101010100010" 284s [6] "1100100100001111110110101010001000100" 284s [7] "110010010000111111011010101000100010000110" 284s [8] "1100100100001111110110101010001000100001011010001100001000110101" 284s > 284s > ###--- and possibly the _internal_ sprintfMpfr() --- see also ./tstHexBin.R 284s > ## TODO: use examples above for checking formatBin() <---> ============ 284s > spr <- Rmpfr:::sprintfMpfr 284s > ##= ~~~~~~~~~~~ 284s > (fB.04 <- formatBin(i16.04 <- mpfr(0:16, 4))) 284s [1] +0b0.000p+0 +0b1.000p+0 +0b1.000p+1 +0b1.100p+1 +0b1.000p+2 +0b1.010p+2 284s [7] +0b1.100p+2 +0b1.110p+2 +0b1.000p+3 +0b1.001p+3 +0b1.010p+3 +0b1.011p+3 284s [13] +0b1.100p+3 +0b1.101p+3 +0b1.110p+3 +0b1.111p+3 +0b1.000p+4 284s > (fB.60 <- formatBin(i16.60 <- mpfr(0:16, 60))) 284s [1] +0b0.00000000000000000000000000000000000000000000000000000000000p+0 284s [2] +0b1.00000000000000000000000000000000000000000000000000000000000p+0 284s [3] +0b1.00000000000000000000000000000000000000000000000000000000000p+1 284s [4] +0b1.10000000000000000000000000000000000000000000000000000000000p+1 284s [5] +0b1.00000000000000000000000000000000000000000000000000000000000p+2 284s [6] +0b1.01000000000000000000000000000000000000000000000000000000000p+2 284s [7] +0b1.10000000000000000000000000000000000000000000000000000000000p+2 284s [8] +0b1.11000000000000000000000000000000000000000000000000000000000p+2 284s [9] +0b1.00000000000000000000000000000000000000000000000000000000000p+3 284s [10] +0b1.00100000000000000000000000000000000000000000000000000000000p+3 284s [11] +0b1.01000000000000000000000000000000000000000000000000000000000p+3 284s [12] +0b1.01100000000000000000000000000000000000000000000000000000000p+3 284s [13] +0b1.10000000000000000000000000000000000000000000000000000000000p+3 284s [14] +0b1.10100000000000000000000000000000000000000000000000000000000p+3 284s [15] +0b1.11000000000000000000000000000000000000000000000000000000000p+3 284s [16] +0b1.11100000000000000000000000000000000000000000000000000000000p+3 284s [17] +0b1.00000000000000000000000000000000000000000000000000000000000p+4 284s > stopifnot( 284s + identical(sub("00p","p", spr(i16.60, bits = 10)), 284s + spr(i16.60, bits = 4)), 284s + identical(spr(i16.60, bits = 4), 284s + spr(i16.04, bits = 4)) 284s + , 284s + all.equal(i16.04, mpfr(fB.04), tolerance = 0) 284s + , 284s + all.equal(i16.60, mpfr(fB.60), tolerance = 0) 284s + ) 284s > 284s > ## not even this one 284s > two <- mpfr(2, precBits = 60) 284s > stopifnot(identical(two, mpfr(formatBin(two)))) 284s > 284s > 284s > cat('Time elapsed: ', proc.time(),'\n') # "stats" 284s Time elapsed: 0.862 0.048 0.907 0.001 0.008 284s > 284s > if(!interactive()) warnings() 284s > 284s BEGIN TEST create.R 284s 284s R version 4.4.3 (2025-02-28) -- "Trophy Case" 284s Copyright (C) 2025 The R Foundation for Statistical Computing 284s Platform: arm-unknown-linux-gnueabihf (32-bit) 284s 284s R is free software and comes with ABSOLUTELY NO WARRANTY. 284s You are welcome to redistribute it under certain conditions. 284s Type 'license()' or 'licence()' for distribution details. 284s 284s R is a collaborative project with many contributors. 284s Type 'contributors()' for more information and 284s 'citation()' on how to cite R or R packages in publications. 284s 284s Type 'demo()' for some demos, 'help()' for on-line help, or 284s 'help.start()' for an HTML browser interface to help. 284s Type 'q()' to quit R. 284s 284s > require("Rmpfr") 284s Loading required package: Rmpfr 284s Loading required package: gmp 285s 285s Attaching package: ‘gmp’ 285s 285s The following objects are masked from ‘package:base’: 285s 285s %*%, apply, crossprod, matrix, tcrossprod 285s 285s C code of R package 'Rmpfr': GMP using 32 bits per limb 285s 285s 285s Attaching package: ‘Rmpfr’ 285s 285s The following object is masked from ‘package:gmp’: 285s 285s outer 285s 285s > 285s > ### Simple basic examples of creation of "mpfr" objects 285s > 285s > pi. <- Const("pi", prec = 260) 285s The following objects are masked from ‘package:stats’: 285s 285s dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm 285s 285s The following objects are masked from ‘package:base’: 285s 285s cbind, pmax, pmin, rbind 285s 285s > pi. # nicely prints 80 digits [260 * log10(2) ~= 78.3 ~ 80] 285s 1 'mpfr' number of precision 260 bits 285s [1] 3.1415926535897932384626433832795028841971693993751058209749445923078164062862088 285s > 285s > ## These both failed (in mpfr2str(.)) with a seg.fault: 285s > c(mpfr(1, prec=3), pi.) 285s 2 'mpfr' numbers of precision 3 .. 260 bits 285s [1] 1 285s [2] 3.1415926535897932384626433832795028841971693993751058209749445923078164062862088 285s > m0 <- mpfr(numeric(), prec=64) 285s > ## print()ing / str() of 0-length mpfr 285s > stopifnot( 285s + grepl("0 'mpfr' numbers", capture.output( m0)), 285s + grepl("0 'mpfr' numbers", capture.output(str(m0)))) 285s Warning message: 285s In mpfr.is.0(Zero) : 'mpfr.is.0' is deprecated. 285s Use 'mpfrIs0' instead. 285s See help("Deprecated") 285s Warning message: 285s In mpfr.is.integer(Zero) : 'mpfr.is.integer' is deprecated. 285s Use '.mpfr.is.whole' instead. 285s See help("Deprecated") 285s > 285s > c(m0,m0) # failed in Rmpfr <= 0.6-0 285s 0 'mpfr' numbers 285s > stopifnot(identical(c(m0,m0), m0), 285s + identical(c(m0,pi.), pi.), 285s + identical(c(pi.,m0), pi.)) 285s > 285s > ## This is TRUE for 0 and -0 : 285s > Zero <- mpfr(c(0,1/-Inf), 20) 285s > stopifnot(mpfrIs0(Zero), is.whole(Zero)) 285s > stopifnot(mpfr.is.0(Zero))# deprecated but must work 285s > stopifnot(mpfr.is.integer(Zero))# deprecated but must work 285s > Zero # the "-0" should print correctly 285s 2 'mpfr' numbers of precision 20 bits 285s [1] 0 -0 285s > stopifnot(.getSign(Zero) == c(1,-1), 285s + sign(Zero) == 0, 285s + identical(format(Zero, digits=1), c("0.", "-0."))) 285s > 285s > ## testing 'recycling' 285s > b <- c(20,120,80, 60) 285s > (x <- mpfr(2^-(5:7), precBits = b)) 285s 4 'mpfr' numbers of precision 20 .. 120 bits 285s [1] 0.03125 0.015625 0.0078125 0.03125 285s > 285s > d.spec <- c(0,NA,NaN,Inf,-Inf) 285s > (spec <- mpfr(d.spec, 3)) 285s 5 'mpfr' numbers of precision 3 bits 285s [1] 0 NaN NaN Inf -Inf 285s > stopifnot(length(x) == 4, x[1] == x[4], getPrec(x) == b, 285s + identical(is.na(spec), is.na(d.spec)), 285s + identical(is.finite(spec), is.finite(d.spec)), 285s + identical(is.infinite(spec), is.infinite(d.spec)), 285s + ## mpfr(, .) : 285s + identical(x, mpfr(x, getPrec(x))), 285s + identical(spec, mpfr(spec, getPrec(spec))), 285s + asNumeric(1/mpfr(x, 16)) == 2^c(5:7,5), 285s + identical(format(spec), c("0.", "NaN", "NaN", "Inf", "-Inf")), 285s + mpfr(0.2, prec = 5:15, rnd.mode = "D") < 0.2) 285s > 285s > B.set <- setNames(2:62, paste0("B=",2:62)) 285s > str(lapply(B.set, function(B) format(spec, base= B)))# "0.0" and "0.00" -- FIXME 285s List of 61 285s $ B=2 : chr [1:5] "0.0" "NaN" "NaN" "Inf" ... 285s $ B=3 :base = 2, digits = 1 is increased to digits = 2 285s base = 4, digits = 1 is increased to digits = 2 285s base = 8, digits = 1 is increased to digits = 2 285s base = 16, digits = 1 is increased to digits = 2 285s base = 32, digits = 1 is increased to digits = 2 285s chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=4 : chr [1:5] "0.0" "NaN" "NaN" "Inf" ... 285s $ B=5 : chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=6 : chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=7 : chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=8 : chr [1:5] "0.0" "NaN" "NaN" "Inf" ... 285s $ B=9 : chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=10: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=11: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=12: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=13: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=14: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=15: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=16: chr [1:5] "0.0" "NaN" "NaN" "Inf" ... 285s $ B=17: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=18: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=19: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=20: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=21: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=22: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=23: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=24: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=25: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=26: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=27: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=28: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=29: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=30: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=31: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=32: chr [1:5] "0.0" "NaN" "NaN" "Inf" ... 285s $ B=33: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=34: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=35: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=36: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=37: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=38: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=39: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=40: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=41: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=42: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=43: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=44: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=45: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=46: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=47: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=48: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=49: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=50: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=51: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=52: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=53: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=54: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=55: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=56: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=57: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=58: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=59: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=60: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=61: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s $ B=62: chr [1:5] "0." "NaN" "NaN" "Inf" ... 285s > 285s > t2 <- mpfr(2^10,3) 285s > ## digits = 1 used to crash: MPFR assertion failed: m >= 2 || ((((b) & ((b) - 1)) == 0) == 0 && m >= 1) 285s > ## ---------- (+ seg.fault) for 'base = 2' (and others, not for default base = 10), 285s > ## digits = NULL should choose "enough" ... but does not 285s > str(r <- lapply(B.set, function(B) .mpfr2str(t2, digits=1, base = B))) 285s List of 61 285s $ B=2 :List of 4 285s ..$ str : chr "10" 285s ..$ exp : int 11 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=3 :List of 4 285s ..$ str : chr "1" 285s ..$ exp : int 7 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=4 :List of 4 285s ..$ str : chr "10" 285s ..$ exp : int 6 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=5 :List of 4 285s ..$ str : chr "2" 285s ..$ exp : int 5 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=6 :List of 4 285s ..$ str : chr "5" 285s ..$ exp : int 4 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=7 :List of 4 285s ..$ str : chr "3" 285s ..$ exp : int 4 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=8 :List of 4 285s ..$ str : chr "20" 285s ..$ exp : int 4 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=9 :List of 4 285s ..$ str : chr "1" 285s ..$ exp : int 4 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=10:List of 4 285s ..$ str : chr "1" 285s ..$ exp : int 4 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=11:List of 4 285s ..$ str : chr "8" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=12:List of 4 285s ..$ str : chr "7" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=13:List of 4 285s ..$ str : chr "6" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=14:List of 4 285s ..$ str : chr "5" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=15:List of 4 285s ..$ str : chr "5" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=16:List of 4 285s ..$ str : chr "40" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=17:List of 4 285s ..$ str : chr "4" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=18:List of 4 285s ..$ str : chr "3" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=19:List of 4 285s ..$ str : chr "3" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=20:List of 4 285s ..$ str : chr "3" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=21:List of 4 285s ..$ str : chr "2" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=22:List of 4 285s ..$ str : chr "2" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=23:List of 4 285s ..$ str : chr "2" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=24:List of 4 285s ..$ str : chr "2" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=25:List of 4 285s ..$ str : chr "2" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=26:List of 4 285s ..$ str : chr "2" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=27:List of 4 285s ..$ str : chr "1" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=28:List of 4 285s ..$ str : chr "1" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=29:List of 4 285s ..$ str : chr "1" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=30:List of 4 285s ..$ str : chr "1" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=31:List of 4 285s ..$ str : chr "1" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=32:List of 4 285s ..$ str : chr "10" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=33:List of 4 285s ..$ str : chr "v" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=34:List of 4 285s ..$ str : chr "u" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=35:List of 4 285s ..$ str : chr "t" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=36:List of 4 285s ..$ str : chr "s" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=37:List of 4 285s ..$ str : chr "S" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=38:List of 4 285s ..$ str : chr "R" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=39:List of 4 285s ..$ str : chr "Q" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=40:List of 4 285s ..$ str : chr "Q" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=41:List of 4 285s ..$ str : chr "P" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=42:List of 4 285s ..$ str : chr "O" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=43:List of 4 285s ..$ str : chr "O" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=44:List of 4 285s ..$ str : chr "N" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=45:List of 4 285s ..$ str : chr "N" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=46:List of 4 285s ..$ str : chr "M" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=47:List of 4 285s ..$ str : chr "M" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=48:List of 4 285s ..$ str : chr "L" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=49:List of 4 285s ..$ str : chr "L" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=50:List of 4 285s ..$ str : chr "K" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=51:List of 4 285s ..$ str : chr "K" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=52:List of 4 285s ..$ str : chr "K" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=53:List of 4 285s ..$ str : chr "J" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=54:List of 4 285s ..$ str : chr "J" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=55:List of 4 285s ..$ str : chr "J" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=56:List of 4 285s ..$ str : chr "I" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=57:List of 4 285s ..$ str : chr "I" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=58:List of 4 285s ..$ str : chr "I" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=59:List of 4 285s ..$ str : chr "H" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=60:List of 4 285s ..$ str : chr "H" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=61:List of 4 285s ..$ str : chr "H" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=62:List of 4 285s ..$ str : chr "H" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s > str(r. <- lapply(B.set, function(B) .mpfr2str(t2, base = B))) 285s List of 61 285s $ B=2 :List of 4 285s ..$ str : chr "100" 285s ..$ exp : int 11 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=3 :List of 4 285s ..$ str : chr "111" 285s ..$ exp : int 7 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=4 :List of 4 285s ..$ str : chr "10" 285s ..$ exp : int 6 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=5 :List of 4 285s ..$ str : chr "131" 285s ..$ exp : int 5 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=6 :List of 4 285s ..$ str : chr "443" 285s ..$ exp : int 4 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=7 :List of 4 285s ..$ str : chr "266" 285s ..$ exp : int 4 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=8 :List of 4 285s ..$ str : chr "20" 285s ..$ exp : int 4 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=9 :List of 4 285s ..$ str : chr "14" 285s ..$ exp : int 4 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=10:List of 4 285s ..$ str : chr "10" 285s ..$ exp : int 4 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=11:List of 4 285s ..$ str : chr "85" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=12:List of 4 285s ..$ str : chr "71" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=13:List of 4 285s ..$ str : chr "61" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=14:List of 4 285s ..$ str : chr "53" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=15:List of 4 285s ..$ str : chr "48" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=16:List of 4 285s ..$ str : chr "40" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=17:List of 4 285s ..$ str : chr "39" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=18:List of 4 285s ..$ str : chr "33" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=19:List of 4 285s ..$ str : chr "2g" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=20:List of 4 285s ..$ str : chr "2b" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=21:List of 4 285s ..$ str : chr "27" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=22:List of 4 285s ..$ str : chr "23" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=23:List of 4 285s ..$ str : chr "1m" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=24:List of 4 285s ..$ str : chr "1j" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=25:List of 4 285s ..$ str : chr "1g" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=26:List of 4 285s ..$ str : chr "1d" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=27:List of 4 285s ..$ str : chr "1b" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=28:List of 4 285s ..$ str : chr "19" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=29:List of 4 285s ..$ str : chr "16" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=30:List of 4 285s ..$ str : chr "14" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=31:List of 4 285s ..$ str : chr "12" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=32:List of 4 285s ..$ str : chr "10" 285s ..$ exp : int 3 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=33:List of 4 285s ..$ str : chr "v1" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=34:List of 4 285s ..$ str : chr "u4" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=35:List of 4 285s ..$ str : chr "t9" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=36:List of 4 285s ..$ str : chr "sg" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=37:List of 4 285s ..$ str : chr "RP" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=38:List of 4 285s ..$ str : chr "Qa" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=39:List of 4 285s ..$ str : chr "QA" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=40:List of 4 285s ..$ str : chr "PO" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=41:List of 4 285s ..$ str : chr "Oe" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=42:List of 4 285s ..$ str : chr "OG" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=43:List of 4 285s ..$ str : chr "NZ" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=44:List of 4 285s ..$ str : chr "NC" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=45:List of 4 285s ..$ str : chr "MY" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=46:List of 4 285s ..$ str : chr "MC" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=47:List of 4 285s ..$ str : chr "Lb" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=48:List of 4 285s ..$ str : chr "LG" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=49:List of 4 285s ..$ str : chr "Ki" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=50:List of 4 285s ..$ str : chr "KO" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=51:List of 4 285s ..$ str : chr "K4" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=52:List of 4 285s ..$ str : chr "Ja" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=53:List of 4 285s ..$ str : chr "JH" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=54:List of 4 285s ..$ str : chr "Iq" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=55:List of 4 285s ..$ str : chr "IY" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=56:List of 4 285s ..$ str : chr "IG" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=57:List of 4 285s ..$ str : chr "Ht" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=58:List of 4 285s ..$ str : chr "Hc" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=59:List of 4 285s ..$ str : chr "HL" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=60:List of 4 285s ..$ str : chr "H4" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=61:List of 4 285s ..$ str : chr "Gm" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s $ B=62:List of 4 285s ..$ str : chr "GW" 285s ..$ exp : int 2 285s ..$ finite: logi TRUE 285s ..$ is.0 : logi FALSE 285s > ## FIXME: still too short 285s > 285s > x <- c(-12, 1:3 * pi) 285s > sss <- mpfr(x, 100) 285s > validObject(sss) 285s [1] TRUE 285s > sss 285s 4 'mpfr' numbers of precision 100 bits 285s [1] -12 3.1415926535897931159979634685442 285s [3] 6.2831853071795862319959269370884 9.4247779607693793479938904056326 285s > sss2 <- sss * sss 285s > stopifnot(identical(sss2, sss * x), 285s + identical(sss2, x * sss), 285s + sss ^ 2 == sss2) 285s > ## and go back {not sure if identical() is guaranteed here, but it seems...}: 285s > stopifnot(identical(x, as(sss, "numeric"))) 285s > 285s > (cs <- as(sss, "character")) 285s [1] "-12" "3.1415926535897931159979634685442" 285s [3] "6.2831853071795862319959269370884" "9.4247779607693793479938904056326" 285s > 285s > y <- c(0, 100,-10, 1.25, -2.5, 285s + x * c(1,100,1e5,1e20), 285s + x / 100^(1:4)) 285s > (Y <- mpfr(y, 100)) 285s 13 'mpfr' numbers of precision 100 bits 285s [1] 0 100 285s [3] -10 1.25 285s [5] -2.5 -12 285s [7] 314.15926535897932581065106205642 628318.53071795857977122068405151 285s [9] 942477796076937936896 -0.11999999999999999555910790149937 285s [11] 0.00031415926535897930899771113288921 6.2831853071795866542926731201923e-6 285s [13] 9.4247779607693799284994504768947e-8 285s > cbind(y, as.data.frame(.mpfr2str(Y, 20))[,c("exp","str")]) 285s y exp str 285s 1 0.000000e+00 0 00000000000000000000 285s 2 1.000000e+02 3 10000000000000000000 285s 3 -1.000000e+01 2 -10000000000000000000 285s 4 1.250000e+00 1 12500000000000000000 285s 5 -2.500000e+00 1 -25000000000000000000 285s 6 -1.200000e+01 2 -12000000000000000000 285s 7 3.141593e+02 3 31415926535897932581 285s 8 6.283185e+05 6 62831853071795857977 285s 9 9.424778e+20 21 94247779607693793690 285s 10 -1.200000e-01 0 -11999999999999999556 285s 11 3.141593e-04 -3 31415926535897930900 285s 12 6.283185e-06 -5 62831853071795866543 285s 13 9.424778e-08 -7 94247779607693799285 285s > 285s > s <- mpfr(43208, 14)# low precision 285s > eps8 <- 8 * .Machine$double.eps 285s > ## checking mpfr -> character -> mpfr: 285s > i1..5f <- c("4.e+4", "4.3e+4", "4.32e+4", "43210.", "43208.") 285s > stopifnot(exprs = { 285s + all.equal(y, as.numeric(format(Y, digits=20)), tol= eps8) 285s + all.equal(Y, as(format(Y), "mpfr"), tol= eps8) 285s + identical(sapply(1:5, formatMpfr, x=s), i1..5f) 285s + identical(sapply(1:5, formatMpfr, x=s, exponent.plus=FALSE), 285s + sub("e[+]", "e", i1..5f)) 285s + }) 285s > 285s > 285s > ## More character -> mpfr checking : 285s > ## from echo 'scale=200; 4*a(1)' | bc -l : 285s > cpi <- "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196" 285s > pi. <- Const("pi", prec=667) 285s > stopifnot(cpi == format(mpfr(cpi, prec=667), digits=201), 285s + all.equal(pi., as(cpi, "mpfr")), 285s + all.equal(pi., as(cpi, "mpfr"), tol = 1e-200)) 285s > 285s > set.seed(17) 285s > ## Check double -> mpfr -> character -> double : 285s > ## Unfortunately, format(, .) -> .mpfr2str() triggers a memory bug 285s > ## that I think is an MPFR library "mis-feature" 285s > ## 2011-02-09 -- bug *no longer* triggered ! 285s > rSign <- function(n) sample(c(-1,1), size = n, replace=TRUE) 285s > N <- function(x) as.numeric(x) 285s > ntry <- if(Sys.getenv("USER") == "maechler") 150 else 5 285s > for(n in 1:ntry) { 285s + cat(if(n %% 10)"." else n) 285s + x. <- rSign(100) * rlnorm(100) 285s + prec <- rpois(1, 110); digs <- floor(0.95*(prec / log2(10))) 285s + X. <- mpfr(x., precBits = prec) 285s + stopifnot(all.equal(x., N(format(X., digits=digs)), tol = eps8) 285s + , all.equal(x., N(log(exp(X.))), tol = 32*eps8) 285s + ) 285s + }; cat("\n") 285s ..... 285s > 285s > stopifnot(identical(mpfr.is.0(X.),# deprecated but must work 285s + mpfrIs0 (X.))) 285s > X. <- X.[!mpfrIs0(X.)] 285s > stopifnot(all( X./X. == 1)) # TRUE 285s Warning message: 285s In mpfr.is.0(X.) : 'mpfr.is.0' is deprecated. 285s Use 'mpfrIs0' instead. 285s See help("Deprecated") 285s > 285s > u <- mpfr(as.raw(0:100)) 285s > z <- mpfr(1:12, 200) 285s > z[z > 100] <- 100 # nothing done (but used to fail) 285s > z[] <- 0 285s > stopifnot(0:100 == u, is(z,"mpfr"), mpfrIs0(z), 286s + all.equal(u, mpfr(0:100, prec = 8), tol = 0), 286s + 0:1 == mpfr(1:2 %% 2 == 0)) 286s > z[3] <- Const("pi",200) 286s > ## z has length 12 -- now extend it: 286s > z[15:17] <- 1/mpfr(10:12, 100) 286s > stopifnot(all.equal(z[1:4], c(0,0,pi,0), tol = 1e-15), validObject(z), 286s + all.equal(z[13:17], c(NaN,NaN, 1/(10:12)), tol = 1e-15)) 286s > 286s > ## These seg.faulted (each via different R -> C interface) in the past: 286s > assertError <- tools::assertError 286s > assertError( pp <- Const("pi", prec = 1e11) ) 286s > assertError( mpfr("123.456", precBits= 1e11) ) 286s > assertError( mpfr(as.bigz(3), precBits= 1e11) ) 286s > 286s > stopifnot(identical(mpfr(NULL), mpfr(logical()))) 286s > 286s > ## mpfr --> bigInteger "bigz" 286s > Pi <- Const("pi", prec = 300) 286s > twoP <- mpfr(2, 100)^(-2:80) 286s > m <- Pi * twoP 286s > L <- mpfr(2, 256)^1000 286s > stopifnot(exprs = { 286s + .mpfr2bigz(Pi) == 3 286s + .mpfr2bigz(twoP) == as.bigz(c(0,0, 2^(0:80))) 286s + .mpfr2bigz(m) == floor(m) 286s + .mpfr2bigz(m / L) == 0 286s + .mpfr2bigz(m * L) == floor(m * L) ## used to fail 286s + .mpfr2bigz(m * L^8) == floor(m * L^8) ## (ditto) 286s + }) 286s > 286s BEGIN TEST functionals.R 286s 286s R version 4.4.3 (2025-02-28) -- "Trophy Case" 286s Copyright (C) 2025 The R Foundation for Statistical Computing 286s Platform: arm-unknown-linux-gnueabihf (32-bit) 286s 286s R is free software and comes with ABSOLUTELY NO WARRANTY. 286s You are welcome to redistribute it under certain conditions. 286s Type 'license()' or 'licence()' for distribution details. 286s 286s R is a collaborative project with many contributors. 286s Type 'contributors()' for more information and 286s 'citation()' on how to cite R or R packages in publications. 286s 286s Type 'demo()' for some demos, 'help()' for on-line help, or 286s 'help.start()' for an HTML browser interface to help. 286s Type 'q()' to quit R. 286s 286s > #### Tests for "Functionals": Root finding, Optimization, Integration, etc 286s > 286s > stopifnot(require("Rmpfr")) 286s Loading required package: Rmpfr 286s Loading required package: gmp 286s 286s Attaching package: ‘gmp’ 286s 286s The following objects are masked from ‘package:base’: 286s 286s %*%, apply, crossprod, matrix, tcrossprod 286s 286s C code of R package 'Rmpfr': GMP using 32 bits per limb 286s 286s > 286s > (f.chk <- system.file("check-tools.R", package="Rmpfr", mustWork=TRUE)) 286s 286s Attaching package: ‘Rmpfr’ 286s 286s [1] "/usr/lib/R/site-library/Rmpfr/check-tools.R" 286s > source(f.chk, keep.source=FALSE) 286s The following object is masked from ‘package:gmp’: 286s 286s outer 286s 286s The following objects are masked from ‘package:stats’: 286s 286s dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm 286s 286s The following objects are masked from ‘package:base’: 286s 286s cbind, pmax, pmin, rbind 286s 286s > ## -> assert.EQ.() showSys.time() 286s > 286s > options(warn = 1)# warnings *immediately* 286s > (doExtras <- Rmpfr:::doExtras()) 286s [1] FALSE 286s > 286s > ### 1. Integration ----------------------------------------------- 286s > 286s > ## Example from Lauren K, June 2014 (~/R/MM/Pkg-ex/Rmpfr/integrateR-LaurenK.R): 286s > beta0 <- 0.05 286s > beta1 <- 0.05 286s > (tau <- sqrt(0.01*0.05*0.95/0.99))# = 0.0219.. 286s [1] 0.02190429 286s > ## 286s > Z00 <- 9 286s > Z01 <- 1 286s > Z10 <- 18 286s > Z11 <- 2 286s > N <- Z00+Z01+Z10+Z11 286s > 286s > integrand <- function(u) { 286s + ee.u <- exp(-u^2/2)/(sqrt(2*pi)*tau) 286s + b0u <- beta0 + tau*u 286s + b1u <- beta1 + b0u # == beta0+beta1+ tau*u 286s + 286s + ee.u ^ (Z00+Z01 + Z10+Z11) * 286s + (1-b0u)^Z00 * b0u ^ Z01 * 286s + (1-b1u)^Z10 * b1u ^ Z11 286s + } 286s > 286s > ## MM: note how the integrand() function looks: 286s > op <- par(mfcol=c(3,1), mgp=c(1.5, .6, 0), mar=.1+c(3,3,0,0)) 286s > ax1 <- function(a,b) axis(1, at=c(a,b), col=2, col.axis=2, tcl= +3/4, mgp=c(3,0,0)) 286s > curve(integrand, -5,5, n=1000) 286s > cc <- adjustcolor(2, 1/4) ## look closer: 286s > ep <- .01; rect(-3, -ep, 0, +ep, col=cc, border=cc); ax1(-3,0) 286s > curve(integrand, -3,0, n=1000, ylim = c(-ep,ep)) 286s > ## but now look really closely : 286s > ep <- .001; rect(-3, -ep, -2, +ep, col=cc); ax1(-3,-2) 286s > curve(integrand, -3,-2, n=1000, ylim = c(-ep, ep)) 286s > par(op) 286s > 286s > (I1 <- integrate(integrand,lower = -100, upper = 100)) 286s 1.396355e+33 with absolute error < 1.6e+29 286s > (I1. <- integrate(integrand,lower = -100, upper = 100, rel.tol = 1e-14)) 286s 1.396355e+33 with absolute error < 8e+18 286s > 286s > showSys.time(I2 <- integrateR(integrand, lower = -100, upper = 100)) 286s Warning in integrateR(integrand, lower = -100, upper = 100) : 286s no convergence up to order 13; last relative change = 1.285403e-05 286s Consider setting 'ord = ' (e.g. = 14). 286s Time user system elapsed 286s Time 0.004 0.000 0.004 286s > I2 ## ... Warning ‘no convergence up to order 13’ 286s Non-convergence message ‘no convergence up to order 13; last relative change = 1.285403e-05 286s Consider setting 'ord = ' (e.g. = 14).’ 286s 1.3964e+33 with absolute error < 1.7949e+28 286s > ## Solaris Sparc (2014-06, CRAN checks); thanks Brian: print(I2[1:2], digits=15) 286s > I2.Solaris <- list(value = 1.3963550396006e+33, abs.error = 1.79487857486724e+28) 286s > I.db <- list(value = 1.39635503960059e+33, abs.error = 1.79487857478077e+28) 286s > stopifnot( 286s + all.equal(I2[1:2], I.db, tol = 1e-10)# Solaris SPARC needs at least 4.8e-11 286s + ) 286s > 286s > ## Now using high accuracy 286s > showSys.time(I3 <- integrateR(integrand, lower = mpfr(-100, precBits=256), upper = 100)) 288s Warning in integrateR(integrand, lower = mpfr(-100, precBits = 256), upper = 100) : 288s no convergence up to order 13; last relative change = 1.285403e-5 288s Consider setting 'ord = ' (e.g. = 14). 288s Time user system elapsed 288s Time 1.702 0.029 1.731 288s > ## much slower but not better (and not worse) 288s > I3 288s Non-convergence message ‘no convergence up to order 13; last relative change = 1.285403e-5 288s Consider setting 'ord = ' (e.g. = 14).’ 288s 1.3964e+33 with absolute error < 1.7949e+28 288s > assert.EQ.(sapply(I3[1:2], asNumeric), unlist(I.db)) 288s Mean relative difference: 3.569039e-15 288s > ## Really get better when decreasing the integration interval 288s > ## from [-100, 100] to [-10, 10] ... which should give "the same" 288s > showSys.time(I4 <- integrateR(integrand, lower = mpfr(-10, precBits=256), upper = 10, 288s + ord = 15, verbose=TRUE)) 288s ord = 15; ==> evaluating integrand at 2^(ord+1)-2 = 65534 locations 288s n= 1, 2^n= 2 | I = 4.085188566e+34, abs.err = 4.085189e+34 288s n= 2, 2^n= 4 | I = 8.170377132e+33, abs.err = 3.268151e+34 288s n= 3, 2^n= 8 | I = 4.712016441e+33, abs.err = 3.458361e+33 288s n= 4, 2^n= 16 | I = 2.335919214e+33, abs.err = 2.376097e+33 288s n= 5, 2^n= 32 | I = 1.181962279e+33, abs.err = 1.153957e+33 288s n= 6, 2^n= 64 | I = 1.220705480e+33, abs.err = 3.874320e+31 288s n= 7, 2^n= 128 | I = 1.410495454e+33, abs.err = 1.897900e+32 288s n= 8, 2^n= 256 | I = 1.396201858e+33, abs.err = 1.429360e+31 289s n= 9, 2^n= 512 | I = 1.396354229e+33, abs.err = 1.523703e+29 289s n=10, 2^n= 1024 | I = 1.396354970e+33, abs.err = 7.409143e+26 289s n=11, 2^n= 2048 | I = 1.396354964e+33, abs.err = 5.998797e+24 289s n=12, 2^n= 4096 | I = 1.396354964e+33, abs.err = 6.619581e+21 290s n=13, 2^n= 8192 | I = 1.396354964e+33, abs.err = 1.662622e+18 292s n=14, 2^n= 16384 | I = 1.396354964e+33, abs.err = 1.021861e+14 295s n=15, 2^n= 32768 | I = 1.396354964e+33, abs.err = 1.561794e+9 295s Time user system elapsed 295s Time 6.593 0.109 6.703 295s > ## ~ 6.6 sec [lynne 2013] 295s > I4 295s 1.3964e+33 with absolute error < 1.5618e+9 295s > 295s > ## on the left side, there is "nothing" (and negative, as we know!): 295s > showSys.time(I0.1 <- integrateR(integrand, lower = mpfr(-1000, precBits=256), 295s + upper = -10, ord= 11, verbose=TRUE)) 295s ord = 11; ==> evaluating integrand at 2^(ord+1)-2 = 4094 locations 295s n= 1, 2^n= 2 | I = -2.859606864e-613, abs.err = 5.719214e-613 295s n= 2, 2^n= 4 | I = -1.334483203e-613, abs.err = 1.525124e-613 295s n= 3, 2^n= 8 | I = -6.566504650e-614, abs.err = 6.778327e-614 295s n= 4, 2^n= 16 | I = -3.270376825e-614, abs.err = 3.296128e-614 295s n= 5, 2^n= 32 | I = -1.633589988e-614, abs.err = 1.636787e-614 295s n= 6, 2^n= 64 | I = -8.165955325e-615, abs.err = 8.169945e-615 295s n= 7, 2^n= 128 | I = -4.082728442e-615, abs.err = 4.083227e-615 295s n= 8, 2^n= 256 | I = -2.041333072e-615, abs.err = 2.041395e-615 295s n= 9, 2^n= 512 | I = -1.020662642e-615, abs.err = 1.020670e-615 295s n=10, 2^n= 1024 | I = -5.103308345e-616, abs.err = 5.103318e-616 296s n=11, 2^n= 2048 | I = -2.551653564e-616, abs.err = 2.551655e-616 296s Time user system elapsed 296s Time 0.518 0.005 0.523 296s > showSys.time(I0.2 <- integrateR(integrand, lower = mpfr(10, precBits=256), 296s + upper = 1000, ord= 11, verbose=TRUE)) 296s ord = 11; ==> evaluating integrand at 2^(ord+1)-2 = 4094 locations 296s n= 1, 2^n= 2 | I = 6.250128073e-618, abs.err = 1.250026e-617 296s n= 2, 2^n= 4 | I = 2.916726434e-618, abs.err = 3.333402e-618 296s n= 3, 2^n= 8 | I = 1.435214595e-618, abs.err = 1.481512e-618 296s n= 4, 2^n= 16 | I = 7.147931510e-619, abs.err = 7.204214e-619 296s n= 5, 2^n= 32 | I = 3.570472142e-619, abs.err = 3.577459e-619 296s n= 6, 2^n= 64 | I = 1.784800116e-619, abs.err = 1.785672e-619 296s n= 7, 2^n= 128 | I = 8.923455870e-620, abs.err = 8.924545e-620 296s n= 8, 2^n= 256 | I = 4.461659853e-620, abs.err = 4.461796e-620 296s n= 9, 2^n= 512 | I = 2.230821417e-620, abs.err = 2.230838e-620 296s n=10, 2^n= 1024 | I = 1.115409645e-620, abs.err = 1.115412e-620 296s n=11, 2^n= 2048 | I = 5.577046893e-621, abs.err = 5.577050e-621 296s Time user system elapsed 296s Time 0.523 0.008 0.531 296s > I0.1 296s -2.5517e-616 with absolute error < 2.5517e-616 296s > I0.2 296s 5.5770e-621 with absolute error < 5.5770e-621 296s > I4 296s 1.3964e+33 with absolute error < 1.5618e+9 296s > 296s > ## Integral [-1000, +1000 ] = Int[-1000, -10] + Int[-10, +10] + Int[+10, +1000]: 296s > 296s > I4 $value + I0.1 $value + I0.2 $value 296s 1 'mpfr' number of precision 256 bits 296s [1] 1396354963674017387015147490193159.224442394550727848837192551722726424516192161 296s > ## but this is really the same as just the middle: 296s > stopifnot(I4 $value + I0.1 $value + I0.2 $value 296s + == I4 $value) 296s > 296s > value <- I4$value; delta <- I4$abs.err 296s > nDig <- -asNumeric(log10(delta/value)) 296s > cat("Correct number of digits: ", round(nDig, 2),"\n", 296s + "Integral I = ", format(I4$value, digits = ceiling(nDig)), 296s + " (last change change= ", format(delta, digits = 7),")\n", 296s + "integrate(.) = ", format(I1 $value, digits = 22),"\n", 296s + "integrate(., rtol=1e-15)= ", format(I1.$value, digits = 22),"\n", sep="") 296s Correct number of digits: 23.95 296s Integral I = 1.39635496367401738701515e+33 (last change change= 1.561794e+9) 296s integrate(.) = 1.396354963673671427757e+33 296s integrate(., rtol=1e-15)= 1.396354963674017015978e+33 296s > 296s > 296s > 296s > 296s > ### 2. Root Finding ---------------------------------------------- 296s > 296s > ### 3. Optimization / Minimization, .. --------------------------- 296s > 296s > 296s > 296s > cat('Time elapsed: ', proc.time(),'\n') # "stats" 296s Time elapsed: 10.436 0.204 10.641 0.001 0.004 296s > 296s BEGIN TEST lowlevel.R 296s 296s R version 4.4.3 (2025-02-28) -- "Trophy Case" 296s Copyright (C) 2025 The R Foundation for Statistical Computing 296s Platform: arm-unknown-linux-gnueabihf (32-bit) 296s 296s R is free software and comes with ABSOLUTELY NO WARRANTY. 296s You are welcome to redistribute it under certain conditions. 296s Type 'license()' or 'licence()' for distribution details. 296s 296s R is a collaborative project with many contributors. 296s Type 'contributors()' for more information and 296s 'citation()' on how to cite R or R packages in publications. 296s 296s Type 'demo()' for some demos, 'help()' for on-line help, or 296s 'help.start()' for an HTML browser interface to help. 296s Type 'q()' to quit R. 296s 296s > #### Low level stuff - debugging etc 296s > #### ========= ========= 296s > 296s > require("Rmpfr") 296s Loading required package: Rmpfr 296s Loading required package: gmp 297s 297s Attaching package: ‘gmp’ 297s 297s The following objects are masked from ‘package:base’: 297s 297s %*%, apply, crossprod, matrix, tcrossprod 297s 297s C code of R package 'Rmpfr': GMP using 32 bits per limb 297s 297s 297s Attaching package: ‘Rmpfr’ 297s 297s The following object is masked from ‘package:gmp’: 297s 297s outer 297s 297s The following objects are masked from ‘package:stats’: 297s 297s dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm 297s 297s The following objects are masked from ‘package:base’: 297s 297s cbind, pmax, pmin, rbind 297s 297s > options(warn = 2)# warning -> error 297s > 297s > identical3 <- function(x,y,z) identical(x,y) && identical (y,z) 297s > identical4 <- function(a,b,c,d) identical(a,b) && identical3(b,c,d) 297s > 297s > ## sane state [when re-source()ing this file]: 297s > .mpfr_erange_set("Emin", -(2^30-1)) 297s > .mpfr_erange_set("Emax", +(2^30-1)) 297s > 297s > ###----- _1_ mpfr1 , import, xport etc ----------------------------------------- 297s > i8 <- mpfr(-2:5, 32) 297s > x4 <- mpfr(c(NA, NaN, -Inf, Inf), 32); x4 # NA -> NaN as well 297s 4 'mpfr' numbers of precision 32 bits 297s [1] NaN NaN -Inf Inf 297s > stopifnot(identical3(is.na(x4), is.nan(x4), c(T,T,F,F))) 297s > 297s > o1 <- as(x4[1], "mpfr1") 297s > stopifnot(is(o1, "mpfr1")) # failed previously 297s > validObject(o1) # ditto (failed on 64-bit only) 297s [1] TRUE 297s > 297s > stopifnot( 297s + getPrec("0xabc", base=16, doNumeric=FALSE) == 3*4, 297s + getPrec( "abc", base=16, doNumeric=FALSE) == 3*4, 297s + getPrec("0b1001", base=2, doNumeric=FALSE) == 4, 297s + getPrec( "1001", base=2, doNumeric=FALSE) == 4, 297s + identical3(mpfr("0b101", base= 2), 297s + mpfr( "101", base= 2), mpfr(5, precBits = 3)) 297s + , 297s + identical3(mpfr("0xabc", base=16), 297s + mpfr( "abc", base=16), mpfr(2748, base=16, precBits = 12)) 297s + ) 297s > 297s > ## save initial (Emin, Emax) eranges : 297s > erangesOrig <- .mpfr_erange() 297s > 297s > ###----- _2_ Debugging, changing MPFR defaults, .. ----------------------------- 297s > ## NB: Currently mostly *not* documented, not even .mpfr_erange() 297s > 297s > stopifnot(Rmpfr:::.mpfr_debug() == 0 # the default level 297s + ## Activate debugging level 1: 297s + , Rmpfr:::.mpfr_debug(1) == 0 # the previous level 297s + ## and check it : 297s + , Rmpfr:::.mpfr_debug() == 1 # the current level 297s + ) 297s > 297s > r <- mpfr(7, 100)^-1000 297s > r 297s 1 'mpfr' number of precision 100 bits 297s .mpfr_debug[1]: .mpfr_debug[1]: [1] 7.9792116643192417444751621015671e-846 297s > ## (same as without debugging) 297s > 297s > ## where as this does print info: -- notably the very large values [3..6]: 297s > .eranges <- function() sapply(.mpfr_erange_kinds, .mpfr_erange, USE.NAMES=FALSE) 297s > ## now, mpfr_erange() works with a *vector* of args: 297s > .erange2 <- function() .mpfr_erange(.mpfr_erange_kinds) 297s > ## now returning *double* - which loses some precision [ending in '04' instead of '03']: 297s > formatC(.eranges(), format="fg") 297s mpfr2str(*, digits=0, maybeF=False, base=10): 297s [i=0]: prec=100, exp2=-2807 -> (nchar_i,dig.n)=(33,33) .. max_nchar=33 297s R_mpfr_get_erange(1): -1073741823 297s R_mpfr_get_erange(2): 1073741823 297s R_mpfr_get_erange(3): -1073741823 297s R_mpfr_get_erange(4): 1073741823 297s R_mpfr_get_erange(5): -1073741823 297s R_mpfr_get_erange(6): 1073741823 297s .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: Emin Emax min.emin max.emin min.emax 297s "-1073741823" "1073741823" "-1073741823" "1073741823" "-1073741823" 297s max.emax 297s "1073741823" 297s > stopifnot(identical(.eranges(), .erange2())) 297s .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: .mpfr_debug[1]: > 297s > .mpfr_minPrec() 297s .mpfr_debug[1]: [1]R_mpfr_get_erange(1): -1073741823 297s R_mpfr_get_erange(2): 1073741823 297s R_mpfr_get_erange(3): -1073741823 297s R_mpfr_get_erange(4): 1073741823 297s R_mpfr_get_erange(5): -1073741823 297s R_mpfr_get_erange(6): 1073741823 297s R_mpfr_get_erange(1): -1073741823 297s R_mpfr_get_erange(2): 1073741823 297s R_mpfr_get_erange(3): -1073741823 297s R_mpfr_get_erange(4): 1073741823 297s R_mpfr_get_erange(5): -1073741823 297s R_mpfr_get_erange(6): 1073741823 297s R_mpfr_prec_range(): 1 297s R_mpfr_prec_range(): 2147483391 297s mpfr2str(*, digits=0, maybeF=False, base=10): 297s dd[0] = 2684354560 -> r..d[i=0]= 0xa0000000 297s dd[1] = 135379182 -> r..d[i=1]= 0x811b8ee 297s dd[2] = 1395976304 -> r..d[i=2]= 0x5334e870 297s dd[3] = 3358285975 -> r..d[i=3]= 0xc82b6097 297s [i=0]: prec=100, exp2=-2807 -> (nchar_i,dig.n)=(33,33) .. max_nchar=33 297s dd[0] = 2684354560 -> r..d[i=0]= 0xa0000000 297s dd[1] = 135379182 -> r..d[i=1]= 0x811b8ee 297s dd[2] = 1395976304 -> r..d[i=2]= 0x5334e870 297s dd[3] = 3358285975 -> r..d[i=3]= 0xc82b6097 297s 1 297s > .mpfr_maxPrec()# debug printing shows the long integer (on 64 bit) 297s .mpfr_debug[1]: [1] 2147483391 297s > 297s > ## Now, level 2 : 297s > stopifnot(Rmpfr:::.mpfr_debug(2) == 1) 297s > r 297s 1 'mpfr' number of precision 100 bits 297s .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: dd[0] = 2684354560 -> r..d[i=0]= 0xa0000000 297s dd[1] = 135379182 -> r..d[i=1]= 0x811b8ee 297s dd[2] = 1395976304 -> r..d[i=2]= 0x5334e870 297s dd[3] = 3358285975 -> r..d[i=3]= 0xc82b6097 297s r..d[i=0] = 0x70000000 297s r..d[i=1] = 0xc5307c70 297s r..d[i=2] = 0x1cfbf9bc 297s r..d[i=3] = 0xb5fffcb0 297s [1] 7.9792116643192417444751621015671e-846 297s > ## with quite a bit of output 297s > 297s > if(FALSE) # on Winbuilder [2019-08-08, both 32 and 64 bit]: 297s + .mpfr_erange_set("Emax", 1073741823) 297s > 297s > r2 <- r^100 297s .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: mpfr2str(*, digits=0, maybeF=False, base=10): 297s dd[0] = 1879048192 -> r..d[i=0]= 0x70000000 297s dd[1] = 3308289136 -> r..d[i=1]= 0xc5307c70 297s dd[2] = 486275516 -> r..d[i=2]= 0x1cfbf9bc 297s dd[3] = 3053452464 -> r..d[i=3]= 0xb5fffcb0 297s [i=0]: prec=100, exp2=-280735 -> (nchar_i,dig.n)=(33,33) .. max_nchar=33 297s dd[0] = 1879048192 -> r..d[i=0]= 0x70000000 297s dd[1] = 3308289136 -> r..d[i=1]= 0xc5307c70 297s dd[2] = 486275516 -> r..d[i=2]= 0x1cfbf9bc 297s dd[3] = 3053452464 -> r..d[i=3]= 0xb5fffcb0 297s > r2 297s 1 'mpfr' number of precision 100 bits 297s .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: dd[0] = 2684354560 -> r..d[i=0]= 0xa0000000 297s dd[1] = 135379182 -> r..d[i=1]= 0x811b8ee 297s dd[2] = 1395976304 -> r..d[i=2]= 0x5334e870 297s dd[3] = 3358285975 -> r..d[i=3]= 0xc82b6097 297s r..d[i=0] = 0x20000000 297s r..d[i=1] = 0xe7c2f7bc 297s r..d[i=2] = 0x1dc591a5 297s r..d[i=3] = 0x939f23c9 297s [1] 1.5703576492231738528268016707234e-84510 297s > L <- r^-100000 297s .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: dd[0] = 536870912 -> r..d[i=0]= 0x20000000 297s dd[1] = 3888314300 -> r..d[i=1]= 0xe7c2f7bc 297s dd[2] = 499487141 -> r..d[i=2]= 0x1dc591a5 297s dd[3] = 2476680137 -> r..d[i=3]= 0x939f23c9 297s r..d[i=0] = 0x10000000 297s r..d[i=1] = 0x2d66dbe0 297s r..d[i=2] = 0x58f361ce 297s r..d[i=3] = 0xc45982ce 297s mpfr2str(*, digits=12, maybeF=TRUE, base=10): 297s dd[0] = 268435456 -> r..d[i=0]= 0x10000000 297s dd[1] = 761715680 -> r..d[i=1]= 0x2d66dbe0 297s dd[2] = 1492345294 -> r..d[i=2]= 0x58f361ce 297s dd[3] = 3294200526 -> r..d[i=3]= 0xc45982ce 297s N_digits: [i=0]: ... -> dig.n = 12 .. max_nchar=12 297s dd[0] = 268435456 -> r..d[i=0]= 0x10000000 297s dd[1] = 761715680 -> r..d[i=1]= 0x2d66dbe0 297s dd[2] = 1492345294 -> r..d[i=2]= 0x58f361ce 297s dd[3] = 3294200526 -> r..d[i=3]= 0xc45982ce 297s mpfr2str(*, digits=12, maybeF=TRUE, base=10): 297s dd[0] = 268435456 -> r..d[i=0]= 0x10000000 297s dd[1] = 761715680 -> r..d[i=1]= 0x2d66dbe0 297s dd[2] = 1492345294 -> r..d[i=2]= 0x58f361ce 297s dd[3] = 3294200526 -> r..d[i=3]= 0xc45982ce 297s N_digits: [i=0]: ... -> dig.n = 12 .. max_nchar=12 297s dd[0] = 268435456 -> r..d[i=0]= 0x10000000 297s dd[1] = 761715680 -> r..d[i=1]= 0x2d66dbe0 297s dd[2] = 1492345294 -> r..d[i=2]= 0x58f361ce 297s dd[3] = 3294200526 -> r..d[i=3]= 0xc45982ce 297s mpfr2str(*, digits=0, maybeF=False, base=10): 297s dd[0] = 268435456 -> r..d[i=0]= 0x10000000 297s dd[1] = 761715680 -> r..d[i=1]= 0x2d66dbe0 297s dd[2] = 1492345294 -> r..d[i=2]= 0x58f361ce 297s dd[3] = 3294200526 -> r..d[i=3]= 0xc45982ce 297s [i=0]: prec=100, exp2=842206477 -> (nchar_i,dig.n)=(33,33) .. max_nchar=33 297s dd[0] = 268435456 -> r..d[i=0]= 0x10000000 297s dd[1] = 761715680 -> r..d[i=1]= 0x2d66dbe0 297s dd[2] = 1492345294 -> r..d[i=2]= 0x58f361ce 297s dd[3] = 3294200526 -> r..d[i=3]= 0xc45982ce 297s mpfr2str(*, digits=0, maybeF=False, base=10): 297s .. max_nchar=5 297s .. max_nchar=5 297s .. max_nchar=5 297s .. max_nchar=5 297s > L3 <- L^3 297s .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: > str(L3, internal=TRUE) 297s Class 'mpfr' [package "Rmpfr"] of length 1 and precision 100 297s internally @.Data: List of 1 297s $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots 297s .. ..@ prec: int 100 297s .. ..@ exp : int 842206477 297s .. ..@ sign: int 1 297s .. ..@ d : int [1:4] 268435456 761715680 1492345294 -1000766770 297s > ## Class 'mpfr' [package "Rmpfr"] of length 1 and precision 100 297s > ## internally @.Data: List of 1 297s > ## $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots 297s > ## .. ..@ prec: int 100 297s > ## .. ..@ exp : int [1:2] 842206477 0 297s > ## .. ..@ sign: int 1 297s > ## .. ..@ d : int [1:4] 268435456 761715680 1492345294 -1000766770 297s > str(L3) 297s Class 'mpfr' [package "Rmpfr"] of length 1 and precision 100 297s .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: 1.00989692356e+253529412 297s > ## lots of debugging output, then 297s > ## 1.00989692356e+253529412 297s > ## ^^~~~~~~~~~ 10 ^ 253'529'412 that is humongous 297s > if(!interactive()) # not seg.faulting, but printing a *huge* line [no longer!] 297s + show(L3) 297s 1 'mpfr' number of precision 100 bits 297s .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: .mpfr_debug[2]: [1] 1.0098969235574373617534053306205e+253529412 297s > ## segmentation fault -- randomly; 2017-06: no longer see any problem, not even with 297s > if(FALSE) ## well, not really, definitely not interactively for now 297s + if(interactive()) 297s + for(i in 1:256) show(L3) 297s > ## 297s > 297s > ## quite platform dependent {valgrind ==> bug? even in mpfr/gmp/.. ?} 297s > str(.mpfr2list(x4)) 297s List of 4 297s $ :List of 4 297s ..$ prec: int 32 297s ..$ exp : int -2147483646 297s ..$ sign: int 1 297s ..$ d : int(0) 297s $ :List of 4 297s ..$ prec: int 32 297s ..$ exp : int -2147483646 297s ..$ sign: int 1 297s ..$ d : int(0) 297s $ :List of 4 297s ..$ prec: int 32 297s ..$ exp : int -2147483645 297s ..$ sign: int -1 297s ..$ d : int(0) 297s $ :List of 4 297s ..$ prec: int 32 297s ..$ exp : int -2147483645 297s ..$ sign: int 1 297s ..$ d : int(0) 297s > ## slightly nicer ["uniformly not worse"] (still very similar) : 297s > str(x4, internal=TRUE) 297s Class 'mpfr' [package "Rmpfr"] of length 4 and precision 32 297s internally @.Data: List of 4 297s $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots 297s .. ..@ prec: int 32 297s .. ..@ exp : int -2147483646 297s .. ..@ sign: int 1 297s .. ..@ d : int(0) 297s $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots 297s .. ..@ prec: int 32 297s .. ..@ exp : int -2147483646 297s .. ..@ sign: int 1 297s .. ..@ d : int(0) 297s $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots 297s .. ..@ prec: int 32 297s .. ..@ exp : int -2147483645 297s .. ..@ sign: int -1 297s .. ..@ d : int(0) 297s $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots 297s .. ..@ prec: int 32 297s .. ..@ exp : int -2147483645 297s .. ..@ sign: int 1 297s .. ..@ d : int(0) 297s > x4 ## "similar info" as .mpfr2list(.) 297s 4 'mpfr' numbers of precision 32 bits 297s .mpfr_debug[2]: [1] NaN NaN -Inf Inf 297s > 297s > ## Increase maximal exponent: 297s > 297s > tools:::assertWarning( 297s + .mpfr_erange_set("Emax", 5e18)) # too large {FIXME why only warning and not error ??} 297s > .mpfr_erange("Emax") # is unchanged 297s .mpfr_debug[2]: Emax 297s 1073741823 297s > if(4e18 < .mpfr_erange("max.emax")) { 297s + .mpfr_erange_set("Emax", 4e18) # now ok: 297s + stopifnot(.mpfr_erange("Emax") == 4e18) 297s + } 297s .mpfr_debug[2]: > 297s > 297s > ## revert to no debugging: 297s > stopifnot(Rmpfr:::.mpfr_debug(0) == 2) 297s > .mpfr_maxPrec() 297s [1] 2147483391 297s > 297s > L / (r2^-1000)# 1.00000....448 (could be more accurate?) 297s R_mpfr_get_erange(2): 1073741823 297s R_mpfr_get_erange(6): 1073741823 297s 1 'mpfr' number of precision 100 bits 297s [1] 1.0000000000000000000000000004481 297s > 297s > stopifnot(exprs = { 297s + all.equal(L, r2^-1000, tol= 1e-27) # why not more accurate? 297s + all.equal(log(L), -100000 * (-1000) * log(7), tol = 1e-15) 297s + }) 297s > 297s > ## Now, our experimental "transport vehicle": 297s > stopifnot(length(rv <- c(r, r2, L)) == 3) 297s > 297s > str(mpfrXport(rv)) 297s List of 5 297s $ gmp.numb.bits: int 32 297s $ mpfr.version : chr "4.2.1" 297s $ Machine :List of 5 297s ..$ sizeof.long : int 4 297s ..$ sizeof.longlong : int 8 297s ..$ sizeof.longdouble: int 8 297s ..$ sizeof.pointer : int 4 297s ..$ sizeof.time_t : int 8 297s $ Sys.info : Named chr [1:2] "Linux" "armv7l" 297s ..- attr(*, "names")= chr [1:2] "sysname" "machine" 297s $ mpfr :List of 3 297s ..$ :List of 4 297s .. ..$ prec: int 100 297s .. ..$ exp : int -2807 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] -1610612736 135379182 1395976304 -936681321 297s ..$ :List of 4 297s .. ..$ prec: int 100 297s .. ..$ exp : int -280735 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] 1879048192 -986678160 486275516 -1241514832 297s ..$ :List of 4 297s .. ..$ prec: int 100 297s .. ..$ exp : int 280735493 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] 536870912 -406652996 499487141 -1818287159 297s - attr(*, "class")= chr "mpfrXport" 297s > str(mpfrXport(mpfr(2, 64)^(-3:3))) 297s List of 5 297s $ gmp.numb.bits: int 32 297s $ mpfr.version : chr "4.2.1" 297s $ Machine :List of 5 297s ..$ sizeof.long : int 4 297s ..$ sizeof.longlong : int 8 297s ..$ sizeof.longdouble: int 8 297s ..$ sizeof.pointer : int 4 297s ..$ sizeof.time_t : int 8 297s $ Sys.info : Named chr [1:2] "Linux" "armv7l" 297s ..- attr(*, "names")= chr [1:2] "sysname" "machine" 297s $ mpfr :List of 7 297s ..$ :List of 4 297s .. ..$ prec: int 64 297s .. ..$ exp : int -2 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:2] 0 NA 297s ..$ :List of 4 297s .. ..$ prec: int 64 297s .. ..$ exp : int -1 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:2] 0 NA 297s ..$ :List of 4 297s .. ..$ prec: int 64 297s .. ..$ exp : int 0 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:2] 0 NA 297s ..$ :List of 4 297s .. ..$ prec: int 64 297s .. ..$ exp : int 1 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:2] 0 NA 297s ..$ :List of 4 297s .. ..$ prec: int 64 297s .. ..$ exp : int 2 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:2] 0 NA 297s ..$ :List of 4 297s .. ..$ prec: int 64 297s .. ..$ exp : int 3 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:2] 0 NA 297s ..$ :List of 4 297s .. ..$ prec: int 64 297s .. ..$ exp : int 4 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:2] 0 NA 297s - attr(*, "class")= chr "mpfrXport" 297s > str(mpfrXport(Const("pi")* 2^(-3:3))) 297s List of 5 297s $ gmp.numb.bits: int 32 297s $ mpfr.version : chr "4.2.1" 297s $ Machine :List of 5 297s ..$ sizeof.long : int 4 297s ..$ sizeof.longlong : int 8 297s ..$ sizeof.longdouble: int 8 297s ..$ sizeof.pointer : int 4 297s ..$ sizeof.time_t : int 8 297s $ Sys.info : Named chr [1:2] "Linux" "armv7l" 297s ..- attr(*, "names")= chr [1:2] "sysname" "machine" 297s $ mpfr :List of 7 297s ..$ :List of 4 297s .. ..$ prec: int 120 297s .. ..$ exp : int -1 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] -2133058304 -993631605 560513588 -921707870 297s ..$ :List of 4 297s .. ..$ prec: int 120 297s .. ..$ exp : int 0 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] -2133058304 -993631605 560513588 -921707870 297s ..$ :List of 4 297s .. ..$ prec: int 120 297s .. ..$ exp : int 1 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] -2133058304 -993631605 560513588 -921707870 297s ..$ :List of 4 297s .. ..$ prec: int 120 297s .. ..$ exp : int 2 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] -2133058304 -993631605 560513588 -921707870 297s ..$ :List of 4 297s .. ..$ prec: int 120 297s .. ..$ exp : int 3 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] -2133058304 -993631605 560513588 -921707870 297s ..$ :List of 4 297s .. ..$ prec: int 120 297s .. ..$ exp : int 4 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] -2133058304 -993631605 560513588 -921707870 297s ..$ :List of 4 297s .. ..$ prec: int 120 297s .. ..$ exp : int 5 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] -2133058304 -993631605 560513588 -921707870 297s - attr(*, "class")= chr "mpfrXport" 297s > 297s > ## and a very large one 297s > mil <- mpfr(1025, 111) 297s > str(mm <- mpfrXport(xx <- mil^(2^25))) 297s List of 5 297s $ gmp.numb.bits: int 32 297s $ mpfr.version : chr "4.2.1" 297s $ Machine :List of 5 297s ..$ sizeof.long : int 4 297s ..$ sizeof.longlong : int 8 297s ..$ sizeof.longdouble: int 8 297s ..$ sizeof.pointer : int 4 297s ..$ sizeof.time_t : int 8 297s $ Sys.info : Named chr [1:2] "Linux" "armv7l" 297s ..- attr(*, "names")= chr [1:2] "sysname" "machine" 297s $ mpfr :List of 1 297s ..$ :List of 4 297s .. ..$ prec: int 111 297s .. ..$ exp : int 335591572 297s .. ..$ sign: int 1 297s .. ..$ d : int [1:4] -474349568 -2023461216 -832488434 -1890623142 297s - attr(*, "class")= chr "mpfrXport" 297s > stopifnot(all.equal(log2(xx) * 2^-25, log2(mil), tol=1e-15)) 297s > 297s > ## even larger -- strictly needs extended erange: 297s > if(.mpfr_erange("min.emin") <= -2^40) { 297s + .mpfr_erange_set("Emin", - 2^40) 297s + show(xe <- 2^mpfr(-seq(1,70, by=3)*8e8, 64)) 297s + ## used to print wrongly {because of integer overflow in .mpfr2str()$exp}, 297s + ## with some exponents large positive 297s + stopifnot(exprs = { 297s + ! .mpfr_erange_is_int() # as 'exp's now are double 297s + (ee <- as.numeric(sub(".*e","", formatMpfr(xe)))) < -240e6 297s + (diff(ee) + 722471990) %in% 0:1 297s + }) 297s + } else { 297s + cat(sprintf( 297s + "Cannot set 'Emin' to -2^40 (= %g), as .mpfr_erange(\"min.emin\") is larger, 297s + namely %g.\n", 297s + - 2^40, .mpfr_erange("min.emin"))) 297s + } 297s Cannot set 'Emin' to -2^40 (= -1.09951e+12), as .mpfr_erange("min.emin") is larger, 297s namely -1.07374e+09. 297s > 297s > ## Bill Dunlap's example (with patch about convert S_alloc bug): 297s > ## (precision increases, then decreases) 297s > z <- c(mpfr(1,8)/19, mpfr(1,32)/19, mpfr(1,24)/19) 297s > cbind(fz <- format(z)) 297s [,1] 297s [1,] "0.05273" 297s [2,] "0.052631578947" 297s [3,] "0.0526315793" 297s > stopifnot(identical(fz, rev(format(rev(z))))) 297s > stopifnot(identical(fz, c("0.05273", 297s + "0.052631578947", 297s + "0.0526315793"))) # << smaller prec, again since 2019-08-09 297s > 297s > e.xx. <- .mpfr2exp(xx) 297s > e.z. <- .mpfr2exp(z) 297s > 297s > ## revert to original 'erange' settings (which gives integer 'exp'): 297s > .mpfr_erange_set("Emax", erangesOrig[["Emax"]]) # typically 2^30 - 1 = 1073741823 297s > .mpfr_erange_set("Emin", erangesOrig[["Emin"]]) 297s > 297s > e.xx <- .mpfr2exp(xx) 297s > e.z <- .mpfr2exp(z) 297s > stopifnot(exprs = { 297s + .mpfr_erange_is_int() 297s + e.xx == e.xx. 297s + e.xx == 335591572 297s + e.z == e.z. 297s + e.z == -4 297s + is.integer(e.xx) # but e.xx. is double 297s + is.integer(e.z) 297s + }) 297s > 297s > k1 <- mpfr( c(123, 1234, 12345, 123456), precBits=2) 297s > (N1 <- asNumeric(k1))# 128 1024 12288 131072 -- correct 297s [1] 128 1024 12288 131072 297s > str(sk1 <- .mpfr2str(k1)) 297s List of 4 297s $ str : chr [1:4] "13" "10" "12" "13" 297s $ exp : int [1:4] 3 4 5 6 297s $ finite: logi [1:4] TRUE TRUE TRUE TRUE 297s $ is.0 : logi [1:4] FALSE FALSE FALSE FALSE 297s > str(sk1. <- .mpfr2str(k1, maybe.full=TRUE)) 297s List of 4 297s $ str : chr [1:4] "128" "1024" "12288" "131072" 297s $ exp : int [1:4] 3 4 5 6 297s $ finite: logi [1:4] TRUE TRUE TRUE TRUE 297s $ is.0 : logi [1:4] FALSE FALSE FALSE FALSE 297s > str(sk1.2 <- .mpfr2str(k1, digits=2, base=2)) 297s List of 4 297s $ str : chr [1:4] "10" "10" "11" "10" 297s $ exp : int [1:4] 8 11 14 18 297s $ finite: logi [1:4] TRUE TRUE TRUE TRUE 297s $ is.0 : logi [1:4] FALSE FALSE FALSE FALSE 297s > str(sk1.2F <- .mpfr2str(k1, maybe.full=TRUE, base=2)) 297s List of 4 297s $ str : chr [1:4] "10000000" "10000000000" "11000000000000" "100000000000000000" 297s $ exp : int [1:4] 8 11 14 18 297s $ finite: logi [1:4] TRUE TRUE TRUE TRUE 297s $ is.0 : logi [1:4] FALSE FALSE FALSE FALSE 297s > stopifnot(exprs = { 297s + identical(sk1 [1:2], list(str = c("13", "10", "12", "13"), exp = 3:6)) 297s + identical(sk1.[1:2], list(str = c("128", "1024", "12288", "131072"), exp = 3:6)) 297s + identical(sk1.2, list(str = c("10", "10", "11", "10"), 297s + exp = c( 8L, 11L, 14L, 18L), 297s + finite = rep(TRUE, 4), is.0 = rep(FALSE, 4))) 297s + all.equal(sk1.2[2:4], .mpfr_formatinfo(k1), tol=0) # not identical(): int <-> double 297s + identical(formatMpfr(k1, base=2, digits=20, drop0trailing=TRUE), 297s + with(sk1.2, paste0(str, sapply(exp - nchar(str), strrep, x="0")))) 297s + identical(formatMpfr(k1, base=2, digits=2, exponent.plus=FALSE), 297s + c("1.0e7", "1.0e10", "1.1e13", "1.0e17")) 297s + }) 297s > ## MM: --> need_dig is fine but is not used in the string that is returned !! 297s > 297s > (fk1sF <- formatMpfr(k1, scientific=FALSE)) # "the bug" --- now fixed! ==> new "Bug" in new Rmpfr ???? 297s [1] "128." "1024." "12288." "131072." 297s > ## was "128." "1024." "12288." "131072." , but now obeying internal precision gives 297s > ## "1.e2" "1.e3" "1.e4" "1.e5" 297s > (fk1 <- formatMpfr(k1, digits=6)) 297s [1] "128.000" "1024.00" "12288.0" "131072." 297s > stopifnot(exprs = { 297s + N1 == as.numeric(fk1) 297s + ## FIXME: This should change again "1024" 297s + identical(format(k1, digits=3), c("128.", "1020.", "1.23e+4", "1.31e+5")) 297s + }) 297s > ## 297s > digs <- setNames(1:6, 1:6) 297s > ## Each of these are 4 x 6 matrices 297s > ffix <- sapply(digs, function(d) format(k1, digits = d, scientific = FALSE)) ## *not* good at all .. 297s > ## ==> need a maybe.full=TRUE even here 297s > ff <- sapply(digs, function(d) format(k1, digits = d))# sci..fic = NA -- digits=1 failing for '128' 297s > fsci <- sapply(digs, function(d) format(k1, digits = d, scientific = TRUE)) # perfect 297s > stopifnot(exprs = { 297s + length(dd <- dim(ff)) == 2 297s + identical(dd, dim(ffix)) 297s + identical(dd, dim(fsci)) 297s + all.equal(asNumeric(fsci), asNumeric(ffix) -> dmat, tol=0) 297s + all.equal(asNumeric(ff), asNumeric(ffix), tol=0) 297s + }) 297s > rE <- 1 - dmat / asNumeric(k1) 297s > i <- 1:5 297s > summary(fm <- lm(log10(colMeans(abs(rE)))[i] ~ i)) 297s 297s Call: 297s lm(formula = log10(colMeans(abs(rE)))[i] ~ i) 297s 297s Residuals: 297s 1 2 3 4 5 297s -0.12076 0.06070 0.10167 0.09761 -0.13922 297s 297s Coefficients: 297s Estimate Std. Error t value Pr(>|t|) 297s (Intercept) 0.49710 0.14522 3.423 0.041747 * 297s i -1.15528 0.04378 -26.386 0.000119 *** 297s --- 297s Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 297s 297s Residual standard error: 0.1385 on 3 degrees of freedom 297s Multiple R-squared: 0.9957, Adjusted R-squared: 0.9943 297s F-statistic: 696.2 on 1 and 3 DF, p-value: 0.0001194 297s 297s > stopifnot(exprs = { 297s + rE[ cbind(FALSE, upper.tri(rE)[,-6]) ] == 0 297s + abs(residuals(fm)) < 0.15 297s + }) 297s > 297s > ## formatting / printing : 297s > tenth <- mpfr(-12:12, 52)/10 297s > cents <- mpfr(-11:11, 64)/100 297s > (kxi <- sort(c(k1, x4, i8, tenth, cents), na.last=FALSE)) 297s 64 'mpfr' numbers of precision 2 .. 64 bits 297s [1] NaN NaN 297s [3] -Inf -2 297s [5] -1.2000000000000002 -1.1000000000000001 297s [7] -1 -1 297s [9] -0.89999999999999991 -0.80000000000000004 297s [11] -0.69999999999999996 -0.60000000000000009 297s [13] -0.5 -0.40000000000000002 297s [15] -0.30000000000000004 -0.20000000000000001 297s [17] -0.109999999999999999999 -0.10000000000000001 297s [19] -0.100000000000000000001 -0.0900000000000000000033 297s [21] -0.0799999999999999999984 -0.0700000000000000000003 297s [23] -0.0599999999999999999988 -0.0500000000000000000007 297s [25] -0.0399999999999999999992 -0.0299999999999999999994 297s [27] -0.0199999999999999999996 -0.0099999999999999999998 297s [29] 0 0 297s [31] 0 0.0099999999999999999998 297s [33] 0.0199999999999999999996 0.0299999999999999999994 297s [35] 0.0399999999999999999992 0.0500000000000000000007 297s [37] 0.0599999999999999999988 0.0700000000000000000003 297s [39] 0.0799999999999999999984 0.0900000000000000000033 297s [41] 0.100000000000000000001 0.10000000000000001 297s [43] 0.109999999999999999999 0.20000000000000001 297s [45] 0.30000000000000004 0.40000000000000002 297s [47] 0.5 0.60000000000000009 297s [49] 0.69999999999999996 0.80000000000000004 297s [51] 0.89999999999999991 1 297s [53] 1 1.1000000000000001 297s [55] 1.2000000000000002 2 297s [57] 3 4 297s [59] 5 130 297s [61] 1e+3 1.2e+4 297s [63] 1.3e+5 Inf 297s > mstr <- .mpfr2str (kxi) 297s > mfi <- .mpfr_formatinfo(kxi) 297s > es <- mstr$exp # base 10 ; with '0' when !is.finite or is0 297s > ef <- mfi $exp # base 2 ; "undefined" when !is.finite or is0 297s > j2 <- c("finite", "is.0") 297s > dxi <- cbind(x = asNumeric(kxi), prec = .getPrec(kxi), 297s + as.data.frame(mstr, stringsAsFactors = FALSE)) 297s > stopifnot(is.data.frame(dxi), identical(mstr$str, dxi[,"str"]), 297s + identical(mstr[j2], mfi[j2]), 297s + identical(ef, .mpfr2exp(kxi))) 297s > dxi ## 2019-08-09: again *varying* size of 'str' rather than only growing !! 297s x prec str exp finite is.0 297s 1 NaN 32 @NaN@ 0 FALSE FALSE 297s 2 NaN 32 @NaN@ 0 FALSE FALSE 297s 3 -Inf 32 -@Inf@ 0 FALSE FALSE 297s 4 -2.00 32 -20000000000 1 TRUE FALSE 297s 5 -1.20 52 -12000000000000002 1 TRUE FALSE 297s 6 -1.10 52 -11000000000000001 1 TRUE FALSE 297s 7 -1.00 32 -10000000000 1 TRUE FALSE 297s 8 -1.00 52 -10000000000000000 1 TRUE FALSE 297s 9 -0.90 52 -89999999999999991 0 TRUE FALSE 297s 10 -0.80 52 -80000000000000004 0 TRUE FALSE 297s 11 -0.70 52 -69999999999999996 0 TRUE FALSE 297s 12 -0.60 52 -60000000000000009 0 TRUE FALSE 297s 13 -0.50 52 -50000000000000000 0 TRUE FALSE 297s 14 -0.40 52 -40000000000000002 0 TRUE FALSE 297s 15 -0.30 52 -30000000000000004 0 TRUE FALSE 297s 16 -0.20 52 -20000000000000001 0 TRUE FALSE 297s 17 -0.11 64 -109999999999999999999 0 TRUE FALSE 297s 18 -0.10 52 -10000000000000001 0 TRUE FALSE 297s 19 -0.10 64 -100000000000000000001 0 TRUE FALSE 297s 20 -0.09 64 -900000000000000000033 -1 TRUE FALSE 297s 21 -0.08 64 -799999999999999999984 -1 TRUE FALSE 297s 22 -0.07 64 -700000000000000000003 -1 TRUE FALSE 297s 23 -0.06 64 -599999999999999999988 -1 TRUE FALSE 297s 24 -0.05 64 -500000000000000000007 -1 TRUE FALSE 297s 25 -0.04 64 -399999999999999999992 -1 TRUE FALSE 297s 26 -0.03 64 -299999999999999999994 -1 TRUE FALSE 297s 27 -0.02 64 -199999999999999999996 -1 TRUE FALSE 297s 28 -0.01 64 -999999999999999999980 -2 TRUE FALSE 297s 29 0.00 32 0 0 TRUE TRUE 297s 30 0.00 52 0 0 TRUE TRUE 297s 31 0.00 64 0 0 TRUE TRUE 297s 32 0.01 64 999999999999999999980 -2 TRUE FALSE 297s 33 0.02 64 199999999999999999996 -1 TRUE FALSE 297s 34 0.03 64 299999999999999999994 -1 TRUE FALSE 297s 35 0.04 64 399999999999999999992 -1 TRUE FALSE 297s 36 0.05 64 500000000000000000007 -1 TRUE FALSE 297s 37 0.06 64 599999999999999999988 -1 TRUE FALSE 297s 38 0.07 64 700000000000000000003 -1 TRUE FALSE 297s 39 0.08 64 799999999999999999984 -1 TRUE FALSE 297s 40 0.09 64 900000000000000000033 -1 TRUE FALSE 297s 41 0.10 64 100000000000000000001 0 TRUE FALSE 297s 42 0.10 52 10000000000000001 0 TRUE FALSE 297s 43 0.11 64 109999999999999999999 0 TRUE FALSE 297s 44 0.20 52 20000000000000001 0 TRUE FALSE 297s 45 0.30 52 30000000000000004 0 TRUE FALSE 297s 46 0.40 52 40000000000000002 0 TRUE FALSE 297s 47 0.50 52 50000000000000000 0 TRUE FALSE 297s 48 0.60 52 60000000000000009 0 TRUE FALSE 297s 49 0.70 52 69999999999999996 0 TRUE FALSE 297s 50 0.80 52 80000000000000004 0 TRUE FALSE 297s 51 0.90 52 89999999999999991 0 TRUE FALSE 297s 52 1.00 32 10000000000 1 TRUE FALSE 297s 53 1.00 52 10000000000000000 1 TRUE FALSE 297s 54 1.10 52 11000000000000001 1 TRUE FALSE 297s 55 1.20 52 12000000000000002 1 TRUE FALSE 297s 56 2.00 32 20000000000 1 TRUE FALSE 297s 57 3.00 32 30000000000 1 TRUE FALSE 297s 58 4.00 32 40000000000 1 TRUE FALSE 297s 59 5.00 32 50000000000 1 TRUE FALSE 297s 60 128.00 2 13 3 TRUE FALSE 297s 61 1024.00 2 10 4 TRUE FALSE 297s 62 12288.00 2 12 5 TRUE FALSE 297s 63 131072.00 2 13 6 TRUE FALSE 297s 64 Inf 32 @Inf@ 0 FALSE FALSE 297s > ## Show that *order* no longer matters: 297s > n <- length(ixk <- rev(kxi)) 297s > dix <- cbind(x = asNumeric(ixk), prec = .getPrec(ixk), 297s + as.data.frame(.mpfr2str(ixk), stringsAsFactors = FALSE))[n:1,] 297s > attr(dix, "row.names") <- .set_row_names(n) 297s > stopifnot(identical(dxi, dix)) 297s > 297s > 297s > ## somewhat (but not so much) revealing : 297s > cbind(prec = .getPrec(kxi), kxi = asNumeric(kxi), str = es, 297s + fi.10 = ceiling(ef/log2(10)), str.2 = as.integer(es*log2(10)), fi = ef) 297s prec kxi str fi.10 str.2 fi 297s [1,] 32 NaN 0 -646456992 0 -2147483646 297s [2,] 32 NaN 0 -646456992 0 -2147483646 297s [3,] 32 -Inf 0 -646456992 0 -2147483645 297s [4,] 32 -2.00 1 1 3 2 297s [5,] 52 -1.20 1 1 3 1 297s [6,] 52 -1.10 1 1 3 1 297s [7,] 32 -1.00 1 1 3 1 297s [8,] 52 -1.00 1 1 3 1 297s [9,] 52 -0.90 0 0 0 0 297s [10,] 52 -0.80 0 0 0 0 297s [11,] 52 -0.70 0 0 0 0 297s [12,] 52 -0.60 0 0 0 0 297s [13,] 52 -0.50 0 0 0 0 297s [14,] 52 -0.40 0 0 0 -1 297s [15,] 52 -0.30 0 0 0 -1 297s [16,] 52 -0.20 0 0 0 -2 297s [17,] 64 -0.11 0 0 0 -3 297s [18,] 52 -0.10 0 0 0 -3 297s [19,] 64 -0.10 0 0 0 -3 297s [20,] 64 -0.09 -1 0 -3 -3 297s [21,] 64 -0.08 -1 0 -3 -3 297s [22,] 64 -0.07 -1 0 -3 -3 297s [23,] 64 -0.06 -1 -1 -3 -4 297s [24,] 64 -0.05 -1 -1 -3 -4 297s [25,] 64 -0.04 -1 -1 -3 -4 297s [26,] 64 -0.03 -1 -1 -3 -5 297s [27,] 64 -0.02 -1 -1 -3 -5 297s [28,] 64 -0.01 -2 -1 -6 -6 297s [29,] 32 0.00 0 -646456992 0 -2147483647 297s [30,] 52 0.00 0 -646456992 0 -2147483647 297s [31,] 64 0.00 0 -646456992 0 -2147483647 297s [32,] 64 0.01 -2 -1 -6 -6 297s [33,] 64 0.02 -1 -1 -3 -5 297s [34,] 64 0.03 -1 -1 -3 -5 297s [35,] 64 0.04 -1 -1 -3 -4 297s [36,] 64 0.05 -1 -1 -3 -4 297s [37,] 64 0.06 -1 -1 -3 -4 297s [38,] 64 0.07 -1 0 -3 -3 297s [39,] 64 0.08 -1 0 -3 -3 297s [40,] 64 0.09 -1 0 -3 -3 297s [41,] 64 0.10 0 0 0 -3 297s [42,] 52 0.10 0 0 0 -3 297s [43,] 64 0.11 0 0 0 -3 297s [44,] 52 0.20 0 0 0 -2 297s [45,] 52 0.30 0 0 0 -1 297s [46,] 52 0.40 0 0 0 -1 297s [47,] 52 0.50 0 0 0 0 297s [48,] 52 0.60 0 0 0 0 297s [49,] 52 0.70 0 0 0 0 297s [50,] 52 0.80 0 0 0 0 297s [51,] 52 0.90 0 0 0 0 297s [52,] 32 1.00 1 1 3 1 297s [53,] 52 1.00 1 1 3 1 297s [54,] 52 1.10 1 1 3 1 297s [55,] 52 1.20 1 1 3 1 297s [56,] 32 2.00 1 1 3 2 297s [57,] 32 3.00 1 1 3 2 297s [58,] 32 4.00 1 1 3 3 297s [59,] 32 5.00 1 1 3 3 297s [60,] 2 128.00 3 3 9 8 297s [61,] 2 1024.00 4 4 13 11 297s [62,] 2 12288.00 5 5 16 14 297s [63,] 2 131072.00 6 6 19 18 297s [64,] 32 Inf 0 -646456992 0 -2147483645 297s > 297s > 297s > 297s > ## Bug example from RMH 2018-03-16 : 297s > (x <- mpfr(c(65, 650, 6500, 65000, 650000), precBits=6)) 297s 5 'mpfr' numbers of precision 6 bits 297s [1] 64 656 6530 6.45e+4 6.55e+5 297s > data.frame(fDec = formatDec(x), f = formatMpfr(x)) 297s fDec f 297s 1 64.0 64.0 297s 2 656. 656. 297s 3 6530. 6530. 297s 4 6.45e+4 6.45e+4 297s 5 6.55e+5 6.55e+5 297s > x. <- as.numeric(xDec <- formatDec(x)) 297s > stopifnot(abs(x - x.) <= c(0, 0, 2, 12, 360)) 297s > 297s > cat("Checking compatibility .mpfr_formatinfo() <--> .mpfr2str(*, base=2) :\n") 297s Checking compatibility .mpfr_formatinfo() <--> .mpfr2str(*, base=2) : 297s > for(nm in ls()) 297s + if(is(OO <- get(nm), "mpfr")) { 297s + cat(nm,": str(*) :\n"); str(OO); cat("compatibility: ") 297s + I <- .mpfr_formatinfo(OO) 297s + S <- .mpfr2str(OO, base = 2L) 297s + if(identical(I, S[-1])) 297s + cat("[Ok]\n") 297s + else { 297s + if(any(B <- !I$finite)) I$exp[B] <- S$exp[B] 297s + if(any(B <- I $ is.0)) I$exp[B] <- S$exp[B] 297s + if(identical(I, S[-1])) 297s + cat(" after fixup [Ok]\n") 297s + else 297s + stop(".mpfr_formatinfo(*) and .mpfr2str(*, base=2) do not match") 297s + } 297s + } 297s cents : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 23 and precision 64 297s -0.11 -0.1 -0.09 -0.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0 ... 297s compatibility: after fixup [Ok] 297s i8 : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 8 and precision 32 297s -2 -1 0 1 2 3 4 5 297s compatibility: after fixup [Ok] 297s ixk : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 64 and precisions 2..64 297s Inf 131072 12288 ... 297s compatibility: after fixup [Ok] 297s k1 : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 4 and precision 2 297s 1.e+2 1.e+3 1.e+4 1.e+5 297s compatibility: [Ok] 297s kxi : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 64 and precisions 2..64 297s NaN NaN -Inf -2 -1.2 ... 297s compatibility: after fixup [Ok] 297s L : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 1 and precision 100 297s 1.00328815073e+84509804 297s compatibility: [Ok] 297s L3 : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 1 and precision 100 297s 1.00989692356e+253529412 297s compatibility: [Ok] 297s mil : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 1 and precision 111 297s 1025 297s compatibility: [Ok] 297s r : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 1 and precision 100 297s 7.97921166432e-846 297s compatibility: [Ok] 297s r2 : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 1 and precision 100 297s 1.57035764922e-84510 297s compatibility: [Ok] 297s rv : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 3 and precision 100 297s 7.97921166432e-846 1.57035764922e-84510 1.00328815073e+84509804 297s compatibility: [Ok] 297s tenth : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 25 and precision 52 297s -1.2 -1.1 -1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 ... 297s compatibility: after fixup [Ok] 297s x : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 5 and precision 6 297s 64 660 6.5e+3 6.5e+4 6.6e+5 297s compatibility: [Ok] 297s x4 : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 4 and precision 32 297s NaN NaN -Inf Inf 297s compatibility: after fixup [Ok] 297s xx : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 1 and precision 111 297s 1.62954142022e+101023129 297s compatibility: [Ok] 297s z : str(*) : 297s Class 'mpfr' [package "Rmpfr"] of length 3 and precisions 8..32 297s 0.052734375 0.05263157895 0.05263157934 297s compatibility: [Ok] 297s > 297s BEGIN TEST matrix-ex.R 298s 298s R version 4.4.3 (2025-02-28) -- "Trophy Case" 298s Copyright (C) 2025 The R Foundation for Statistical Computing 298s Platform: arm-unknown-linux-gnueabihf (32-bit) 298s 298s R is free software and comes with ABSOLUTELY NO WARRANTY. 298s You are welcome to redistribute it under certain conditions. 298s Type 'license()' or 'licence()' for distribution details. 298s 298s R is a collaborative project with many contributors. 298s Type 'contributors()' for more information and 298s 'citation()' on how to cite R or R packages in publications. 298s 298s Type 'demo()' for some demos, 'help()' for on-line help, or 298s 'help.start()' for an HTML browser interface to help. 298s Type 'q()' to quit R. 298s 298s > stopifnot(require("Rmpfr")) 298s Loading required package: Rmpfr 298s Loading required package: gmp 298s 298s Attaching package: ‘gmp’ 298s 298s The following objects are masked from ‘package:base’: 298s 298s %*%, apply, crossprod, matrix, tcrossprod 298s 298s C code of R package 'Rmpfr': GMP using 32 bits per limb 298s 298s 298s Attaching package: ‘Rmpfr’ 298s 298s The following object is masked from ‘package:gmp’: 298s 298s outer 298s 298s > 298s > x <- mpfr(0:7, 64)/7 298s The following objects are masked from ‘package:stats’: 298s 298s dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm 298s 298s The following objects are masked from ‘package:base’: 298s 298s cbind, pmax, pmin, rbind 298s 298s > mx <- x 298s > dim(mx) <- c(4,2) 298s > (m. <- mx) # "print" 298s 'mpfrMatrix' of dim(.) = (4, 2) of precision 64 bits 298s [,1] [,2] 298s [1,] 0. 0.571428571428571428564 298s [2,] 0.142857142857142857141 0.714285714285714285691 298s [3,] 0.285714285714285714282 0.857142857142857142873 298s [4,] 0.428571428571428571436 1.00000000000000000000 298s > m.[,2] <- Const("pi", 80) 298s > m.[,] <- exp(mpfr(1, 90)) 298s > stopifnot(is(mx, "mpfrMatrix"), dim(mx) == c(4,2), 298s + is(m., "mpfrMatrix"), dim(m.) == dim(mx), 298s + dim(is.finite(mx)) == dim(mx), 298s + dim(is.nan(mx)) == dim(mx), 298s + getPrec(m.) == 90) 298s > 298s > xx <- (0:7)/7 298s > m.x <- matrix(xx, 4,2) 298s > m2 <- mpfr(xx, 64); dim(m2) <- dim(m.x) 298s > ## 298s > u <- 10*(1:4) 298s > y <- 7 * mpfr(1:12, 80) 298s > my <- y 298s > dim(my) <- 3:4 298s > m.y <- asNumeric(my) 298s > stopifnot(all.equal(m2, mpfr(m.x, 64), tol=0), # not identical(..) 298s + my[2,2] == 35, 298s + my[,1] == 7*(1:3)) 298s > 298s > .N <- function(x) { if(!is.null(dim(x))) as(x,"array") else as(x,"numeric") } 298s > noDN <- function(.) { dimnames(.) <- NULL ; . } 298s > allEQ <- function(x,y) all.equal(x,y, tol=1e-15) 298s > 298s > ## FIXME write "functions" that take x -> {mx , m.x} and run the following as *function* 298s > ## ---- then use previous case *and* cases with NA's ! 298s > ## and use higher precision via fPrec = 2 etc ... 298s > 298s > stopifnot(allEQ(m.x, noDN(.N(mx))), 298s + allEQ(m.y, noDN(.N(my))), 298s + allEQ(noDN(.N(my %*% mx)), m.y %*% m.x), 298s + allEQ(noDN(.N(crossprod(mx, t(my)))), crossprod(m.x, t(m.y))), 298s + allEQ(noDN(.N(tcrossprod(my, t(mx)))), 298s + tcrossprod(m.y, t(m.x))), 298s + ## 298s + identical(mx, t(t(mx))), 298s + identical(my, t(t(my))), 298s + ## matrix o vector .. even vector o vector 298s + identical(noDN(.N(my %*% 1:4)), m.y %*% 1:4 ), 298s + identical(noDN(.N(my %*% my[2,])), m.y %*% .N(my[2,])), 298s + identical( crossprod(1:3, my), 1:3 %*% my), 298s + identical(tcrossprod(1:4, my), 1:4 %*% t(my)), 298s + identical(crossprod(y), t(y) %*% y), 298s + identical(tcrossprod(y), y %*% t(y)), 298s + identical(noDN(.N( crossprod(y))), crossprod(7 * 1:12)), 298s + identical(noDN(.N(tcrossprod(y))),tcrossprod(7 * 1:12)), 298s + identical(tcrossprod(1:3, u), noDN(.N(tcrossprod(1:3, as(u,"mpfr"))))) 298s + ) 298s > 298s > mx[3,1] <- Const("pi", 64) 298s > stopifnot(allEQ(sum(mx[,1]), pi + 4/7)) 298s > m2 <- mx[c(1,4),] 298s > stopifnot(dim(m2) == c(2,2), sum(m2) == 2) 299s > 299s > ## "mpfrArray" o "mpfr" : 299s > Tmx <- array(TRUE, dim(mx), dimnames=dimnames(mx)) 299s > stopifnot(identical(Tmx, mx == (mx - mpfr(0, 10))), 299s + identical(Tmx, mx - mpfr(1, 10) * mx == 0)) 299s Note: method with signature ‘mpfrArray#mpfr’ chosen for function ‘==’, 299s target signature ‘mpfrMatrix#mpfrMatrix’. 299s "mpfr#mpfrArray" would also be valid 299s > ## subassignment, many kinds 299s > mx[5] <- pi 299s > mx[6] <- Const("pi",100) 299s > stopifnot(validObject(mx), allEQ(mx[5], mx[6]), 299s + getPrec(mx) == c(rep(64,5), 100, 64,64)) 299s > 299s > ## %*% with vectors on LHS, ... 299s > y <- t(2:4) # 1 x 3 matrix 299s > m1 <- (0:10) %*% y 299s > m2 <- mpfr(0:10, 50) %*% y 299s > stopifnot((d <- m1 - m2) == 0, identical(dim(m1), dim(d)), 299s + m2 == m1, m1 == m2) 299s > 299s > r <- 10*(0:4) 299s > y <- t(2:6) 299s > m1 <- 1:3 %*% y %*% r 299s > y. <- t(mpfr(2:6, 20)) 299s > m2 <- 1:3 %*% y. %*% r 299s > stopifnot(m1 == m2, m1 - m2 == 0, identical(dim(m1), dim(m2))) 299s > 299s > ### Array (non-matrix) ---- indexing & sub-assignment : 299s > A <- mpfrArray(1:24, prec = 96, dim = 2:4) 299s > a <- array(1:24, dim = 2:4) 299s > a.1 <- as(A[,,1], "array") 299s > a1. <- as(A[1,,], "array") 299s > A1. <- as(A[1,,], "mpfr") 299s > 299s > stopifnot(all.equal(noDN(a.1), a[,,1], tol=0), 299s + identical(A1., as.vector(A[1,,])), 299s + ## arithmetic, subsetting etc: 299s + allEQ(noDN(.N(A / A1.)), a/c(a1.)), 299s + allEQ(noDN(.N(a / A1.)), a/c(a1.)), 299s + identical(noDN(A == 23), a == 23), 299s + identical(noDN(10 >= A), 10 >= a), 299s + identical(noDN(A <= 2), a <= 2), 299s + identical(noDN(A < 2.5), a < 2.5), 299s + identical(noDN(A != 5), a != 5), 299s + identical(A != 3, !(3 == A)), 299s + identical(-1 > A, A == 100), 299s + identical(noDN(A <= 0), a == pi) 299s + ) 299s > 299s > A[1,2,3] <- Const("pi") 299s > A[1, ,2] <- 1 / A[1,,2] 299s > A 299s 'mpfrArray' of dim(.) = (2, 3, 4) of precision 96 .. 120 bits 299s , , 1 299s 299s [,1] [,2] 299s [1,] 1.00000000000000000000000000000 3.00000000000000000000000000000 299s [2,] 2.00000000000000000000000000000 4.00000000000000000000000000000 299s [,3] 299s [1,] 5.00000000000000000000000000000 299s [2,] 6.00000000000000000000000000000 299s 299s , , 2 299s 299s [,1] [,2] 299s [1,] 0.142857142857142857142857142858 0.111111111111111111111111111111 299s [2,] 8.00000000000000000000000000000 10.0000000000000000000000000000 299s [,3] 299s [1,] 0.0909090909090909090909090909098 299s [2,] 12.0000000000000000000000000000 299s 299s , , 3 299s 299s [,1] [,2] 299s [1,] 13.0000000000000000000000000000 3.1415926535897932384626433832795028847 299s [2,] 14.0000000000000000000000000000 16.0000000000000000000000000000 299s [,3] 299s [1,] 17.0000000000000000000000000000 299s [2,] 18.0000000000000000000000000000 299s 299s , , 4 299s 299s [,1] [,2] 299s [1,] 19.0000000000000000000000000000 21.0000000000000000000000000000 299s [2,] 20.0000000000000000000000000000 22.0000000000000000000000000000 299s [,3] 299s [1,] 23.0000000000000000000000000000 299s [2,] 24.0000000000000000000000000000 299s 299s > 299s > ## check that A is "==" a where 299s > a <- array(1:24, 2:4); a[1,2,3] <- pi; a[1,,2] <- 1/a[1,,2] 299s > stopifnot(allEQ(noDN(.N(A)), a), 299s + ## check aperm() methods : 299s + allEQ(noDN(.N(aperm(A))), aperm(a)), 299s + {p <- c(3,1:2); allEQ(noDN(.N(aperm(A,p))), aperm(a,p))}, 299s + {p <- c(2:1,3); allEQ(noDN(.N(aperm(A,p))), aperm(a,p))}) 299s > 299s > ## cbind() / rbind(): 299s > options(warn = 2)## no warnings here - ("exact recycling"): 299s > validObject(m0 <- cbind(pi=pi, i = 1:6)) 299s [1] TRUE 299s > validObject(m1 <- cbind(a=Const("pi",60),i = 1:6, "1/mp" = 1/mpfr(1:3,70))) 299s [1] TRUE 299s > validObject(m2 <- cbind(pi=pi, i = 1:2, 1/mpfr(1:6,70))) 299s [1] TRUE 299s > validObject(n2 <- rbind(pi=pi, i = 1:2, 1/mpfr(1:6,70))) 299s [1] TRUE 299s > stopifnot(is(m0,"matrix"), is(m1, "mpfrMatrix"), is(m2, "mpfrMatrix"), 299s + dim(m0) == c(6,2), dim(m1) == c(6,3), dim(m2) == c(6,3)) 299s > options(warn = 1) 299s > suppressWarnings(eval(ex <- quote(m3 <- cbind(I=10, 1:3, inv=1/mpfr(2:3,80))))) 299s > validObject(suppressWarnings( n3 <- rbind(I=10, 1:3, inv=1/mpfr(2:3,80)))) 299s [1] TRUE 299s > stopifnot(identical(t(n2), m2), 299s + identical(t(n3), m3), validObject(m3), 299s + is(tryCatch(eval(ex), warning=function(.).), "warning"), 299s + identical(cbind("A", "c"), matrix(c("A", "c"), 1,2)), 299s + identical(rbind("A", 2), matrix(c("A", "2"), 2,1)) ) 299s > 299s > ## head() / tail() : 299s > stopifnot(all.equal(c(21, 12), 299s + dim(mm3 <- m3[rep(1:3, each=7), rep(3:1, 4)])), 299s + all.equal(dim(t3 <- tail(mm3)), c(6, 12)), 299s + all.equal(head(mm3), mm3[1:6,])) 299s > 299s > ## matrix() works since 2015-02-28: 299s > x <- mpfr(pi,64)*mpfr(2,64)^(2^(0:19)) 299s > (mx <- matrix(x, 4,5)) 299s 'mpfrMatrix' of dim(.) = (4, 5) of precision 64 bits 299s [,1] [,2] 299s [1,] 6.28318530717958623200 205887.416145660681650 299s [2,] 12.5663706143591724640 13493037704.5220184326 299s [3,] 50.2654824574366898560 57952155664616980480.0 299s [4,] 804.247719318987037695 1.06902858406496670619e+39 299s [,3] [,4] 299s [1,] 3.63771576891766310100e+77 3.28104443733842154527e+1233 299s [2,] 4.21218708934506345775e+154 3.42668632977872042983e+2466 299s [3,] 5.64761954589225685791e+308 3.73765172555867836946e+4932 299s [4,] 1.01526868859647402324e+617 4.44680197657346404992e+9864 299s [,5] 299s [1,] 6.29427491061341831593e+19728 299s [2,] 1.26107681736228617526e+39457 299s [3,] 5.06212903659356755184e+78913 299s [4,] 8.15673870189463167140e+157826 299s > 299s > stopifnot(is(mx, "mpfrMatrix"), 299s + all.equal(matrix(0:19, 4,5), 299s + asNumeric(log2(log2(mx) - log2(Const("pi")))), 299s + tol = 1e-15)) # 64b-lnx: see 8.1e-17 299s > 299s > 299s > ## Ensure that apply() continues to work with 'bigz'/'bigq' 299s > A <- matrix(2^as.bigz(1:12), 3,4) 299s > Aq <- as.bigq(A) 299s > mA <- as(A, "mpfr") # failed {as dim(A) is "double", not "integer"} 299s > (Qm <- A / (A^2 - 1)) # big rational matrix 299s Big Rational ('bigq') 3 x 4 matrix: 299s [,1] [,2] [,3] [,4] 299s [1,] 2/3 16/255 128/16383 1024/1048575 299s [2,] 4/15 32/1023 256/65535 2048/4194303 299s [3,] 8/63 64/4095 512/262143 4096/16777215 299s > MQ <- mpfr(Qm, precBits = 64) 299s > stopifnot(exprs = { 299s + mA == A 299s + mA == Aq 299s + is.bigq(Aq) 299s + mA == mpfr(A, precBits=16) 299s + mA == asNumeric(A) 299s + is.bigq(Qm) 299s + is(MQ, "mpfrMatrix") 299s + all.equal(Qm, MQ, tol = 1e-18) 299s + identical(dim(mA), dim(A)) 299s + identical(dim(mA), dim(Qm)) 299s + identical(asNumeric(apply(A, 1, min)), 299s + apply(asNumeric(A), 1, min)) 299s + identical(asNumeric(apply(A, 1, max)), 299s + apply(asNumeric(A), 1, max)) 299s + identical(asNumeric(apply(A, 2, max)), 299s + apply(asNumeric(A), 2, max)) 299s + identical(asNumeric(apply(A, 2, min)), 299s + apply(asNumeric(A), 2, min)) 299s + }) 299s Warning in getPrec(x) : 299s default precision for 'bigq' arbitrarily chosen as 128 299s > ## mA etc, failed up to Rmpfr 0.8-1; the apply() parts failed up to Rmpfr 0.6.0 299s > 299s > if(FALSE) ## Bug in gmp : apply(*, range) does *not* return matrix 299s + stopifnot( 299s + identical(asNumeric(apply(A, 1, range)), 299s + apply(asNumeric(A), 1, range)) 299s + ) 299s > 299s > if(FALSE) ## Bug in gmp : --- no mean method for bigz, just mean.bigq 299s + stopifnot( 299s + all.equal(asNumeric(apply(A, 1, mean)), 299s + apply(asNumeric(A), 1, mean)) 299s + , 299s + all.equal(asNumeric(apply(A, 2, mean)), 299s + apply(asNumeric(A), 2, mean)) 299s + ) 299s > 299s > cat('Time elapsed: ', proc.time(),'\n') # "stats" 299s Time elapsed: 1.163 0.061 1.221 0.001 0.003 299s > if(!interactive()) warnings() 299s > 299s BEGIN TEST special-fun-ex.R 299s 299s R version 4.4.3 (2025-02-28) -- "Trophy Case" 299s Copyright (C) 2025 The R Foundation for Statistical Computing 299s Platform: arm-unknown-linux-gnueabihf (32-bit) 299s 299s R is free software and comes with ABSOLUTELY NO WARRANTY. 299s You are welcome to redistribute it under certain conditions. 299s Type 'license()' or 'licence()' for distribution details. 299s 299s R is a collaborative project with many contributors. 299s Type 'contributors()' for more information and 299s 'citation()' on how to cite R or R packages in publications. 299s 299s Type 'demo()' for some demos, 'help()' for on-line help, or 299s 'help.start()' for an HTML browser interface to help. 299s Type 'q()' to quit R. 299s 299s > stopifnot(require("Rmpfr")) 299s Loading required package: Rmpfr 299s Loading required package: gmp 299s 299s Attaching package: ‘gmp’ 299s 299s The following objects are masked from ‘package:base’: 299s 299s %*%, apply, crossprod, matrix, tcrossprod 299s 299s C code of R package 'Rmpfr': GMP using 32 bits per limb 299s 299s 299s Attaching package: ‘Rmpfr’ 299s 299s The following object is masked from ‘package:gmp’: 299s 299s outer 299s 299s The following objects are masked from ‘package:stats’: 299s 299s dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm 299s 299s > (doExtras <- Rmpfr:::doExtras()) 299s [1] FALSE 299s > options(nwarnings = 50000, width = 99) 299s > 299s > (do.pdf <- !dev.interactive(orNone = TRUE)) 299s [1] TRUE 299s > if(do.pdf) { 299s + pdf.options(width = 8.5, height = 6) # for all pdf plots 299s + pdf("special-fun.pdf") 299s + } 299s The following objects are masked from ‘package:base’: 299s 299s cbind, pmax, pmin, rbind 299s 299s > 299s > 299s > ## to enhance |rel.Err| plots: {also in ~/R/Pkgs/DPQ/tests/pow-tst.R } 299s > drawEps.h <- function(p2 = -(53:51), side = 4, lty=3, lwd=2, col=adjustcolor(2, 1/2)) { 299s + abline(h = 2^p2, lty=lty, lwd=lwd, col=col) 299s + axis(side, las=2, line=-1, at = 2^p2, 299s + labels = as.expression(lapply(p2, function(p) substitute(2^E, list(E=p)))), 299s + col.axis = col, col=NA, col.ticks=NA) 299s + } 299s > mtextVersion <- function(adj = 1, col = 1) { 299s + mtext(osVersion, line=1, col=col, adj=adj) 299s + mtext(sfsmisc::shortRversion(spaces=FALSE), col=col, adj=adj) 299s + } 299s > 299s > all.eq.finite <- function(x,y, ...) { 299s + ## x = 'target' y = 'current' 299s + if(any(is.finite(y[!(fx <- is.finite(x))]))) 299s + return("current has finite values where target has not") 299s + if(any(is.finite(x[!(fy <- is.finite(y))]))) 299s + return("target has finite values where current has not") 299s + ## now they have finite values at the same locations 299s + all.equal(x[fx], y[fy], ...) 299s + } 299s > 299s > 299s > 299s > n <- 1000 299s > head(x <- mpfr(0:n, 100) / n) 299s 6 'mpfr' numbers of precision 100 bits 299s [1] 0 0.0010000000000000000000000000000008 299s [3] 0.0020000000000000000000000000000015 0.0030000000000000000000000000000007 299s [5] 0.004000000000000000000000000000003 0.0050000000000000000000000000000022 299s > 299s > stopifnot(exprs = { 299s + range(x) == 0:1 299s + all.equal(as.numeric(j0(x)), besselJ(as.numeric(x), 0), tol = 1e-14) 299s + all.equal(as.numeric(j1(x)), besselJ(as.numeric(x), 1), tol = 1e-14) 299s + all.equal(as.numeric(y0(x)), besselY(as.numeric(x), 0), tol = 1e-14) 299s + all.equal(as.numeric(y1(x)), besselY(as.numeric(x), 1), tol = 1e-14) 299s + }) 300s > 300s > ### pnorm() -> erf() : ---------------------------------------------------------- 300s > u <- 7*x - 2 300s > stopifnot(all.equal(pnorm(as.numeric(u)), 300s + as.numeric(pnorm(u)), tol = 1e-14)) 300s > ## systematic random input testing: 300s > set.seed(101) 300s > if(doExtras) { 300s + nSim <- 50 300s + n2 <- 100 300s + } else { 300s + nSim <- 10 300s + n2 <- 64 300s + } 300s > for(n in 1:nSim) { 300s + N <- rpois(1, lambda=n2) 300s + N3 <- N %/% 3 300s + x <- c(rnorm(N-N3), 10*rt(N3, df=1.25))# <- some large values 300s + m <- rnorm(N, sd = 1/32) 300s + s <- rlnorm(N, sd = 1/8) 300s + cEps <- .Machine$double.eps 300s + for(LOG in c(TRUE,FALSE)) 300s + for(L.T in c(TRUE,FALSE)) { 300s + p. <- pnorm( x, m=m,sd=s, log.p=LOG, lower.tail=L.T) 300s + stopifnot(all.equal(p., pnorm(mpfr(x, precBits= 48), m=m,sd=s, 300s + log.p=LOG, lower.tail=L.T), 300s + tol = 128 * cEps)) 300s + stopifnot(all.equal(p., pnorm(mpfr(x, precBits= 60), m=m,sd=s, 300s + log.p=LOG, lower.tail=L.T), 300s + tol = 2 * cEps)) 300s + } 300s + cat(".") 300s + };cat("\n") 302s .......... 302s > proc.time() 302s user system elapsed 302s 2.878 0.215 3.084 302s > 302s > ## Jerry Lewis - Aug 2, 2019 302s > ## Contrast the results of pnorm with double and mpfr inputs 302s > x <- c(1:9, 5*(2:9), 10*(5:20)) ; x <- c(-rev(x), 0, x) 302s > pdL <- pnorm(x, log.p=TRUE) 302s > pdU <- pnorm(x, log.p=TRUE, lower.tail=FALSE) 302s > stopifnot(exprs = { 302s + !is.unsorted(x) 302s + 35 %in% x 302s + x == -rev(x) # exactly 302s + pdL == rev(pdU) # even exactly, currently 302s + }) 302s > mx <- mpfr(x, precBits = 128) 302s > pmL <- pnorm(mx, log.p=TRUE) 302s > pmU <- pnorm(mx, log.p=TRUE, lower.tail=FALSE) 302s > stopifnot(exprs = { 302s + pmL < 0 # not true for 'pdL' which underflows 302s + pmL == rev(pmU) # even exactly, currently 302s + all.equal(pmL, pdL, tol=4e-16) # 'tol=0' shows 4.46e-17 302s + }) 302s > ## some explorations : 302s > dlp <- diff(log(-pmL))/diff(x) 302s > n <- length(x) 302s > x.1 <- (x[-1] + x[-n])/2 302s > plot(x.1, dlp, type="b", ylab = "d/dx log(-pnorm(., log=TRUE))"); mtextVersion() 302s > plot(x.1[-1], diff(dlp)/diff(x.1), type="b", ylab = "d^2/dx^2 log(-pnorm(., log=TRUE))") 302s > stopifnot(exprs = { 302s + -1 < (d2 <- diff(dlp)/diff(x.1)) 302s + d2 < 0 302s + diff(d2) < 0 302s + }) 302s > x.3 <- x.1[-c(1L,n-1L)] 302s > plot(x.3, -diff(d2)/ diff(x.1)[-1], type="o", log="y") 302s > 302s > 302s > 302s > 302s > ### Riemann's Zeta function: ---------------------------------------------------- 302s > 302s > ## -- integer arguments -- 302s > stopifnot(all(mpfrIs0(zeta(-2*(1:100))))) 302s > 302s > k.neg <- 2*(-100:0) - 1 302s > Z.neg <- zeta(k.neg) 302s > plot(k.neg, abs(as.numeric(Z.neg)), type = "l", log="y") 302s > 302s > Pi <- Const("pi", 128L) 302s > 302s > ## confirm published value of Euler's gamma to 100 digits 302s > pub.g <- 302s + paste("0.5772156649", "0153286060", "6512090082", "4024310421", "5933593992", 302s + "3598805767", "2348848677", "2677766467", "0936947063", "2917467495", 302s + sep="") 302s > 302s > ## almost = 302s > our.g <- Const("gamma", log2(10) * 100) # 100 digits 302s > (ff.g <- .mpfr2str(our.g)) 302s $str 302s [1] "57721566490153286060651209008240243104215933593992359880576723488486772677766467093694706329174674948" 302s 302s $exp 302s [1] 0 302s 302s $finite 302s [1] TRUE 302s 302s $is.0 302s [1] FALSE 302s 302s > 302s > 302s > M <- function(x) mpfr(x, 128L) 302s > stopifnot(all.equal(zeta( 0), -1/2, tol = 2^-100) 302s + , all.equal(zeta(-1), -1/M(12), tol = 2^-100) 302s + , all.equal(zeta(-3), 1/M(120), tol = 2^-100) 302s + ## positive ones : 302s + , all.equal(zeta(2), Pi^2/6, tol = 2^-100) 302s + , all.equal(zeta(4), Pi^4/90, tol = 2^-100) 302s + , all.equal(zeta(6), Pi^6/945, tol = 2^-100) 302s + ) 302s > 302s > ### Exponential Integral Ei(.) 302s > curve(Ei, 0,5, n=5001) 302s > if(mpfrVersion() >= "3") { ## only available since MPFR 3.0.0 302s + ### Airy function Ai(.) 302s + curve(Ai, -10, 5, n=5001); abline(h=0,v=0, col="gray", lty=3) 302s + } 302s > 302s > ### Utilities hypot(), atan2() : -------------------------------------------------------------- 302s > 302s > ## ======= TODO! ======== 302s > 302s > ## beta(), lbeta() 302s > ## --------------- 302s > ## The simplistic "slow" versions: 302s > B <- function(a,b) { a <- as(a, "mpfr"); b <- as(b, "mpfr"); gamma(a)*gamma(b) / gamma(a+b) } 302s > lB <- function(a,b) { a <- as(a, "mpfr"); b <- as(b, "mpfr"); lgamma(a)+lgamma(b) - lgamma(a+b) } 302s > 302s > ## For partly *integer* arguments 302s > Bi1 <- function(a,b) 1/(a*chooseMpfr(a+b-1, a)) # a must be integer >= 0 302s > Bi2 <- function(a,b) 1/(b*chooseMpfr(a+b-1, b)) # b must be integer >= 0 302s > 302s > x <- 1:10 + 0 ; (b10 <- mpfr(x, 128L)) 302s 10 'mpfr' numbers of precision 128 bits 303s [1] 1 2 3 4 5 6 7 8 9 10 303s > 303s > stopifnot(all.equal( B(1,b10), 1/x), 303s + all.equal( B(2,b10), 1/(x*(x+1))), 303s + all.equal( beta(1,b10), 1/x), 303s + all.equal( beta(2,b10), 1/(x*(x+1))), 303s + TRUE) 303s > 303s > if(do.pdf) { dev.off(); pdf("special-fun-beta.pdf") } 303s > 303s > 303s > x <- -10:10 + 0; X <- mpfr(x, 128L) 303s > stopifnot(exprs = { 303s + Bi1(1,X) == (B1x <- Bi2(X,1)) 303s + Bi1(2,X) == (B2x <- Bi2(X,2)) 303s + Bi1(3,X) == (B3x <- Bi2(X,3)) 303s + all.equal(B1x, 1/x, tol= 4e-16) 303s + all.equal(B2x, 1/(x*(x+1)), tol= 8e-16) 303s + all.equal(B3x, 2/(x*(x+1)*(x+2)), tol=16e-16) 303s + ## these the "poles" are all odd i.e. result in { +Inf / -Inf / NaN} 303s + ## are all "ok" {e.g. 1/(x*(x+1)) gives (-Inf, Inf) for x = -1:0 } 303s + all.eq.finite(beta(1,X), 1/x) 303s + all.eq.finite(beta(X,2), 1/(x*(x+1))) 303s + all.eq.finite(beta(3,X), 2/(x*(x+1)*(x+2)), tol=16e-16) 303s + }) 303s > 303s > ## (a,b) *both* integer, one negative: 303s > for(i in (-20):(-1)) { 303s + cat(i,":\n") 303s + a <- mpfr(i, 99) 303s + i1 <- i+1 303s + b. <- seq_len(-i1) 303s + Bab <- beta(a, b.) 303s + stopifnot(is.nan(beta(a, (i1:0))), is.nan(lbeta(a, (i1:0))), 303s + all.equal(Bab, Bi2(a, b.), tol=1e-20), 303s + all.equal(lbeta(a, b.), log(abs(Bab)), tol=1e-20), allow.logical0 = TRUE) 303s + } 303s -20 : 303s -19 : 303s -18 : 303s -17 : 303s -16 : 303s -15 : 303s -14 : 303s -13 : 303s -12 : 303s -11 : 303s -10 : 303s -9 : 303s -8 : 303s -7 : 303s -6 : 303s -5 : 303s -4 : 303s -3 : 303s -2 : 303s -1 : 303s > 303s > ## (a,b) all positive 303s > c10 <- b10 + 0.25 303s > for(a in c(0.1, 1, 1.5, 2, 20)) { 303s + stopifnot(all.equal( B(a,b10), (bb <- beta(a, b10))), 303s + all.equal(lB(a,b10), (lb <- lbeta(a, b10))), all.equal(lb, log(bb)), 303s + all.equal( B(a,c10), (bb <- beta(a, c10))), 303s + all.equal(lB(a,c10), (lb <- lbeta(a, c10))), all.equal(lb, log(bb)), 303s + TRUE) 303s + } 303s > 303s > ## However, the speedup is *not* much (50%) when applied to vectors: 303s > stopifnot(validObject(xx <- outer(b10, runif(20))), 303s + dim(xx) == c(length(b10), 20), 303s + validObject(vx <- as(xx, "mpfr")), class(vx) == "mpfr", is.null(dim(vx))) 303s > C1 <- replicate(10, system.time(bb <<- beta(vx, vx+2))) 304s > C2 <- replicate(10, system.time(b2 <<- B(vx, vx+2))) 305s > summary(1000*C1[1,]) ## 80.3 {cmath-5, 2009} 305s Min. 1st Qu. Median Mean 3rd Qu. Max. 305s 21.00 22.25 23.00 22.80 23.00 24.00 305s > summary(1000*C2[1,]) ## 125.1 { " } 305s Min. 1st Qu. Median Mean 3rd Qu. Max. 305s 30.0 31.0 32.0 31.7 32.0 33.0 305s > stopifnot(all.equal(bb, b2)) 305s > ## and for a single number, the speedup is a factor 3: 305s > x1 <- vx[1]; x2 <- x1+2 305s > system.time(for(i in 1:100) bb <- beta(x1, x2))# .27 305s user system elapsed 305s 0.076 0.005 0.081 305s > system.time(for(i in 1:100) b2 <- B(x1, x2))# .83 305s user system elapsed 305s 0.197 0.012 0.209 305s > 305s > ## a+b is integer <= 0, but a and b are not integer: 305s > a <- b <- .5 + -10:10 305s > ab <- data.matrix(expand.grid(a=a, b=b, KEEP.OUT.ATTRS=FALSE)) 305s > ab <- mpfr(ab[rowSums(ab) <= 0, ], precBits = 128) 305s > stopifnot( beta(ab[,"a"], ab[,"b"]) == 0, 305s + lbeta(ab[,"a"], ab[,"b"]) == -Inf) 305s > ## was NaN in Rmpfr <= 0.5-2 305s > 305s > stopifnot(all.equal(6 * beta(mpfr(1:3,99), -3.), c(-2,1,-2), tol=1e-20)) 305s > ## add more checks, notably for b (> 0) above and below the "large_b" in 305s > ## ../src/utils.c : 305s > bb <- beta(mpfr(1:23, 128), -23) 305s > stopifnot(all.equal(bb, Bi1(1:23, -23), tol=1e-7)) 305s > # Bi1() does not get high prec for small b 305s > ## can be written via rationals: N / D : 305s > bn <- c(330, -360, 468, -728, 1365, -3120, 8840, -31824, 305s + 151164, -1007760, 10581480, -232792560) 305s > bn <- c(rev(bn[-1]), bn) 305s > bd <- 24* as.bigz(2 * 3 * 5 * 7 * 11) * 13 * 17 * 19 * 23 305s > stopifnot(all.equal(bb, as(bn/bd,"mpfr"), tol=0)) 305s > 305s > stopifnot(all.equal(6 * beta(mpfr(1:3, 99), -3.), 305s + c(-2,1,-2), tol=1e-20), 305s + all.equal( lbeta(mpfr(1:3, 128), -3.), 305s + log(mpfr(c( 2,1, 2), 128) / 6), tol=1e-20)) 305s > 305s > ## add more checks, notably for b (> 0) above and below the "large_b" in 305s > ## ../src/utils.c : 305s > bb <- beta(mpfr(1:23, 128), -23) 305s > stopifnot(all.equal(bb, Bi1(1:23, -23), tol=1e-7)) 305s > # Bi1() does not get high prec for small b 305s > ## can be written via rationals: N / D : 305s > bn <- c(330, -360, 468, -728, 1365, -3120, 8840, -31824, 305s + 151164, -1007760, 10581480, -232792560) 305s > bn <- c(rev(bn[-1]), bn) 305s > bd <- 24* as.bigz(2 * 3 * 5 * 7 * 11) * 13 * 17 * 19 * 23 305s > stopifnot(all.equal(bb, as(bn/bd,"mpfr"), tol=0)) 305s > 305s > ## 2) add check for 'b' > maximal unsigned int {so C code uses different branch} 305s > two <- mpfr(2, 128) 305s > for(b in list(mpfr(9, 128), mpfr(5, 128)^10, two^25, two^26, two^100)) { 305s + a <- -(b+ (1:7)) 305s + stopifnot(a+b == -(1:7), # just ensuring that there was no cancellation 305s + is.finite( B <- beta(a,b)), ## was NaN .. 305s + is.finite(lB <- lbeta(a,b)), ## ditto 305s + all.equal(log(abs(B)), lB), 305s + TRUE) 305s + } 305s > 305s > ee <- c(10:145, 5*(30:59), 10*(30:39), 25*(16:30)) 305s > b <- mpfr(2, precBits = 10 + max(ee))^ee # enough precision {now "automatic"} 305s > stopifnot((b+4)-b == 4, # <==> enough precision above 305s + b == (b. <- as(as(b,"bigz"),"mpfr"))) 305s > (pp <- getPrec(b.))# shows why b. is not *identical* to b. 305s [1] 12 12 16 16 16 16 20 20 20 20 24 24 24 24 28 28 28 28 32 32 32 32 36 305s [24] 36 36 36 40 40 40 40 44 44 44 44 48 48 48 48 52 52 52 52 56 56 56 56 305s [47] 60 60 60 60 64 64 64 64 68 68 68 68 72 72 72 72 76 76 76 76 80 80 80 305s [70] 80 84 84 84 84 88 88 88 88 92 92 92 92 96 96 96 96 100 100 100 100 104 104 305s [93] 104 104 108 108 108 108 112 112 112 112 116 116 116 116 120 120 120 120 124 124 124 124 128 305s [116] 128 128 128 132 132 132 132 136 136 136 136 140 140 140 140 144 144 144 144 148 148 152 156 305s [139] 164 168 172 176 184 188 192 196 204 208 212 216 224 228 232 236 244 248 252 256 264 268 272 305s [162] 276 284 288 292 296 304 312 324 332 344 352 364 372 384 392 404 428 452 476 504 528 552 576 305s [185] 604 628 652 676 704 728 752 305s > system.time(Bb <- beta(-b-4, b))# 0.334 sec 306s user system elapsed 306s 0.099 0.005 0.104 306s > if(dev.interactive()) 306s + plot(ee, asNumeric(log(Bb)), type="o",col=2) 306s > lb <- asNumeric(log(Bb)) 306s > ## using coef(lm(lb ~ ee)) 306s > stopifnot(all.equal(lb, 3.175933 -3.46571851*ee, tol = 1e-5))# 4.254666 e-6 306s > 306s > 306s > bb <- beta( 1:4, mpfr(2,99)) 306s > stopifnot(identical(bb, beta(mpfr(2,99), 1:4)), 306s + all.equal((2*bb)*cumsum(1:4), rep(1, 4), tol=1e-20), 306s + getPrec(bb) == 128) 306s > 306s > 306s > ##-- The d*() density functions from ../R/special-fun.R | ../man/distr-etc.Rd --- 306s > 306s > if(do.pdf) { dev.off(); pdf("special-fun-density.pdf") } 306s > 306s > dx <- 1400+ 0:10 306s > mx <- mpfr(dx, 120) 306s > nx <- sort(c(c(-32:32)/2, 50*(-8:8))) 306s > 306s > xL <- 2^(989+(0:139)/4) # "close" to double.xmax 306s > dnbD <- dnbinom(xL, prob=1-1/4096, size=1e307, log=TRUE)# R's own 306s > iF <- -(130:140) # index of finite dnbD[] 306s > dnbx8 <- dnbinom(xL, prob=1-mpfr(2, 2^ 8)^-12, size=1e307, log=TRUE) 306s > dnbx10 <- dnbinom(xL, prob=1-mpfr(2, 2^10)^-12, size=1e307, log=TRUE) 306s > dnbx13 <- dnbinom(xL, prob=1-mpfr(2, 2^13)^-12, size=1e307, log=TRUE) 306s > 306s > stopifnot(exprs = { 306s + all.equal(dpois(dx, 1000), dpois(mx, 1000), tol = 3e-13) # 64b Lnx: 7.369e-14 306s + all.equal(dbinom(0:16, 16, pr = 4 / 5), 306s + dbinom(0:16, 16, pr = 4/mpfr(5, 128)) -> db, tol = 5e-15)# 64b Lnx: 4.3e-16 306s + all.equal(dnorm( -3:3, m=10, s=1/4), 306s + dnorm(mpfr(-3:3, 128), m=10, s=1/4), tol = 1e-15) # 64b Lnx: 6.45e-17 306s + all.equal(dnorm(nx), dnorm(mpfr(nx, 99)), tol = 1e-15) 306s + all.equal(dnorm( nx, m = 4, s = 1/4), 306s + dnorm(mpfr(nx, 99), m = 4, s = 1/4), tol = 1e-15) 306s + all.equal(dnorm( nx, m = -10, s = 1/4, log=TRUE), 306s + dnorm(mpfr(nx, 99), m = -10, s = 1/4, log=TRUE), tol = 1e-15) 306s + ## t-distrib. : 306s + all.equal(dt(nx, df=3), dt(mpfr(nx, 99), df=3), tol = 1e-15) 306s + all.equal(dt( nx, df = 0.75), 306s + dt(mpfr(nx, 99), df = 0.75), tol = 1e-15) 306s + all.equal(dt( nx, df = 2.5, log=TRUE), 306s + dt(mpfr(nx, 99), df = 2.5, log=TRUE), tol = 1e-15) 306s + ## negative binomial dnbinom(): 306s + all.equal(dnbx13, dnbx10, tol = 2^-999) # see 2^-1007, but not 2^-1008 306s + all.equal(dnbx13, dnbx8, tol = 2^-238) # see 2^-239, but not 2^-240 306s + all.equal(dnbx10[iF], dnbD[iF], tol = 6e-16) # R's *is* accurate here (seen 2.9e-16) 306s + }) 307s > 307s > 307s > ## plot dt() "error" of R's implementation 307s > nx <- seq(-100, 100, by=1/8) 307s > dtd <- dt( nx, df= .75) 307s > dtM <- dt(mpfr(nx, 256), df= .75) 307s > if(doExtras) withAutoprint({ 307s + system.time( 307s + dtMx <- dt(mpfr(nx, 2048), df= .75) ) # 2.5 sec 307s + stopifnot(all.equal(dtMx, dtM, tol = 2^-254)) # almost all of dtM's 256 bits are correct 307s + }) 307s > relE <- asNumeric(dtd/dtM - 1) 307s > plot(relE ~ nx, type="l", col=2); mtextVersion() 307s > plot(abs(relE) ~ nx, type="l", col=2, log="y", ylim=c(5e-17, 1.5e-15)) 307s > 307s > ## ============== even smaller 'df' such that lgamma1p(df) is better than lgamma(1+df) ==== 307s > 307s > require(sfsmisc)# -> eaxis(); relErrV() 307s Loading required package: sfsmisc 307s > 307s > u <- sort(outer(10^-(20:1), c(1,2,5))) # *not* "exact" on purpose 307s 307s Attaching package: ‘sfsmisc’ 307s 307s The following objects are masked from ‘package:gmp’: 307s 307s factorize, is.whole 307s 307s > ## .. unfinished .. exploring *when* dt() would suffer from inaccurate stirlerr() -- would it? 307s > 307s > nu <- 2^-(70:1) 307s > dt10 <- dt( 10, df=nu) 307s > dt10M <- dt(mpfr(10, 1024), df=nu) 308s > re10 <- asNumeric(relErrV(dt10M, dt10)) 308s > 308s > plot(re10 ~ nu, type="l", lwd=2, log="x", main = quote(rel.Err( dt(10, df==nu) )), 308s + xaxt="n"); eaxis(1, nintLog=20) 308s > mtextVersion() 308s > abline(h = (-1:1)*2^-53, lty=4, col=adjustcolor("blue", 1/2)) 308s > 308s > plot(abs(re10) ~ nu, type="l", lwd=2, log="xy", 308s + xlab = quote(df == nu), ylab = quote(abs(relE)), 308s + main = quote(abs(rel.Err( dt(10, df==nu) ))), xaxt="n", yaxt="n") 308s > eaxis(1, nintLog=20); eaxis(2); drawEps.h() 308s > 308s > x0 <- c(0, 10^(-5:10)) # only >= 0 should be sufficient; x0 <- c(-rev(x0),0,x0) 308s > stopifnot(!is.unsorted(nu), # just for plotting .. 308s + !is.unsorted(x0)) 308s > xnu <- expand.grid(x=x0, df=nu) 308s > dt2 <- with(xnu, dt( x, df=df)) 308s > dtM2 <- with(xnu, dt(mpfr(x, 512), df=df)) 308s > str(relE2 <- `attributes<-`(asNumeric(relErrV(dtM2, dt2)), 308s + attr(xnu, "out.attrs"))) 308s num [1:17, 1:70] 1.78e-15 1.08e-15 1.11e-15 7.85e-16 1.73e-15 ... 308s - attr(*, "dimnames")=List of 2 308s ..$ x : chr [1:17] "x=0e+00" "x=1e-05" "x=1e-04" "x=1e-03" ... 308s ..$ df: chr [1:70] "df=8.470329e-22" "df=1.694066e-21" "df=3.388132e-21" "df=6.776264e-21" ... 308s > 308s > ## consistency check that with() etc was fine: 308s > stopifnot(identical(re10, unname(relE2[which(x0 == 10), ]))) 308s > 308s > filled.contour(x=log10(1e-7+x0), y=log10(nu), z = relE2) 308s > filled.contour(x=log10(1e-7+x0), y=log10(nu), z = abs(relE2)) 309s > ## around nu = 10^-16 is the most critical place 309s > 309s > (pch <- c(1L:9L, 0L, letters, LETTERS)[1:ncol(relE2)]) 309s [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" 309s [24] "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" 309s [47] "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" NA NA NA NA NA NA NA 309s [70] NA 309s > 309s > matplot(x0+1e-7, relE2, type="b", log="x", main="rel.err{ dt(x, df=df) }") 309s > legend("topright", legend = paste0("df=",formatC(nu,wid=3)), ncol=7, 309s + bty="n", lwd=1, pch=pch, col=1:6, lty=1:5, cex = 0.8) 309s Warning message: 309s In matplot(x0 + 1e-07, relE2, type = "b", log = "x", main = "rel.err{ dt(x, df=df) }") : 309s default 'pch' is smaller than number of columns and hence recycled 309s > abline(h = c(-4:4)*2^-53, lty=3, col="gray") 309s > 309s > matplot(nu, t(relE2), type="b", log="x", main="rel.err{ dt(x, df=df) }") 309s > legend("topright", legend = paste0("x=",formatC(x0,wid=3)), ncol=7, 309s + bty="n", lwd=1, pch=pch, col=1:6, lty=1:5, cex = 0.8) 309s > abline(h = c(-4:4)*2^-53, lty=3, col="gray") 309s > 309s > matplot(nu, pmax(abs(t(relE2)), 1e-19), type="b", log="xy", axes=FALSE, ylab = quote(abs("rel Err")), 309s + ylim = c(7e-17, max(abs(relE2))), main="|rel.err{ dt(x, df=df)}|") 309s > eaxis(1, nintLog=22) ; eaxis(2, line=-1/2); drawEps.h() 309s > legend("topright", legend = paste0("x=",formatC(x0,wid=3)), ncol=7, 309s + bty="n", lwd=1, pch=pch, col=1:6, lty=1:5, cex = 0.8) 309s > 309s > 309s > 1 309s [1] 1 309s > ## dnbinom() -- has mode as expected, but with huge size, the scales are "off reality" .. 309s > 309s > ### ..... TODO ! 309s > 309s > ### dgamma(): ---------------------------------------------------- 309s > if(do.pdf) { dev.off(); pdf("special-fun-dgamma.pdf") } 309s > 309s > xe <- c(-2e5, -1e5, -2e4, -1e4, -2000, -1000, -500, -200, -100, -50, -20, -10) 309s > (xe <- c(xe, -8:8, -rev(xe))) 309s [1] -2e+05 -1e+05 -2e+04 -1e+04 -2e+03 -1e+03 -5e+02 -2e+02 -1e+02 -5e+01 -2e+01 -1e+01 -8e+00 309s [14] -7e+00 -6e+00 -5e+00 -4e+00 -3e+00 -2e+00 -1e+00 0e+00 1e+00 2e+00 3e+00 4e+00 5e+00 309s [27] 6e+00 7e+00 8e+00 1e+01 2e+01 5e+01 1e+02 2e+02 5e+02 1e+03 2e+03 1e+04 2e+04 309s [40] 1e+05 2e+05 309s > two <- mpfr(2, 64) 309s > ## For centering at E[.], will use xP(x, shp) : 309s > xP <- function(x, d) x - d*(x > d) 309s > aEQformat <- function(xy, ...) format(xy, digits = 7, ...) 309s > allEQ_0 <- function (target, current, ...) 309s + all.equal(target, current, tolerance = 0, formatFUN = aEQformat, ...) 309s > stopIfNot <- 309s + if("allow.logical0" %in% names(formals(stopifnot))) { # experimental (MM only) 309s + stopifnot 309s + } else function(exprs, allow.logical0) stopifnot(exprs=exprs) 309s > 309s > for(shp in c(2^c(-20, -3, -1:1, 4, 10, 50))) { 309s + cat("shape = 2^", log2(shp), ":\n-------------\n") 309s + d.dg <- dgamma(xP(2 ^ xe, shp), shape=shp) 309s + m.dg <- dgamma(xP(two^xe, shp), shape=shp) 309s + m.ldg <- dgamma(xP(two^xe, shp), shape=shp, log=TRUE) 309s + stopIfNot(exprs = { 309s + !is.unsorted(xe) 309s + is.finite(m.dg) 309s + m.dg >= 0 309s + shp > 1 || all(diff(m.dg) <= 0) 309s + shp > 100|| all((m.dg > 0) >= (d.dg > 0)) 309s + any(fin.d <- is.finite(d.dg)) 309s + m.dg[!fin.d] > 1e300 309s + { cat("all.EQ(, ):", allEQ_0(m.dg[fin.d], d.dg[fin.d]), "\n") 309s + shp > 100 || all.equal(m.dg[fin.d], d.dg[fin.d], 309s + tol = 1e-13) # 2.063241e-14 309s + } 309s + ## compare with log scale : 309s + if(any(pos.d <- m.dg > 0)) { 309s + cat("all.EQ(log(d), d*(log)):", 309s + allEQ_0 (log(m.dg[pos.d]), m.ldg[pos.d]),"\n") 309s + all.equal(log(m.dg[pos.d]), m.ldg[pos.d], tol = 1e-14) 309s + } 309s + }, allow.logical0 = TRUE) 309s + } 309s shape = 2^ -20 : 309s ------------- 309s all.EQ(, ): Mean relative difference: 5.766884e-16 309s all.EQ(log(d), d*(log)): Mean relative difference: 4.826256e-16 309s shape = 2^ -3 : 309s ------------- 309s all.EQ(, ): Mean relative difference: 1.723515e-16 309s all.EQ(log(d), d*(log)): Mean relative difference: 8.342404e-20 309s shape = 2^ -1 : 309s ------------- 309s all.EQ(, ): Mean relative difference: 2.536642e-17 309s all.EQ(log(d), d*(log)): Mean relative difference: 7.917217e-20 309s shape = 2^ 0 : 309s ------------- 309s all.EQ(, ): Mean relative difference: 2.432573e-17 309s all.EQ(log(d), d*(log)): Mean relative difference: 1.509670e-19 309s shape = 2^ 1 : 309s ------------- 309s all.EQ(, ): Mean relative difference: 1.133389e-16 309s all.EQ(log(d), d*(log)): TRUE 309s shape = 2^ 4 : 309s ------------- 309s all.EQ(, ): Mean relative difference: 1.911332e-16 309s all.EQ(log(d), d*(log)): TRUE 309s shape = 2^ 10 : 309s ------------- 309s all.EQ(, ): Mean relative difference: 5.728002e-17 309s all.EQ(log(d), d*(log)): TRUE 309s shape = 2^ 50 : 309s ------------- 309s all.EQ(, ): Mean relative difference: 0.001523136 309s all.EQ(log(d), d*(log)): TRUE 309s > 309s > cat('Time elapsed: ', proc.time(),'\n') # "stats" 309s Time elapsed: 9.773 0.591 10.362 0.003 0.001 309s > if(!interactive()) warnings() 309s Warning message: 309s In matplot(x0 + 1e-07, relE2, type = "b", log = "x", main = "rel.err{ dt(x, df=df) }") : 309s default 'pch' is smaller than number of columns and hence recycled 309s > 309s BEGIN TEST tstHexBin.R 309s 309s R version 4.4.3 (2025-02-28) -- "Trophy Case" 309s Copyright (C) 2025 The R Foundation for Statistical Computing 309s Platform: arm-unknown-linux-gnueabihf (32-bit) 309s 309s R is free software and comes with ABSOLUTELY NO WARRANTY. 309s You are welcome to redistribute it under certain conditions. 309s Type 'license()' or 'licence()' for distribution details. 309s 309s R is a collaborative project with many contributors. 309s Type 'contributors()' for more information and 309s 'citation()' on how to cite R or R packages in publications. 309s 309s Type 'demo()' for some demos, 'help()' for on-line help, or 309s 'help.start()' for an HTML browser interface to help. 309s Type 'q()' to quit R. 309s 309s > require(Rmpfr) 309s Loading required package: Rmpfr 309s Loading required package: gmp 309s 309s Attaching package: ‘gmp’ 309s 309s The following objects are masked from ‘package:base’: 309s 309s %*%, apply, crossprod, matrix, tcrossprod 309s 310s C code of R package 'Rmpfr': GMP using 32 bits per limb 310s 310s > sessionInfo() 310s 310s Attaching package: ‘Rmpfr’ 310s 310s The following object is masked from ‘package:gmp’: 310s 310s outer 310s 310s The following objects are masked from ‘package:stats’: 310s 310s dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm 310s 310s The following objects are masked from ‘package:base’: 310s 310s cbind, pmax, pmin, rbind 310s 310s R version 4.4.3 (2025-02-28) 310s Platform: arm-unknown-linux-gnueabihf (32-bit) 310s Running under: Ubuntu Plucky Puffin (development branch) 310s 310s Matrix products: default 310s BLAS: /usr/lib/arm-linux-gnueabihf/blas/libblas.so.3.12.1 310s LAPACK: /usr/lib/arm-linux-gnueabihf/lapack/liblapack.so.3.12.1; LAPACK version 3.12.0 310s 310s locale: 310s [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 310s [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 310s [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C 310s [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C 310s 310s time zone: Etc/UTC 310s tzcode source: system (glibc) 310s 310s attached base packages: 310s [1] stats graphics grDevices utils datasets methods base 310s 310s other attached packages: 310s [1] Rmpfr_0.9-5 gmp_0.7-5 310s 310s loaded via a namespace (and not attached): 310s [1] compiler_4.4.3 310s > 310s > nums <- c(0, .625, .1, .3, .3125, .5, .6, (.3+.6), .9, 1, 3.3125) 310s > nums9 <- mpfr(nums, precBits = 9) 310s > 310s > n5.b2 <- mpfr("101", base=2) 310s > stopifnot(identical(n5.b2, mpfr(5, precBits=3)), 310s + identical(n5.b2, mpfr("0b101", base=2))) 310s > if(FALSE)## 0b101 could also be a Hex number with no initial '0x' -- hence NOT true: 310s + identical(n5.b2, mpfr("0b101")) 310s > ## We *could* say that anything starting with '0b' is binary, anything with '0x' is hexadecimal 310s > 310s > 310s > ### mpfr_Bcharacter() {no longer method} [was 'mpfrBchar', was 'scanBin'] : 310s > 310s > ##' Check the inverse of formatBin(), i.e., mpfr() working correctly 310s > chkInv.fBin <- function(x, ...) { 310s + stopifnot(is(x, "mpfr")) 310s + nb <- formatBin(x, ...) 310s + xx <- mpfr(nb) 310s + ## Inverse should work {apart from 0: that is not uniquely represented in MPFR!} 310s + stopifnot(identical(mpfrIs0(x ) -> i0, 310s + mpfrIs0(xx)), 310s + identical(x[!i0], xx[!i0])) 310s + invisible(nb) 310s + } 310s > (nums9bc <- chkInv.fBin(nums9)) 310s [1] +0b0.00000000p+0 +0b1.01000000p-1 +0b1.10011010p-4 +0b1.00110011p-2 310s [5] +0b1.01000000p-2 +0b1.00000000p-1 +0b1.00110011p-1 +0b1.11001101p-1 310s [9] +0b1.11001101p-1 +0b1.00000000p+0 +0b1.10101000p+1 310s > (nums9bF <- chkInv.fBin(nums9, scientific=FALSE)) # "F": Fixed format (as in Fortran) 310s [1] +0b_0.00000000____ +0b__.101000000___ +0b__.___110011010 +0b__._100110011__ 310s [5] +0b__._101000000__ +0b__.100000000___ +0b__.100110011___ +0b__.111001101___ 310s [9] +0b__.111001101___ +0b_1.00000000____ +0b11.0101000_____ 310s > 310s > ## higher precision, 0,Inf, sign change: 310s > (i12 <- 1 / mpfr(c(-2:12, Inf), 64)) 310s 16 'mpfr' numbers of precision 64 bits 310s [1] -0.5 -1 Inf 310s [4] 1 0.5 0.333333333333333333342 310s [7] 0.25 0.200000000000000000003 0.166666666666666666671 310s [10] 0.142857142857142857141 0.125 0.11111111111111111111 310s [13] 0.100000000000000000001 0.0909090909090909090934 0.0833333333333333333356 310s [16] 0 310s > (i12.50 <- roundMpfr(i12, precBits=50)) # "same", with 50 (< 53) bits 310s 16 'mpfr' numbers of precision 50 bits 310s [1] -0.5 -1 Inf 310s [4] 1 0.5 0.33333333333333348 310s [7] 0.25 0.19999999999999996 0.16666666666666674 310s [10] 0.14285714285714279 0.125 0.11111111111111116 310s [13] 0.099999999999999978 0.090909090909090939 0.08333333333333337 310s [16] 0 310s > try({ ## FIXME -- formatBin() bug -- fails for 'Inf' ! 310s + (nI.12 <- chkInv.fBin(i12 )) 310s + (nI.12.50 <- chkInv.fBin(i12.50)) 310s + }) 310s [1] -0b1.0000000000000000000000000000000000000000000000000p-1 310s [2] -0b1.0000000000000000000000000000000000000000000000000p+0 310s [3] Inf 310s [4] +0b1.0000000000000000000000000000000000000000000000000p+0 310s [5] +0b1.0000000000000000000000000000000000000000000000000p-1 310s [6] +0b1.0101010101010101010101010101010101010101010101011p-2 310s [7] +0b1.0000000000000000000000000000000000000000000000000p-2 310s [8] +0b1.1001100110011001100110011001100110011001100110011p-3 310s [9] +0b1.0101010101010101010101010101010101010101010101011p-3 310s [10] +0b1.0010010010010010010010010010010010010010010010010p-3 310s [11] +0b1.0000000000000000000000000000000000000000000000000p-3 310s [12] +0b1.1100011100011100011100011100011100011100011100100p-4 310s [13] +0b1.1001100110011001100110011001100110011001100110011p-4 310s [14] +0b1.0111010001011101000101110100010111010001011101001p-4 310s [15] +0b1.0101010101010101010101010101010101010101010101011p-4 310s [16] +0b0.0000000000000000000000000000000000000000000000000p+0 310s > ii <- mpfr(c(-Inf, 17, Inf), 7) 310s > formatHex(ii) ## fine 310s [1] -Inf +0x1.10p+4 Inf 310s > formatDec(ii) ## not 100% ok, as it has "." [FIXME ?] 310s [1] -Inf 17.00 Inf 310s > 310s > n9. <- Rmpfr:::mpfr.Ncharacter(nums9bc) 310s > n9_ <- mpfr(nums9bc) 310s > ## Inverse worked {apart from 0: it is not at all uniquely represented in MPFR!} 310s > stopifnot(identical(mpfrIs0(n9.), mpfrIs0(n9_)), 310s + all.equal(n9_, n9., tolerance=0), 310s + identical(nums9[-1], n9.[-1])) 310s > 310s > mpfr(nums9bc, precBits=5) 310s 11 'mpfr' numbers of precision 5 bits 310s [1] 0 0.625 0.102 0.297 0.312 0.5 0.594 0.906 0.906 1 3.25 310s > 310s > (n9.5 <- mpfr(nums9bF, scientific=FALSE, precBits=5)) 310s 11 'mpfr' numbers of precision 5 bits 310s [1] 0 0.625 0.102 0.297 0.312 0.5 0.594 0.906 0.906 1 3.25 310s > stopifnot(all.equal(n9.5, mpfr(nums9bF, precBits=5), tol=0)) 310s > stopifnot(all.equal(n9., n9.5, tol = 0.02), getPrec(n9.5) == 5) 310s > mpfr(nums9bF, scientific=FALSE) 310s 11 'mpfr' numbers of precision 9 bits 310s [1] 0 0.625 0.1001 0.2998 0.3125 0.5 0.5996 0.9004 0.9004 1 310s [11] 3.312 310s > mpfr(nums9bF) 310s 11 'mpfr' numbers of precision 9 bits 310s [1] 0 0.625 0.1001 0.2998 0.3125 0.5 0.5996 0.9004 0.9004 1 310s [11] 3.312 310s > 310s > ### mpfr() -> mpfrHchar (was 'scanHex') : 310s > nums9hc <- formatHex(nums9) 310s > stopifnot(all.equal(n9., mpfr(nums9hc), tol = 0), 310s + all.equal(n9.5, mpfr(nums9hc, precBits=5), tol = 0)) 310s > 310s > ### Rest from ../R/formatHex.R -- heavily modified 310s > 310s > (m32 <- matrix(0:31, 8, 4, dimnames = list(0:7, c(0,8,16,24)))) 310s 0 8 16 24 310s 0 0 8 16 24 310s 1 1 9 17 25 310s 2 2 10 18 26 310s 3 3 11 19 27 310s 4 4 12 20 28 310s 5 5 13 21 29 310s 6 6 14 22 30 310s 7 7 15 23 31 310s > FourBits <- mpfr(m32, precBits=4) 310s > FiveBits <- mpfr(m32, precBits=5) 310s > stopifnot(all.equal(m32, asNumeric(FiveBits), tol=0), 310s + all.equal(m32, asNumeric(FourBits), tol= 0.05)) 310s > 310s > ## HH:::formatHexInternal(FourBits) 310s > formatHex(FourBits) 310s 0 8 16 24 310s 0 +0x0.0p+0 +0x1.0p+3 +0x1.0p+4 +0x1.8p+4 310s 1 +0x1.0p+0 +0x1.2p+3 +0x1.0p+4 +0x1.8p+4 310s 2 +0x1.0p+1 +0x1.4p+3 +0x1.2p+4 +0x1.ap+4 310s 3 +0x1.8p+1 +0x1.6p+3 +0x1.4p+4 +0x1.cp+4 310s 4 +0x1.0p+2 +0x1.8p+3 +0x1.4p+4 +0x1.cp+4 310s 5 +0x1.4p+2 +0x1.ap+3 +0x1.4p+4 +0x1.cp+4 310s 6 +0x1.8p+2 +0x1.cp+3 +0x1.6p+4 +0x1.ep+4 310s 7 +0x1.cp+2 +0x1.ep+3 +0x1.8p+4 +0x1.0p+5 310s > formatHex(FourBits, precBits=5) 310s 0 8 16 24 310s 0 +0x0.0p+0 +0x1.0p+3 +0x1.0p+4 +0x1.8p+4 310s 1 +0x1.0p+0 +0x1.2p+3 +0x1.0p+4 +0x1.8p+4 310s 2 +0x1.0p+1 +0x1.4p+3 +0x1.2p+4 +0x1.ap+4 310s 3 +0x1.8p+1 +0x1.6p+3 +0x1.4p+4 +0x1.cp+4 310s 4 +0x1.0p+2 +0x1.8p+3 +0x1.4p+4 +0x1.cp+4 310s 5 +0x1.4p+2 +0x1.ap+3 +0x1.4p+4 +0x1.cp+4 310s 6 +0x1.8p+2 +0x1.cp+3 +0x1.6p+4 +0x1.ep+4 310s 7 +0x1.cp+2 +0x1.ep+3 +0x1.8p+4 +0x1.0p+5 310s > formatHex(FourBits, precBits=6) 310s 0 8 16 24 310s 0 +0x0.00p+0 +0x1.00p+3 +0x1.00p+4 +0x1.80p+4 310s 1 +0x1.00p+0 +0x1.20p+3 +0x1.00p+4 +0x1.80p+4 310s 2 +0x1.00p+1 +0x1.40p+3 +0x1.20p+4 +0x1.a0p+4 310s 3 +0x1.80p+1 +0x1.60p+3 +0x1.40p+4 +0x1.c0p+4 310s 4 +0x1.00p+2 +0x1.80p+3 +0x1.40p+4 +0x1.c0p+4 310s 5 +0x1.40p+2 +0x1.a0p+3 +0x1.40p+4 +0x1.c0p+4 310s 6 +0x1.80p+2 +0x1.c0p+3 +0x1.60p+4 +0x1.e0p+4 310s 7 +0x1.c0p+2 +0x1.e0p+3 +0x1.80p+4 +0x1.00p+5 310s > formatBin(FourBits) 310s 0 8 16 24 310s 0 +0b0.000p+0 +0b1.000p+3 +0b1.000p+4 +0b1.100p+4 310s 1 +0b1.000p+0 +0b1.001p+3 +0b1.000p+4 +0b1.100p+4 310s 2 +0b1.000p+1 +0b1.010p+3 +0b1.001p+4 +0b1.101p+4 310s 3 +0b1.100p+1 +0b1.011p+3 +0b1.010p+4 +0b1.110p+4 310s 4 +0b1.000p+2 +0b1.100p+3 +0b1.010p+4 +0b1.110p+4 310s 5 +0b1.010p+2 +0b1.101p+3 +0b1.010p+4 +0b1.110p+4 310s 6 +0b1.100p+2 +0b1.110p+3 +0b1.011p+4 +0b1.111p+4 310s 7 +0b1.110p+2 +0b1.111p+3 +0b1.100p+4 +0b1.000p+5 310s > formatBin(FourBits, precBits=5) 310s 0 8 16 24 310s 0 +0b0.0000p+0 +0b1.0000p+3 +0b1.0000p+4 +0b1.1000p+4 310s 1 +0b1.0000p+0 +0b1.0010p+3 +0b1.0000p+4 +0b1.1000p+4 310s 2 +0b1.0000p+1 +0b1.0100p+3 +0b1.0010p+4 +0b1.1010p+4 310s 3 +0b1.1000p+1 +0b1.0110p+3 +0b1.0100p+4 +0b1.1100p+4 310s 4 +0b1.0000p+2 +0b1.1000p+3 +0b1.0100p+4 +0b1.1100p+4 310s 5 +0b1.0100p+2 +0b1.1010p+3 +0b1.0100p+4 +0b1.1100p+4 310s 6 +0b1.1000p+2 +0b1.1100p+3 +0b1.0110p+4 +0b1.1110p+4 310s 7 +0b1.1100p+2 +0b1.1110p+3 +0b1.1000p+4 +0b1.0000p+5 310s > formatBin(FourBits, scientific=FALSE) 310s 0 8 16 24 310s 0 +0b_____0.000 +0b__1000.___ +0b_1000_.___ +0b_1100_.___ 310s 1 +0b_____1.000 +0b__1001.___ +0b_1000_.___ +0b_1100_.___ 310s 2 +0b____10.00_ +0b__1010.___ +0b_1001_.___ +0b_1101_.___ 310s 3 +0b____11.00_ +0b__1011.___ +0b_1010_.___ +0b_1110_.___ 310s 4 +0b___100.0__ +0b__1100.___ +0b_1010_.___ +0b_1110_.___ 310s 5 +0b___101.0__ +0b__1101.___ +0b_1010_.___ +0b_1110_.___ 310s 6 +0b___110.0__ +0b__1110.___ +0b_1011_.___ +0b_1111_.___ 310s 7 +0b___111.0__ +0b__1111.___ +0b_1100_.___ +0b1000__.___ 310s > formatBin(FourBits, scientific=FALSE, precBits=5) 310s 0 8 16 24 310s 0 +0b_____0.0000 +0b__1000.0___ +0b_10000.____ +0b_11000.____ 310s 1 +0b_____1.0000 +0b__1001.0___ +0b_10000.____ +0b_11000.____ 310s 2 +0b____10.000_ +0b__1010.0___ +0b_10010.____ +0b_11010.____ 310s 3 +0b____11.000_ +0b__1011.0___ +0b_10100.____ +0b_11100.____ 310s 4 +0b___100.00__ +0b__1100.0___ +0b_10100.____ +0b_11100.____ 310s 5 +0b___101.00__ +0b__1101.0___ +0b_10100.____ +0b_11100.____ 310s 6 +0b___110.00__ +0b__1110.0___ +0b_10110.____ +0b_11110.____ 310s 7 +0b___111.00__ +0b__1111.0___ +0b_11000.____ +0b10000_.____ 310s > formatDec(FourBits) 310s 0 8 16 24 310s 0 0.00 8.00 16.0 24.0 310s 1 1.00 9.00 16.0 24.0 310s 2 2.00 10.0 18.0 26.0 310s 3 3.00 11.0 20.0 28.0 310s 4 4.00 12.0 20.0 28.0 310s 5 5.00 13.0 20.0 28.0 310s 6 6.00 14.0 22.0 30.0 310s 7 7.00 15.0 24.0 32.0 310s > formatDec(FourBits, precBits=5) 310s 0 8 16 24 310s 0 0.00 8.00 16.0 24.0 310s 1 1.00 9.00 16.0 24.0 310s 2 2.00 10.0 18.0 26.0 310s 3 3.00 11.0 20.0 28.0 310s 4 4.00 12.0 20.0 28.0 310s 5 5.00 13.0 20.0 28.0 310s 6 6.00 14.0 22.0 30.0 310s 7 7.00 15.0 24.0 32.0 310s > formatDec(FourBits, precBits=7) 310s 0 8 16 24 310s 0 0.000 8.000 16.00 24.00 310s 1 1.000 9.000 16.00 24.00 310s 2 2.000 10.00 18.00 26.00 310s 3 3.000 11.00 20.00 28.00 310s 4 4.000 12.00 20.00 28.00 310s 5 5.000 13.00 20.00 28.00 310s 6 6.000 14.00 22.00 30.00 310s 7 7.000 15.00 24.00 32.00 310s > 310s > ## HH:::formatHexInternal(FiveBits) 310s > formatHex(FiveBits) 310s 0 8 16 24 310s 0 +0x0.0p+0 +0x1.0p+3 +0x1.0p+4 +0x1.8p+4 310s 1 +0x1.0p+0 +0x1.2p+3 +0x1.1p+4 +0x1.9p+4 310s 2 +0x1.0p+1 +0x1.4p+3 +0x1.2p+4 +0x1.ap+4 310s 3 +0x1.8p+1 +0x1.6p+3 +0x1.3p+4 +0x1.bp+4 310s 4 +0x1.0p+2 +0x1.8p+3 +0x1.4p+4 +0x1.cp+4 310s 5 +0x1.4p+2 +0x1.ap+3 +0x1.5p+4 +0x1.dp+4 310s 6 +0x1.8p+2 +0x1.cp+3 +0x1.6p+4 +0x1.ep+4 310s 7 +0x1.cp+2 +0x1.ep+3 +0x1.7p+4 +0x1.fp+4 310s > formatHex(FiveBits, precBits=5) 310s 0 8 16 24 310s 0 +0x0.0p+0 +0x1.0p+3 +0x1.0p+4 +0x1.8p+4 310s 1 +0x1.0p+0 +0x1.2p+3 +0x1.1p+4 +0x1.9p+4 310s 2 +0x1.0p+1 +0x1.4p+3 +0x1.2p+4 +0x1.ap+4 310s 3 +0x1.8p+1 +0x1.6p+3 +0x1.3p+4 +0x1.bp+4 310s 4 +0x1.0p+2 +0x1.8p+3 +0x1.4p+4 +0x1.cp+4 310s 5 +0x1.4p+2 +0x1.ap+3 +0x1.5p+4 +0x1.dp+4 310s 6 +0x1.8p+2 +0x1.cp+3 +0x1.6p+4 +0x1.ep+4 310s 7 +0x1.cp+2 +0x1.ep+3 +0x1.7p+4 +0x1.fp+4 310s > formatHex(FiveBits, precBits=6) 310s 0 8 16 24 310s 0 +0x0.00p+0 +0x1.00p+3 +0x1.00p+4 +0x1.80p+4 310s 1 +0x1.00p+0 +0x1.20p+3 +0x1.10p+4 +0x1.90p+4 310s 2 +0x1.00p+1 +0x1.40p+3 +0x1.20p+4 +0x1.a0p+4 310s 3 +0x1.80p+1 +0x1.60p+3 +0x1.30p+4 +0x1.b0p+4 310s 4 +0x1.00p+2 +0x1.80p+3 +0x1.40p+4 +0x1.c0p+4 310s 5 +0x1.40p+2 +0x1.a0p+3 +0x1.50p+4 +0x1.d0p+4 310s 6 +0x1.80p+2 +0x1.c0p+3 +0x1.60p+4 +0x1.e0p+4 310s 7 +0x1.c0p+2 +0x1.e0p+3 +0x1.70p+4 +0x1.f0p+4 310s > formatBin(FiveBits) 310s 0 8 16 24 310s 0 +0b0.0000p+0 +0b1.0000p+3 +0b1.0000p+4 +0b1.1000p+4 310s 1 +0b1.0000p+0 +0b1.0010p+3 +0b1.0001p+4 +0b1.1001p+4 310s 2 +0b1.0000p+1 +0b1.0100p+3 +0b1.0010p+4 +0b1.1010p+4 310s 3 +0b1.1000p+1 +0b1.0110p+3 +0b1.0011p+4 +0b1.1011p+4 310s 4 +0b1.0000p+2 +0b1.1000p+3 +0b1.0100p+4 +0b1.1100p+4 310s 5 +0b1.0100p+2 +0b1.1010p+3 +0b1.0101p+4 +0b1.1101p+4 310s 6 +0b1.1000p+2 +0b1.1100p+3 +0b1.0110p+4 +0b1.1110p+4 310s 7 +0b1.1100p+2 +0b1.1110p+3 +0b1.0111p+4 +0b1.1111p+4 310s > formatBin(FiveBits, precBits=5) 310s 0 8 16 24 310s 0 +0b0.0000p+0 +0b1.0000p+3 +0b1.0000p+4 +0b1.1000p+4 310s 1 +0b1.0000p+0 +0b1.0010p+3 +0b1.0001p+4 +0b1.1001p+4 310s 2 +0b1.0000p+1 +0b1.0100p+3 +0b1.0010p+4 +0b1.1010p+4 310s 3 +0b1.1000p+1 +0b1.0110p+3 +0b1.0011p+4 +0b1.1011p+4 310s 4 +0b1.0000p+2 +0b1.1000p+3 +0b1.0100p+4 +0b1.1100p+4 310s 5 +0b1.0100p+2 +0b1.1010p+3 +0b1.0101p+4 +0b1.1101p+4 310s 6 +0b1.1000p+2 +0b1.1100p+3 +0b1.0110p+4 +0b1.1110p+4 310s 7 +0b1.1100p+2 +0b1.1110p+3 +0b1.0111p+4 +0b1.1111p+4 310s > formatBin(FiveBits, precBits=6) 310s 0 8 16 24 310s 0 +0b0.00000p+0 +0b1.00000p+3 +0b1.00000p+4 +0b1.10000p+4 310s 1 +0b1.00000p+0 +0b1.00100p+3 +0b1.00010p+4 +0b1.10010p+4 310s 2 +0b1.00000p+1 +0b1.01000p+3 +0b1.00100p+4 +0b1.10100p+4 310s 3 +0b1.10000p+1 +0b1.01100p+3 +0b1.00110p+4 +0b1.10110p+4 310s 4 +0b1.00000p+2 +0b1.10000p+3 +0b1.01000p+4 +0b1.11000p+4 310s 5 +0b1.01000p+2 +0b1.10100p+3 +0b1.01010p+4 +0b1.11010p+4 310s 6 +0b1.10000p+2 +0b1.11000p+3 +0b1.01100p+4 +0b1.11100p+4 310s 7 +0b1.11000p+2 +0b1.11100p+3 +0b1.01110p+4 +0b1.11110p+4 310s > formatBin(FiveBits, scientific=FALSE) 310s 0 8 16 24 310s 0 +0b____0.0000 +0b_1000.0___ +0b10000.____ +0b11000.____ 310s 1 +0b____1.0000 +0b_1001.0___ +0b10001.____ +0b11001.____ 310s 2 +0b___10.000_ +0b_1010.0___ +0b10010.____ +0b11010.____ 310s 3 +0b___11.000_ +0b_1011.0___ +0b10011.____ +0b11011.____ 310s 4 +0b__100.00__ +0b_1100.0___ +0b10100.____ +0b11100.____ 310s 5 +0b__101.00__ +0b_1101.0___ +0b10101.____ +0b11101.____ 310s 6 +0b__110.00__ +0b_1110.0___ +0b10110.____ +0b11110.____ 310s 7 +0b__111.00__ +0b_1111.0___ +0b10111.____ +0b11111.____ 310s > formatBin(FiveBits, scientific=FALSE, precBits=6) 310s 0 8 16 24 310s 0 +0b____0.00000 +0b_1000.00___ +0b10000.0____ +0b11000.0____ 310s 1 +0b____1.00000 +0b_1001.00___ +0b10001.0____ +0b11001.0____ 310s 2 +0b___10.0000_ +0b_1010.00___ +0b10010.0____ +0b11010.0____ 310s 3 +0b___11.0000_ +0b_1011.00___ +0b10011.0____ +0b11011.0____ 310s 4 +0b__100.000__ +0b_1100.00___ +0b10100.0____ +0b11100.0____ 310s 5 +0b__101.000__ +0b_1101.00___ +0b10101.0____ +0b11101.0____ 310s 6 +0b__110.000__ +0b_1110.00___ +0b10110.0____ +0b11110.0____ 310s 7 +0b__111.000__ +0b_1111.00___ +0b10111.0____ +0b11111.0____ 310s > formatDec(FiveBits) 310s 0 8 16 24 310s 0 0.00 8.00 16.0 24.0 310s 1 1.00 9.00 17.0 25.0 310s 2 2.00 10.0 18.0 26.0 310s 3 3.00 11.0 19.0 27.0 310s 4 4.00 12.0 20.0 28.0 310s 5 5.00 13.0 21.0 29.0 310s 6 6.00 14.0 22.0 30.0 310s 7 7.00 15.0 23.0 31.0 310s > formatDec(FiveBits, precBits=5) 310s 0 8 16 24 310s 0 0.00 8.00 16.0 24.0 310s 1 1.00 9.00 17.0 25.0 310s 2 2.00 10.0 18.0 26.0 310s 3 3.00 11.0 19.0 27.0 310s 4 4.00 12.0 20.0 28.0 310s 5 5.00 13.0 21.0 29.0 310s 6 6.00 14.0 22.0 30.0 310s 7 7.00 15.0 23.0 31.0 310s > formatDec(FiveBits, precBits=7) 310s 0 8 16 24 310s 0 0.000 8.000 16.00 24.00 310s 1 1.000 9.000 17.00 25.00 310s 2 2.000 10.00 18.00 26.00 310s 3 3.000 11.00 19.00 27.00 310s 4 4.000 12.00 20.00 28.00 310s 5 5.000 13.00 21.00 29.00 310s 6 6.000 14.00 22.00 30.00 310s 7 7.000 15.00 23.00 31.00 310s > 310s > TenPowers <- mpfr(matrix(10^(-3:5)), precBits=53) 310s > row.names(TenPowers) <- -3:5 310s > TenPowers 310s 'mpfrMatrix' of dim(.) = (9, 1) of precision 53 bits 310s [,1] 310s -3 0.0010000000000000000 310s -2 0.010000000000000000 310s -1 0.10000000000000001 310s 0 1.0000000000000000 310s 1 10.000000000000000 310s 2 100.00000000000000 310s 3 1000.0000000000000 310s 4 10000.000000000000 310s 5 100000.00000000000 310s > 310s > options(width = 180) # for several "wide" displays below 310s > 310s > ## This indirectly "checks' as.data.frame.Ncharacter(): 310s > mkDF <- function(mv, displaydigits = 4, stringsAsFactors = FALSE) { 310s + stopifnot(is.numeric(mv) || inherits(mv, "mpfr")) 310s + data.frame(Hex = formatHex(mv), 310s + Bin = formatBin(mv), 310s + BinF= formatBin(mv, scientific=FALSE), 310s + Dec = formatDec(mv), 310s + Dec4= formatDec(mv, displaydigits=displaydigits), 310s + Dec.= formatDec(mv, scientific=TRUE), 310s + Dec.4=formatDec(mv, scientific=TRUE, displaydigits=displaydigits), 310s + stringsAsFactors = stringsAsFactors) 310s + } 310s > nmsMkDF <- c("Hex", "Bin", "BinF", "Dec", "Dec4", "Dec.", "Dec.4") 310s > 310s > d10p. <- mkDF(TenPowers) 310s > (d10p <- mkDF(as.vector(TenPowers))) 310s Hex Bin BinF 310s 1 +0x1.0624dd2f1a9fcp-10 +0b1.0000011000100100110111010010111100011010100111111100p-10 +0b_________________._________10000011000100100110111010010111100011010100111111100 310s 2 +0x1.47ae147ae147bp-7 +0b1.0100011110101110000101000111101011100001010001111011p-7 +0b_________________.______10100011110101110000101000111101011100001010001111011___ 310s 3 +0x1.999999999999ap-4 +0b1.1001100110011001100110011001100110011001100110011010p-4 +0b_________________.___11001100110011001100110011001100110011001100110011010______ 310s 4 +0x1.0000000000000p+0 +0b1.0000000000000000000000000000000000000000000000000000p+0 +0b________________1.0000000000000000000000000000000000000000000000000000__________ 310s 5 +0x1.4000000000000p+3 +0b1.0100000000000000000000000000000000000000000000000000p+3 +0b_____________1010.0000000000000000000000000000000000000000000000000_____________ 310s 6 +0x1.9000000000000p+6 +0b1.1001000000000000000000000000000000000000000000000000p+6 +0b__________1100100.0000000000000000000000000000000000000000000000________________ 310s 7 +0x1.f400000000000p+9 +0b1.1111010000000000000000000000000000000000000000000000p+9 +0b_______1111101000.0000000000000000000000000000000000000000000___________________ 310s 8 +0x1.3880000000000p+13 +0b1.0011100010000000000000000000000000000000000000000000p+13 +0b___10011100010000.000000000000000000000000000000000000000_______________________ 310s 9 +0x1.86a0000000000p+16 +0b1.1000011010100000000000000000000000000000000000000000p+16 +0b11000011010100000.000000000000000000000000000000000000__________________________ 310s Dec Dec4 Dec. Dec.4 310s 1 0.0010000000000000000 0.0010000000000000000 1.0000000000000000e-3 1.0000000000000000e-3 310s 2 0.010000000000000000 0.010000000000000000 1.0000000000000000e-2 1.0000000000000000e-2 310s 3 0.10000000000000001 0.10000000000000001 1.0000000000000001e-1 1.0000000000000001e-1 310s 4 1.0000000000000000 1.0000000000000000 1.0000000000000000e+0 1.0000000000000000e+0 310s 5 10.000000000000000 10.000000000000000 1.0000000000000000e+1 1.0000000000000000e+1 310s 6 100.00000000000000 100.00000000000000 1.0000000000000000e+2 1.0000000000000000e+2 310s 7 1000.0000000000000 1000.0000000000000 1.0000000000000000e+3 1.0000000000000000e+3 310s 8 10000.000000000000 10000.000000000000 1.0000000000000000e+4 1.0000000000000000e+4 310s 9 100000.00000000000 100000.00000000000 1.0000000000000000e+5 1.0000000000000000e+5 310s > 310s > 310s > TenFrac <- matrix((1:10)/10, dimnames=list(1:10, expression(1/x))) 310s > TenFrac 310s 1/x 310s 1 0.1 310s 2 0.2 310s 3 0.3 310s 4 0.4 310s 5 0.5 310s 6 0.6 310s 7 0.7 310s 8 0.8 310s 9 0.9 310s 10 1.0 310s > stopifnot(exprs = { 310s + is.matrix(print(formatHex(TenFrac))) # stays a matrix 310s + is.matrix(print(formatBin(TenFrac))) 310s + is.matrix(print(formatBin(TenFrac, scientific=FALSE))) 310s + is.matrix(print(formatDec(TenFrac))) 310s + }) 310s 1/x 310s 1 +0x1.999999999999ap-4 310s 2 +0x1.999999999999ap-3 310s 3 +0x1.3333333333333p-2 310s 4 +0x1.999999999999ap-2 310s 5 +0x1.0000000000000p-1 310s 6 +0x1.3333333333333p-1 310s 7 +0x1.6666666666666p-1 310s 8 +0x1.999999999999ap-1 310s 9 +0x1.ccccccccccccdp-1 310s 10 +0x1.0000000000000p+0 310s 1/x 310s 1 +0b1.1001100110011001100110011001100110011001100110011010p-4 310s 2 +0b1.1001100110011001100110011001100110011001100110011010p-3 310s 3 +0b1.0011001100110011001100110011001100110011001100110011p-2 310s 4 +0b1.1001100110011001100110011001100110011001100110011010p-2 310s 5 +0b1.0000000000000000000000000000000000000000000000000000p-1 310s 6 +0b1.0011001100110011001100110011001100110011001100110011p-1 310s 7 +0b1.0110011001100110011001100110011001100110011001100110p-1 310s 8 +0b1.1001100110011001100110011001100110011001100110011010p-1 310s 9 +0b1.1100110011001100110011001100110011001100110011001101p-1 310s 10 +0b1.0000000000000000000000000000000000000000000000000000p+0 310s 1/x 310s 1 +0b_.___11001100110011001100110011001100110011001100110011010 310s 2 +0b_.__11001100110011001100110011001100110011001100110011010_ 310s 3 +0b_._10011001100110011001100110011001100110011001100110011__ 310s 4 +0b_._11001100110011001100110011001100110011001100110011010__ 310s 5 +0b_.10000000000000000000000000000000000000000000000000000___ 310s 6 +0b_.10011001100110011001100110011001100110011001100110011___ 310s 7 +0b_.10110011001100110011001100110011001100110011001100110___ 310s 8 +0b_.11001100110011001100110011001100110011001100110011010___ 310s 9 +0b_.11100110011001100110011001100110011001100110011001101___ 310s 10 +0b1.0000000000000000000000000000000000000000000000000000____ 310s 1/x 310s 1 0.10000000000000001 310s 2 0.20000000000000001 310s 3 0.29999999999999999 310s 4 0.40000000000000002 310s 5 0.50000000000000000 310s 6 0.59999999999999998 310s 7 0.69999999999999996 310s 8 0.80000000000000004 310s 9 0.90000000000000002 310s 10 1.0000000000000000 310s > 310s > TenFrac9 <- mpfr(TenFrac, precBits=9) 310s > TenFrac9 310s 'mpfrMatrix' of dim(.) = (10, 1) of precision 9 bits 310s 1/x 310s 1 0.1001 310s 2 0.2002 310s 3 0.2998 310s 4 0.4004 310s 5 0.5000 310s 6 0.5996 310s 7 0.6992 310s 8 0.8008 310s 9 0.9004 310s 10 1.000 310s > data.frame(Hex = formatHex(TenFrac9), ## checking as.data.frame.Ncharacter as well 310s + Bin = formatBin(TenFrac9), 310s + BinF= formatBin(TenFrac9, scientific=FALSE), 310s + Dec = formatDec(TenFrac9)) -> d9 310s > d9 310s 1/x 1/x 1/x 1/x 310s 1 +0x1.9ap-4 +0b1.10011010p-4 +0b_.___110011010 0.1001 310s 2 +0x1.9ap-3 +0b1.10011010p-3 +0b_.__110011010_ 0.2002 310s 3 +0x1.33p-2 +0b1.00110011p-2 +0b_._100110011__ 0.2998 310s 4 +0x1.9ap-2 +0b1.10011010p-2 +0b_._110011010__ 0.4004 310s 5 +0x1.00p-1 +0b1.00000000p-1 +0b_.100000000___ 0.5000 310s 6 +0x1.33p-1 +0b1.00110011p-1 +0b_.100110011___ 0.5996 310s 7 +0x1.66p-1 +0b1.01100110p-1 +0b_.101100110___ 0.6992 310s 8 +0x1.9ap-1 +0b1.10011010p-1 +0b_.110011010___ 0.8008 310s 9 +0x1.cdp-1 +0b1.11001101p-1 +0b_.111001101___ 0.9004 310s 10 +0x1.00p+0 +0b1.00000000p+0 +0b1.00000000____ 1.000 310s > ## Does not print the column names but the colnames of each 1-col. matrix ("1/x"). 310s > ## This is how R in general works { in format.data.frame() } 310s > ## now use vectors: 310s > tenfrac9 <- as.vector(TenFrac9) 310s > stopifnot(identical(tenfrac9, c(TenFrac9))) 310s > data.frame(Hex = formatHex(tenfrac9), 310s + Bin = formatBin(tenfrac9), 310s + BinF= formatBin(tenfrac9, scientific=FALSE), 310s + Dec = formatDec(tenfrac9)) -> dl9 310s > dl9 # (now prints as d9 had printed in the past) 310s Hex Bin BinF Dec 310s 1 +0x1.9ap-4 +0b1.10011010p-4 +0b_.___110011010 0.1001 310s 2 +0x1.9ap-3 +0b1.10011010p-3 +0b_.__110011010_ 0.2002 310s 3 +0x1.33p-2 +0b1.00110011p-2 +0b_._100110011__ 0.2998 310s 4 +0x1.9ap-2 +0b1.10011010p-2 +0b_._110011010__ 0.4004 310s 5 +0x1.00p-1 +0b1.00000000p-1 +0b_.100000000___ 0.5000 310s 6 +0x1.33p-1 +0b1.00110011p-1 +0b_.100110011___ 0.5996 310s 7 +0x1.66p-1 +0b1.01100110p-1 +0b_.101100110___ 0.6992 310s 8 +0x1.9ap-1 +0b1.10011010p-1 +0b_.110011010___ 0.8008 310s 9 +0x1.cdp-1 +0b1.11001101p-1 +0b_.111001101___ 0.9004 310s 10 +0x1.00p+0 +0b1.00000000p+0 +0b1.00000000____ 1.000 310s > 310s > stopifnot(exprs = { 310s + getPrec(TenFrac ) == 53 310s + getPrec(TenFrac9) == 9 310s + colnames(d9) == c("Hex", "Bin", "BinF", "Dec") 310s + inherits(d9, "data.frame") 310s + all.equal(dim(d9), c(10,4)) 310s + }) 310s > 310s > (Ten <- matrix(1:10 + 0.0, dimnames=list(1:10, "x"))) ## + 0.0 forces double precision 310s x 310s 1 1 310s 2 2 310s 3 3 310s 4 4 310s 5 5 310s 6 6 310s 7 7 310s 8 8 310s 9 9 310s 10 10 310s > 310s > dT <- mkDF(Ten) 310s > dt <- mkDF(as.vector(Ten)) 310s > dt # large 310s Hex Bin BinF Dec 310s 1 +0x1.0000000000000p+0 +0b1.0000000000000000000000000000000000000000000000000000p+0 +0b___1.0000000000000000000000000000000000000000000000000000 1.0000000000000000 310s 2 +0x1.0000000000000p+1 +0b1.0000000000000000000000000000000000000000000000000000p+1 +0b__10.000000000000000000000000000000000000000000000000000_ 2.0000000000000000 310s 3 +0x1.8000000000000p+1 +0b1.1000000000000000000000000000000000000000000000000000p+1 +0b__11.000000000000000000000000000000000000000000000000000_ 3.0000000000000000 310s 4 +0x1.0000000000000p+2 +0b1.0000000000000000000000000000000000000000000000000000p+2 +0b_100.00000000000000000000000000000000000000000000000000__ 4.0000000000000000 310s 5 +0x1.4000000000000p+2 +0b1.0100000000000000000000000000000000000000000000000000p+2 +0b_101.00000000000000000000000000000000000000000000000000__ 5.0000000000000000 310s 6 +0x1.8000000000000p+2 +0b1.1000000000000000000000000000000000000000000000000000p+2 +0b_110.00000000000000000000000000000000000000000000000000__ 6.0000000000000000 310s 7 +0x1.c000000000000p+2 +0b1.1100000000000000000000000000000000000000000000000000p+2 +0b_111.00000000000000000000000000000000000000000000000000__ 7.0000000000000000 310s 8 +0x1.0000000000000p+3 +0b1.0000000000000000000000000000000000000000000000000000p+3 +0b1000.0000000000000000000000000000000000000000000000000___ 8.0000000000000000 310s 9 +0x1.2000000000000p+3 +0b1.0010000000000000000000000000000000000000000000000000p+3 +0b1001.0000000000000000000000000000000000000000000000000___ 9.0000000000000000 310s 10 +0x1.4000000000000p+3 +0b1.0100000000000000000000000000000000000000000000000000p+3 +0b1010.0000000000000000000000000000000000000000000000000___ 10.000000000000000 310s Dec4 Dec. Dec.4 310s 1 1.0000000000000000 1.0000000000000000e+0 1.0000000000000000e+0 310s 2 2.0000000000000000 2.0000000000000000e+0 2.0000000000000000e+0 310s 3 3.0000000000000000 3.0000000000000000e+0 3.0000000000000000e+0 310s 4 4.0000000000000000 4.0000000000000000e+0 4.0000000000000000e+0 310s 5 5.0000000000000000 5.0000000000000000e+0 5.0000000000000000e+0 310s 6 6.0000000000000000 6.0000000000000000e+0 6.0000000000000000e+0 310s 7 7.0000000000000000 7.0000000000000000e+0 7.0000000000000000e+0 310s 8 8.0000000000000000 8.0000000000000000e+0 8.0000000000000000e+0 310s 9 9.0000000000000000 9.0000000000000000e+0 9.0000000000000000e+0 310s 10 10.000000000000000 1.0000000000000000e+1 1.0000000000000000e+1 310s > 310s > (Ten4 <- mpfr(Ten, precBits=4)) 310s 'mpfrMatrix' of dim(.) = (10, 1) of precision 4 bits 310s x 310s 1 1.00 310s 2 2.00 310s 3 3.00 310s 4 4.00 310s 5 5.00 310s 6 6.00 310s 7 7.00 310s 8 8.00 310s 9 9.00 310s 10 10.0 310s > ten4 <- as.vector(Ten4) 310s > D4 <- mkDF(Ten4) # would be printing "x" --- because we added one-column matrices !! 310s > (d4 <- mkDF(ten4)) # printing fine ! 310s Hex Bin BinF Dec Dec4 Dec. Dec.4 310s 1 +0x1.0p+0 +0b1.000p+0 +0b___1.000 1.00 1.00 1.00e+0 1.00e+0 310s 2 +0x1.0p+1 +0b1.000p+1 +0b__10.00_ 2.00 2.00 2.00e+0 2.00e+0 310s 3 +0x1.8p+1 +0b1.100p+1 +0b__11.00_ 3.00 3.00 3.00e+0 3.00e+0 310s 4 +0x1.0p+2 +0b1.000p+2 +0b_100.0__ 4.00 4.00 4.00e+0 4.00e+0 310s 5 +0x1.4p+2 +0b1.010p+2 +0b_101.0__ 5.00 5.00 5.00e+0 5.00e+0 310s 6 +0x1.8p+2 +0b1.100p+2 +0b_110.0__ 6.00 6.00 6.00e+0 6.00e+0 310s 7 +0x1.cp+2 +0b1.110p+2 +0b_111.0__ 7.00 7.00 7.00e+0 7.00e+0 310s 8 +0x1.0p+3 +0b1.000p+3 +0b1000.___ 8.00 8.00 8.00e+0 8.00e+0 310s 9 +0x1.2p+3 +0b1.001p+3 +0b1001.___ 9.00 9.00 9.00e+0 9.00e+0 310s 10 +0x1.4p+3 +0b1.010p+3 +0b1010.___ 10.0 10.0 1.00e+1 1.00e+1 310s > stopifnot(identical(names(d4), names(D4)), 310s + identical(names(d4), nmsMkDF)) 310s > 310s > 310s > 310s > Two8 <- matrix(2^seq(-8, 8)) 310s > Two8.3 <- mpfr(Two8, precBits=3) 310s > ## formatBin 310s > stopifnot( 310s + identical(sapply(as(Two8.3, "mpfr")[-c(1:3, 15:17)], 310s + function(t83) formatBin(t83, scientific=FALSE)), 310s + c("+0b.____100", "+0b.___100", "+0b.__100", "+0b._100", "+0b.100", 310s + "+0b1.00","+0b10.0","+0b100.","+0b100_.","+0b100__.","+0b100___."))) 310s > ## formatDec --- these must be perfectly aligned on the "." ! 310s > formatDec(Two8.3, digits = 3) 310s [,1] 310s [1,] 0.00391 310s [2,] 0.00781 310s [3,] 0.0156 310s [4,] 0.0312 310s [5,] 0.0625 310s [6,] 0.125 310s [7,] 0.250 310s [8,] 0.500 310s [9,] 1.00 310s [10,] 2.00 310s [11,] 4.00 310s [12,] 8.00 310s [13,] 16.0 310s [14,] 32.0 310s [15,] 64.0 310s [16,] 128. 310s [17,] 256. 310s > formatDec(Two8.3, digits = 8) 310s [,1] 310s [1,] 0.0039062500 310s [2,] 0.0078125000 310s [3,] 0.015625000 310s [4,] 0.031250000 310s [5,] 0.062500000 310s [6,] 0.12500000 310s [7,] 0.25000000 310s [8,] 0.50000000 310s [9,] 1.0000000 310s [10,] 2.0000000 310s [11,] 4.0000000 310s [12,] 8.0000000 310s [13,] 16.000000 310s [14,] 32.000000 310s [15,] 64.000000 310s [16,] 128.00000 310s [17,] 256.00000 310s > stopifnot( 310s + identical(capture.output(formatDec(Two8.3, digits = 3))[2:4], 310s + c(" [1,] 0.00391", " [2,] 0.00781", " [3,] 0.0156 ")) 310s + , 310s + identical(capture.output(formatDec(Two8.3, digits = 8))[c(2:3,8,13,16)], 310s + c(" [1,] 0.0039062500", " [2,] 0.0078125000", " [7,] 0.25000000 ", 310s + "[12,] 8.0000000 ", "[15,] 64.000000 ")) 310s + ) 310s > 310s > 310s > 311s autopkgtest [16:39:10]: test run-unit-test: -----------------------] 314s autopkgtest [16:39:13]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - 314s run-unit-test PASS 318s autopkgtest [16:39:17]: test pkg-r-autopkgtest: preparing testbed 340s autopkgtest [16:39:39]: testbed dpkg architecture: armhf 342s autopkgtest [16:39:41]: testbed apt version: 2.9.33 346s autopkgtest [16:39:45]: @@@@@@@@@@@@@@@@@@@@ test bed setup 348s autopkgtest [16:39:47]: testbed release detected to be: plucky 361s autopkgtest [16:40:00]: updating testbed package index (apt update) 364s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [126 kB] 364s Get:2 http://ftpmaster.internal/ubuntu plucky InRelease [257 kB] 364s Get:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease [126 kB] 365s Get:4 http://ftpmaster.internal/ubuntu plucky-security InRelease [126 kB] 365s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [99.7 kB] 365s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [379 kB] 366s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.8 kB] 366s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf Packages [114 kB] 366s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf c-n-f Metadata [1832 B] 366s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/restricted armhf c-n-f Metadata [116 B] 366s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/universe armhf Packages [312 kB] 366s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/universe armhf c-n-f Metadata [11.1 kB] 366s Get:13 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse armhf Packages [3472 B] 366s Get:14 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse armhf c-n-f Metadata [240 B] 366s Get:15 http://ftpmaster.internal/ubuntu plucky/main Sources [1394 kB] 368s Get:16 http://ftpmaster.internal/ubuntu plucky/multiverse Sources [299 kB] 368s Get:17 http://ftpmaster.internal/ubuntu plucky/universe Sources [21.0 MB] 390s Get:18 http://ftpmaster.internal/ubuntu plucky/main armhf Packages [1378 kB] 392s Get:19 http://ftpmaster.internal/ubuntu plucky/main armhf c-n-f Metadata [29.4 kB] 392s Get:20 http://ftpmaster.internal/ubuntu plucky/restricted armhf c-n-f Metadata [108 B] 392s Get:21 http://ftpmaster.internal/ubuntu plucky/universe armhf Packages [15.1 MB] 408s Get:22 http://ftpmaster.internal/ubuntu plucky/multiverse armhf Packages [172 kB] 410s Fetched 41.0 MB in 46s (884 kB/s) 411s Reading package lists... 417s autopkgtest [16:40:56]: upgrading testbed (apt dist-upgrade and autopurge) 418s Reading package lists... 419s Building dependency tree... 419s Reading state information... 419s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 419s Starting 2 pkgProblemResolver with broken count: 0 419s Done 420s Entering ResolveByKeep 420s 421s Calculating upgrade... 421s The following packages will be upgraded: 421s libc-bin libc6 locales pinentry-curses python3-jinja2 sos strace 421s 7 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 421s Need to get 8683 kB of archives. 421s After this operation, 23.6 kB of additional disk space will be used. 421s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf libc6 armhf 2.41-1ubuntu2 [2932 kB] 425s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf libc-bin armhf 2.41-1ubuntu2 [545 kB] 426s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf locales all 2.41-1ubuntu2 [4246 kB] 430s Get:4 http://ftpmaster.internal/ubuntu plucky/main armhf strace armhf 6.13+ds-1ubuntu1 [445 kB] 431s Get:5 http://ftpmaster.internal/ubuntu plucky/main armhf pinentry-curses armhf 1.3.1-2ubuntu3 [40.6 kB] 431s Get:6 http://ftpmaster.internal/ubuntu plucky/main armhf python3-jinja2 all 3.1.5-2ubuntu1 [109 kB] 431s Get:7 http://ftpmaster.internal/ubuntu plucky/main armhf sos all 4.9.0-5 [365 kB] 432s Preconfiguring packages ... 432s Fetched 8683 kB in 10s (878 kB/s) 432s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 64655 files and directories currently installed.) 432s Preparing to unpack .../libc6_2.41-1ubuntu2_armhf.deb ... 432s Unpacking libc6:armhf (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 432s Setting up libc6:armhf (2.41-1ubuntu2) ... 433s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 64655 files and directories currently installed.) 433s Preparing to unpack .../libc-bin_2.41-1ubuntu2_armhf.deb ... 433s Unpacking libc-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 433s Setting up libc-bin (2.41-1ubuntu2) ... 433s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 64655 files and directories currently installed.) 433s Preparing to unpack .../locales_2.41-1ubuntu2_all.deb ... 433s Unpacking locales (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 433s Preparing to unpack .../strace_6.13+ds-1ubuntu1_armhf.deb ... 433s Unpacking strace (6.13+ds-1ubuntu1) over (6.11-0ubuntu1) ... 434s Preparing to unpack .../pinentry-curses_1.3.1-2ubuntu3_armhf.deb ... 434s Unpacking pinentry-curses (1.3.1-2ubuntu3) over (1.3.1-2ubuntu2) ... 434s Preparing to unpack .../python3-jinja2_3.1.5-2ubuntu1_all.deb ... 434s Unpacking python3-jinja2 (3.1.5-2ubuntu1) over (3.1.5-2) ... 434s Preparing to unpack .../archives/sos_4.9.0-5_all.deb ... 434s Unpacking sos (4.9.0-5) over (4.9.0-4) ... 434s Setting up sos (4.9.0-5) ... 435s Setting up pinentry-curses (1.3.1-2ubuntu3) ... 435s Setting up locales (2.41-1ubuntu2) ... 436s Generating locales (this might take a while)... 437s en_US.UTF-8... done 437s Generation complete. 437s Setting up python3-jinja2 (3.1.5-2ubuntu1) ... 438s Setting up strace (6.13+ds-1ubuntu1) ... 438s Processing triggers for man-db (2.13.0-1) ... 439s Processing triggers for systemd (257.3-1ubuntu3) ... 441s Reading package lists... 442s Building dependency tree... 442s Reading state information... 442s Starting pkgProblemResolver with broken count: 0 442s Starting 2 pkgProblemResolver with broken count: 0 442s Done 443s Solving dependencies... 443s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 445s autopkgtest [16:41:24]: rebooting testbed after setup commands that affected boot 508s Reading package lists... 508s Building dependency tree... 508s Reading state information... 509s Starting pkgProblemResolver with broken count: 0 509s Starting 2 pkgProblemResolver with broken count: 0 509s Done 510s The following NEW packages will be installed: 510s build-essential cpp cpp-14 cpp-14-arm-linux-gnueabihf 510s cpp-arm-linux-gnueabihf dctrl-tools fontconfig fontconfig-config 510s fonts-dejavu-core fonts-dejavu-mono g++ g++-14 g++-14-arm-linux-gnueabihf 510s g++-arm-linux-gnueabihf gcc gcc-14 gcc-14-arm-linux-gnueabihf 510s gcc-arm-linux-gnueabihf gfortran gfortran-14 gfortran-14-arm-linux-gnueabihf 510s gfortran-arm-linux-gnueabihf icu-devtools libasan8 libblas-dev libblas3 510s libbz2-dev libc-dev-bin libc6-dev libcairo2 libcc1-0 libcrypt-dev libdatrie1 510s libdeflate-dev libdeflate0 libfontconfig1 libfreetype6 libgcc-14-dev 510s libgfortran-14-dev libgfortran5 libgomp1 libgraphite2-3 libharfbuzz0b 510s libice6 libicu-dev libisl23 libjbig0 libjpeg-dev libjpeg-turbo8 510s libjpeg-turbo8-dev libjpeg8 libjpeg8-dev liblapack-dev liblapack3 liblerc4 510s liblzma-dev libmpc3 libncurses-dev libpango-1.0-0 libpangocairo-1.0-0 510s libpangoft2-1.0-0 libpaper-utils libpaper2 libpcre2-16-0 libpcre2-32-0 510s libpcre2-dev libpcre2-posix3 libpixman-1-0 libpkgconf3 libpng-dev 510s libreadline-dev libsharpyuv0 libsm6 libstdc++-14-dev libtcl8.6 libthai-data 510s libthai0 libtiff6 libtirpc-dev libtk8.6 libubsan1 libwebp7 libxcb-render0 510s libxcb-shm0 libxft2 libxrender1 libxss1 libxt6t64 linux-libc-dev 510s pkg-r-autopkgtest pkgconf pkgconf-bin r-base-core r-base-dev r-cran-gmp 510s r-cran-mass r-cran-rmpfr r-cran-sfsmisc rpcsvc-proto unzip x11-common 510s xdg-utils zip zlib1g-dev 510s 0 upgraded, 104 newly installed, 0 to remove and 0 not upgraded. 510s Need to get 119 MB of archives. 510s After this operation, 317 MB of additional disk space will be used. 510s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf libc-dev-bin armhf 2.41-1ubuntu2 [23.0 kB] 510s Get:2 http://ftpmaster.internal/ubuntu plucky/main armhf linux-libc-dev armhf 6.14.0-10.10 [1683 kB] 512s Get:3 http://ftpmaster.internal/ubuntu plucky/main armhf libcrypt-dev armhf 1:4.4.38-1 [120 kB] 512s Get:4 http://ftpmaster.internal/ubuntu plucky/main armhf rpcsvc-proto armhf 1.4.2-0ubuntu7 [62.2 kB] 512s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf libc6-dev armhf 2.41-1ubuntu2 [1396 kB] 514s Get:6 http://ftpmaster.internal/ubuntu plucky/main armhf libisl23 armhf 0.27-1 [546 kB] 515s Get:7 http://ftpmaster.internal/ubuntu plucky/main armhf libmpc3 armhf 1.3.1-1build2 [47.1 kB] 515s Get:8 http://ftpmaster.internal/ubuntu plucky/main armhf cpp-14-arm-linux-gnueabihf armhf 14.2.0-17ubuntu3 [9220 kB] 524s Get:9 http://ftpmaster.internal/ubuntu plucky/main armhf cpp-14 armhf 14.2.0-17ubuntu3 [1030 B] 524s Get:10 http://ftpmaster.internal/ubuntu plucky/main armhf cpp-arm-linux-gnueabihf armhf 4:14.2.0-1ubuntu1 [5578 B] 524s Get:11 http://ftpmaster.internal/ubuntu plucky/main armhf cpp armhf 4:14.2.0-1ubuntu1 [22.4 kB] 524s Get:12 http://ftpmaster.internal/ubuntu plucky/main armhf libcc1-0 armhf 15-20250222-0ubuntu1 [38.9 kB] 524s Get:13 http://ftpmaster.internal/ubuntu plucky/main armhf libgomp1 armhf 15-20250222-0ubuntu1 [128 kB] 524s Get:14 http://ftpmaster.internal/ubuntu plucky/main armhf libasan8 armhf 15-20250222-0ubuntu1 [2955 kB] 527s Get:15 http://ftpmaster.internal/ubuntu plucky/main armhf libubsan1 armhf 15-20250222-0ubuntu1 [1191 kB] 528s Get:16 http://ftpmaster.internal/ubuntu plucky/main armhf libgcc-14-dev armhf 14.2.0-17ubuntu3 [897 kB] 529s Get:17 http://ftpmaster.internal/ubuntu plucky/main armhf gcc-14-arm-linux-gnueabihf armhf 14.2.0-17ubuntu3 [18.0 MB] 546s Get:18 http://ftpmaster.internal/ubuntu plucky/main armhf gcc-14 armhf 14.2.0-17ubuntu3 [506 kB] 546s Get:19 http://ftpmaster.internal/ubuntu plucky/main armhf gcc-arm-linux-gnueabihf armhf 4:14.2.0-1ubuntu1 [1218 B] 546s Get:20 http://ftpmaster.internal/ubuntu plucky/main armhf gcc armhf 4:14.2.0-1ubuntu1 [5004 B] 546s Get:21 http://ftpmaster.internal/ubuntu plucky/main armhf libstdc++-14-dev armhf 14.2.0-17ubuntu3 [2573 kB] 548s Get:22 http://ftpmaster.internal/ubuntu plucky/main armhf g++-14-arm-linux-gnueabihf armhf 14.2.0-17ubuntu3 [10.5 MB] 558s Get:23 http://ftpmaster.internal/ubuntu plucky/main armhf g++-14 armhf 14.2.0-17ubuntu3 [21.8 kB] 558s Get:24 http://ftpmaster.internal/ubuntu plucky/main armhf g++-arm-linux-gnueabihf armhf 4:14.2.0-1ubuntu1 [966 B] 558s Get:25 http://ftpmaster.internal/ubuntu plucky/main armhf g++ armhf 4:14.2.0-1ubuntu1 [1084 B] 558s Get:26 http://ftpmaster.internal/ubuntu plucky/main armhf build-essential armhf 12.10ubuntu1 [4928 B] 558s Get:27 http://ftpmaster.internal/ubuntu plucky/main armhf dctrl-tools armhf 2.24-3build3 [94.7 kB] 558s Get:28 http://ftpmaster.internal/ubuntu plucky/main armhf libfreetype6 armhf 2.13.3+dfsg-1 [330 kB] 558s Get:29 http://ftpmaster.internal/ubuntu plucky/main armhf fonts-dejavu-mono all 2.37-8 [502 kB] 559s Get:30 http://ftpmaster.internal/ubuntu plucky/main armhf fonts-dejavu-core all 2.37-8 [835 kB] 559s Get:31 http://ftpmaster.internal/ubuntu plucky/main armhf fontconfig-config armhf 2.15.0-2ubuntu1 [37.5 kB] 559s Get:32 http://ftpmaster.internal/ubuntu plucky/main armhf libfontconfig1 armhf 2.15.0-2ubuntu1 [114 kB] 559s Get:33 http://ftpmaster.internal/ubuntu plucky/main armhf fontconfig armhf 2.15.0-2ubuntu1 [190 kB] 560s Get:34 http://ftpmaster.internal/ubuntu plucky/main armhf libgfortran5 armhf 15-20250222-0ubuntu1 [330 kB] 560s Get:35 http://ftpmaster.internal/ubuntu plucky/main armhf libgfortran-14-dev armhf 14.2.0-17ubuntu3 [370 kB] 560s Get:36 http://ftpmaster.internal/ubuntu plucky/main armhf gfortran-14-arm-linux-gnueabihf armhf 14.2.0-17ubuntu3 [9763 kB] 568s Get:37 http://ftpmaster.internal/ubuntu plucky/main armhf gfortran-14 armhf 14.2.0-17ubuntu3 [13.6 kB] 568s Get:38 http://ftpmaster.internal/ubuntu plucky/main armhf gfortran-arm-linux-gnueabihf armhf 4:14.2.0-1ubuntu1 [1026 B] 568s Get:39 http://ftpmaster.internal/ubuntu plucky/main armhf gfortran armhf 4:14.2.0-1ubuntu1 [1166 B] 568s Get:40 http://ftpmaster.internal/ubuntu plucky/main armhf icu-devtools armhf 76.1-1ubuntu2 [206 kB] 568s Get:41 http://ftpmaster.internal/ubuntu plucky/main armhf libblas3 armhf 3.12.1-2 [132 kB] 569s Get:42 http://ftpmaster.internal/ubuntu plucky/main armhf libblas-dev armhf 3.12.1-2 [141 kB] 569s Get:43 http://ftpmaster.internal/ubuntu plucky/main armhf libbz2-dev armhf 1.0.8-6 [30.9 kB] 569s Get:44 http://ftpmaster.internal/ubuntu plucky/main armhf libpixman-1-0 armhf 0.44.0-3 [183 kB] 569s Get:45 http://ftpmaster.internal/ubuntu plucky/main armhf libxcb-render0 armhf 1.17.0-2 [15.3 kB] 569s Get:46 http://ftpmaster.internal/ubuntu plucky/main armhf libxcb-shm0 armhf 1.17.0-2 [5774 B] 569s Get:47 http://ftpmaster.internal/ubuntu plucky/main armhf libxrender1 armhf 1:0.9.10-1.1build1 [16.0 kB] 569s Get:48 http://ftpmaster.internal/ubuntu plucky/main armhf libcairo2 armhf 1.18.2-2 [484 kB] 569s Get:49 http://ftpmaster.internal/ubuntu plucky/main armhf libdatrie1 armhf 0.2.13-3build1 [15.7 kB] 569s Get:50 http://ftpmaster.internal/ubuntu plucky/main armhf libdeflate0 armhf 1.23-1 [38.5 kB] 569s Get:51 http://ftpmaster.internal/ubuntu plucky/main armhf libdeflate-dev armhf 1.23-1 [45.0 kB] 569s Get:52 http://ftpmaster.internal/ubuntu plucky/main armhf libgraphite2-3 armhf 1.3.14-2ubuntu1 [64.8 kB] 569s Get:53 http://ftpmaster.internal/ubuntu plucky/main armhf libharfbuzz0b armhf 10.2.0-1 [464 kB] 570s Get:54 http://ftpmaster.internal/ubuntu plucky/main armhf x11-common all 1:7.7+23ubuntu3 [21.7 kB] 570s Get:55 http://ftpmaster.internal/ubuntu plucky/main armhf libice6 armhf 2:1.1.1-1 [36.5 kB] 570s Get:56 http://ftpmaster.internal/ubuntu plucky/main armhf libicu-dev armhf 76.1-1ubuntu2 [12.0 MB] 581s Get:57 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg-turbo8 armhf 2.1.5-3ubuntu2 [127 kB] 581s Get:58 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg-turbo8-dev armhf 2.1.5-3ubuntu2 [265 kB] 581s Get:59 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg8 armhf 8c-2ubuntu11 [2148 B] 581s Get:60 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg8-dev armhf 8c-2ubuntu11 [1484 B] 581s Get:61 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg-dev armhf 8c-2ubuntu11 [1482 B] 581s Get:62 http://ftpmaster.internal/ubuntu plucky/main armhf liblapack3 armhf 3.12.1-2 [2091 kB] 583s Get:63 http://ftpmaster.internal/ubuntu plucky/main armhf liblapack-dev armhf 3.12.1-2 [2207 kB] 585s Get:64 http://ftpmaster.internal/ubuntu plucky/main armhf liblerc4 armhf 4.0.0+ds-5ubuntu1 [160 kB] 586s Get:65 http://ftpmaster.internal/ubuntu plucky/main armhf libncurses-dev armhf 6.5+20250216-2 [345 kB] 586s Get:66 http://ftpmaster.internal/ubuntu plucky/main armhf libthai-data all 0.1.29-2build1 [158 kB] 586s Get:67 http://ftpmaster.internal/ubuntu plucky/main armhf libthai0 armhf 0.1.29-2build1 [15.2 kB] 586s Get:68 http://ftpmaster.internal/ubuntu plucky/main armhf libpango-1.0-0 armhf 1.56.2-1 [216 kB] 586s Get:69 http://ftpmaster.internal/ubuntu plucky/main armhf libpangoft2-1.0-0 armhf 1.56.2-1 [43.6 kB] 586s Get:70 http://ftpmaster.internal/ubuntu plucky/main armhf libpangocairo-1.0-0 armhf 1.56.2-1 [25.1 kB] 586s Get:71 http://ftpmaster.internal/ubuntu plucky/main armhf libpaper2 armhf 2.2.5-0.3 [16.3 kB] 586s Get:72 http://ftpmaster.internal/ubuntu plucky/main armhf libpaper-utils armhf 2.2.5-0.3 [14.2 kB] 586s Get:73 http://ftpmaster.internal/ubuntu plucky/main armhf libpcre2-16-0 armhf 10.45-1 [207 kB] 587s Get:74 http://ftpmaster.internal/ubuntu plucky/main armhf libpcre2-32-0 armhf 10.45-1 [197 kB] 587s Get:75 http://ftpmaster.internal/ubuntu plucky/main armhf libpcre2-posix3 armhf 10.45-1 [6300 B] 587s Get:76 http://ftpmaster.internal/ubuntu plucky/main armhf libpcre2-dev armhf 10.45-1 [752 kB] 587s Get:77 http://ftpmaster.internal/ubuntu plucky/main armhf libpkgconf3 armhf 1.8.1-4 [26.6 kB] 587s Get:78 http://ftpmaster.internal/ubuntu plucky/main armhf zlib1g-dev armhf 1:1.3.dfsg+really1.3.1-1ubuntu1 [880 kB] 588s Get:79 http://ftpmaster.internal/ubuntu plucky/main armhf libpng-dev armhf 1.6.47-1 [251 kB] 589s Get:80 http://ftpmaster.internal/ubuntu plucky/main armhf libreadline-dev armhf 8.2-6 [153 kB] 589s Get:81 http://ftpmaster.internal/ubuntu plucky/main armhf libsharpyuv0 armhf 1.5.0-0.1 [16.4 kB] 589s Get:82 http://ftpmaster.internal/ubuntu plucky/main armhf libsm6 armhf 2:1.2.4-1 [15.1 kB] 589s Get:83 http://ftpmaster.internal/ubuntu plucky/main armhf libtcl8.6 armhf 8.6.16+dfsg-1 [909 kB] 590s Get:84 http://ftpmaster.internal/ubuntu plucky/main armhf libjbig0 armhf 2.1-6.1ubuntu2 [24.9 kB] 590s Get:85 http://ftpmaster.internal/ubuntu plucky/main armhf libwebp7 armhf 1.5.0-0.1 [188 kB] 590s Get:86 http://ftpmaster.internal/ubuntu plucky/main armhf libtiff6 armhf 4.5.1+git230720-4ubuntu4 [179 kB] 590s Get:87 http://ftpmaster.internal/ubuntu plucky/main armhf libxft2 armhf 2.3.6-1build1 [37.4 kB] 590s Get:88 http://ftpmaster.internal/ubuntu plucky/main armhf libxss1 armhf 1:1.2.3-1build3 [6500 B] 590s Get:89 http://ftpmaster.internal/ubuntu plucky/main armhf libtk8.6 armhf 8.6.16-1 [686 kB] 591s Get:90 http://ftpmaster.internal/ubuntu plucky/main armhf libxt6t64 armhf 1:1.2.1-1.2build1 [145 kB] 591s Get:91 http://ftpmaster.internal/ubuntu plucky/main armhf zip armhf 3.0-14ubuntu2 [164 kB] 591s Get:92 http://ftpmaster.internal/ubuntu plucky/main armhf unzip armhf 6.0-28ubuntu6 [167 kB] 591s Get:93 http://ftpmaster.internal/ubuntu plucky/main armhf xdg-utils all 1.2.1-2ubuntu1 [66.0 kB] 591s Get:94 http://ftpmaster.internal/ubuntu plucky/universe armhf r-base-core armhf 4.4.3-1 [28.2 MB] 620s Get:95 http://ftpmaster.internal/ubuntu plucky/main armhf liblzma-dev armhf 5.6.4-1 [166 kB] 620s Get:96 http://ftpmaster.internal/ubuntu plucky/main armhf pkgconf-bin armhf 1.8.1-4 [21.2 kB] 620s Get:97 http://ftpmaster.internal/ubuntu plucky/main armhf pkgconf armhf 1.8.1-4 [16.8 kB] 620s Get:98 http://ftpmaster.internal/ubuntu plucky/main armhf libtirpc-dev armhf 1.3.4+ds-1.3 [184 kB] 620s Get:99 http://ftpmaster.internal/ubuntu plucky/universe armhf r-base-dev all 4.4.3-1 [4176 B] 620s Get:100 http://ftpmaster.internal/ubuntu plucky/universe armhf pkg-r-autopkgtest all 20231212ubuntu1 [6448 B] 620s Get:101 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-gmp armhf 0.7-5-1 [299 kB] 621s Get:102 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-mass armhf 7.3-64-1 [1105 kB] 622s Get:103 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-rmpfr armhf 0.9-5-1 [1219 kB] 623s Get:104 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-sfsmisc all 1.1-20-1 [674 kB] 624s Preconfiguring packages ... 624s Fetched 119 MB in 1min 54s (1044 kB/s) 625s Selecting previously unselected package libc-dev-bin. 625s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 64655 files and directories currently installed.) 625s Preparing to unpack .../000-libc-dev-bin_2.41-1ubuntu2_armhf.deb ... 625s Unpacking libc-dev-bin (2.41-1ubuntu2) ... 625s Selecting previously unselected package linux-libc-dev:armhf. 625s Preparing to unpack .../001-linux-libc-dev_6.14.0-10.10_armhf.deb ... 625s Unpacking linux-libc-dev:armhf (6.14.0-10.10) ... 625s Selecting previously unselected package libcrypt-dev:armhf. 625s Preparing to unpack .../002-libcrypt-dev_1%3a4.4.38-1_armhf.deb ... 625s Unpacking libcrypt-dev:armhf (1:4.4.38-1) ... 625s Selecting previously unselected package rpcsvc-proto. 625s Preparing to unpack .../003-rpcsvc-proto_1.4.2-0ubuntu7_armhf.deb ... 625s Unpacking rpcsvc-proto (1.4.2-0ubuntu7) ... 625s Selecting previously unselected package libc6-dev:armhf. 625s Preparing to unpack .../004-libc6-dev_2.41-1ubuntu2_armhf.deb ... 625s Unpacking libc6-dev:armhf (2.41-1ubuntu2) ... 625s Selecting previously unselected package libisl23:armhf. 625s Preparing to unpack .../005-libisl23_0.27-1_armhf.deb ... 625s Unpacking libisl23:armhf (0.27-1) ... 625s Selecting previously unselected package libmpc3:armhf. 625s Preparing to unpack .../006-libmpc3_1.3.1-1build2_armhf.deb ... 625s Unpacking libmpc3:armhf (1.3.1-1build2) ... 625s Selecting previously unselected package cpp-14-arm-linux-gnueabihf. 625s Preparing to unpack .../007-cpp-14-arm-linux-gnueabihf_14.2.0-17ubuntu3_armhf.deb ... 625s Unpacking cpp-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 625s Selecting previously unselected package cpp-14. 625s Preparing to unpack .../008-cpp-14_14.2.0-17ubuntu3_armhf.deb ... 625s Unpacking cpp-14 (14.2.0-17ubuntu3) ... 625s Selecting previously unselected package cpp-arm-linux-gnueabihf. 625s Preparing to unpack .../009-cpp-arm-linux-gnueabihf_4%3a14.2.0-1ubuntu1_armhf.deb ... 625s Unpacking cpp-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 625s Selecting previously unselected package cpp. 625s Preparing to unpack .../010-cpp_4%3a14.2.0-1ubuntu1_armhf.deb ... 625s Unpacking cpp (4:14.2.0-1ubuntu1) ... 625s Selecting previously unselected package libcc1-0:armhf. 625s Preparing to unpack .../011-libcc1-0_15-20250222-0ubuntu1_armhf.deb ... 625s Unpacking libcc1-0:armhf (15-20250222-0ubuntu1) ... 625s Selecting previously unselected package libgomp1:armhf. 625s Preparing to unpack .../012-libgomp1_15-20250222-0ubuntu1_armhf.deb ... 625s Unpacking libgomp1:armhf (15-20250222-0ubuntu1) ... 625s Selecting previously unselected package libasan8:armhf. 625s Preparing to unpack .../013-libasan8_15-20250222-0ubuntu1_armhf.deb ... 625s Unpacking libasan8:armhf (15-20250222-0ubuntu1) ... 626s Selecting previously unselected package libubsan1:armhf. 626s Preparing to unpack .../014-libubsan1_15-20250222-0ubuntu1_armhf.deb ... 626s Unpacking libubsan1:armhf (15-20250222-0ubuntu1) ... 626s Selecting previously unselected package libgcc-14-dev:armhf. 626s Preparing to unpack .../015-libgcc-14-dev_14.2.0-17ubuntu3_armhf.deb ... 626s Unpacking libgcc-14-dev:armhf (14.2.0-17ubuntu3) ... 626s Selecting previously unselected package gcc-14-arm-linux-gnueabihf. 626s Preparing to unpack .../016-gcc-14-arm-linux-gnueabihf_14.2.0-17ubuntu3_armhf.deb ... 626s Unpacking gcc-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 626s Selecting previously unselected package gcc-14. 626s Preparing to unpack .../017-gcc-14_14.2.0-17ubuntu3_armhf.deb ... 626s Unpacking gcc-14 (14.2.0-17ubuntu3) ... 626s Selecting previously unselected package gcc-arm-linux-gnueabihf. 626s Preparing to unpack .../018-gcc-arm-linux-gnueabihf_4%3a14.2.0-1ubuntu1_armhf.deb ... 626s Unpacking gcc-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 626s Selecting previously unselected package gcc. 626s Preparing to unpack .../019-gcc_4%3a14.2.0-1ubuntu1_armhf.deb ... 626s Unpacking gcc (4:14.2.0-1ubuntu1) ... 626s Selecting previously unselected package libstdc++-14-dev:armhf. 626s Preparing to unpack .../020-libstdc++-14-dev_14.2.0-17ubuntu3_armhf.deb ... 626s Unpacking libstdc++-14-dev:armhf (14.2.0-17ubuntu3) ... 626s Selecting previously unselected package g++-14-arm-linux-gnueabihf. 626s Preparing to unpack .../021-g++-14-arm-linux-gnueabihf_14.2.0-17ubuntu3_armhf.deb ... 626s Unpacking g++-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 627s Selecting previously unselected package g++-14. 627s Preparing to unpack .../022-g++-14_14.2.0-17ubuntu3_armhf.deb ... 627s Unpacking g++-14 (14.2.0-17ubuntu3) ... 627s Selecting previously unselected package g++-arm-linux-gnueabihf. 627s Preparing to unpack .../023-g++-arm-linux-gnueabihf_4%3a14.2.0-1ubuntu1_armhf.deb ... 627s Unpacking g++-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 627s Selecting previously unselected package g++. 627s Preparing to unpack .../024-g++_4%3a14.2.0-1ubuntu1_armhf.deb ... 627s Unpacking g++ (4:14.2.0-1ubuntu1) ... 627s Selecting previously unselected package build-essential. 627s Preparing to unpack .../025-build-essential_12.10ubuntu1_armhf.deb ... 627s Unpacking build-essential (12.10ubuntu1) ... 627s Selecting previously unselected package dctrl-tools. 627s Preparing to unpack .../026-dctrl-tools_2.24-3build3_armhf.deb ... 627s Unpacking dctrl-tools (2.24-3build3) ... 627s Selecting previously unselected package libfreetype6:armhf. 627s Preparing to unpack .../027-libfreetype6_2.13.3+dfsg-1_armhf.deb ... 627s Unpacking libfreetype6:armhf (2.13.3+dfsg-1) ... 627s Selecting previously unselected package fonts-dejavu-mono. 627s Preparing to unpack .../028-fonts-dejavu-mono_2.37-8_all.deb ... 627s Unpacking fonts-dejavu-mono (2.37-8) ... 627s Selecting previously unselected package fonts-dejavu-core. 627s Preparing to unpack .../029-fonts-dejavu-core_2.37-8_all.deb ... 627s Unpacking fonts-dejavu-core (2.37-8) ... 627s Selecting previously unselected package fontconfig-config. 627s Preparing to unpack .../030-fontconfig-config_2.15.0-2ubuntu1_armhf.deb ... 627s Unpacking fontconfig-config (2.15.0-2ubuntu1) ... 627s Selecting previously unselected package libfontconfig1:armhf. 627s Preparing to unpack .../031-libfontconfig1_2.15.0-2ubuntu1_armhf.deb ... 627s Unpacking libfontconfig1:armhf (2.15.0-2ubuntu1) ... 627s Selecting previously unselected package fontconfig. 627s Preparing to unpack .../032-fontconfig_2.15.0-2ubuntu1_armhf.deb ... 627s Unpacking fontconfig (2.15.0-2ubuntu1) ... 627s Selecting previously unselected package libgfortran5:armhf. 627s Preparing to unpack .../033-libgfortran5_15-20250222-0ubuntu1_armhf.deb ... 627s Unpacking libgfortran5:armhf (15-20250222-0ubuntu1) ... 627s Selecting previously unselected package libgfortran-14-dev:armhf. 627s Preparing to unpack .../034-libgfortran-14-dev_14.2.0-17ubuntu3_armhf.deb ... 627s Unpacking libgfortran-14-dev:armhf (14.2.0-17ubuntu3) ... 628s Selecting previously unselected package gfortran-14-arm-linux-gnueabihf. 628s Preparing to unpack .../035-gfortran-14-arm-linux-gnueabihf_14.2.0-17ubuntu3_armhf.deb ... 628s Unpacking gfortran-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 628s Selecting previously unselected package gfortran-14. 628s Preparing to unpack .../036-gfortran-14_14.2.0-17ubuntu3_armhf.deb ... 628s Unpacking gfortran-14 (14.2.0-17ubuntu3) ... 628s Selecting previously unselected package gfortran-arm-linux-gnueabihf. 628s Preparing to unpack .../037-gfortran-arm-linux-gnueabihf_4%3a14.2.0-1ubuntu1_armhf.deb ... 628s Unpacking gfortran-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 628s Selecting previously unselected package gfortran. 628s Preparing to unpack .../038-gfortran_4%3a14.2.0-1ubuntu1_armhf.deb ... 628s Unpacking gfortran (4:14.2.0-1ubuntu1) ... 628s Selecting previously unselected package icu-devtools. 628s Preparing to unpack .../039-icu-devtools_76.1-1ubuntu2_armhf.deb ... 628s Unpacking icu-devtools (76.1-1ubuntu2) ... 628s Selecting previously unselected package libblas3:armhf. 628s Preparing to unpack .../040-libblas3_3.12.1-2_armhf.deb ... 628s Unpacking libblas3:armhf (3.12.1-2) ... 628s Selecting previously unselected package libblas-dev:armhf. 628s Preparing to unpack .../041-libblas-dev_3.12.1-2_armhf.deb ... 628s Unpacking libblas-dev:armhf (3.12.1-2) ... 628s Selecting previously unselected package libbz2-dev:armhf. 628s Preparing to unpack .../042-libbz2-dev_1.0.8-6_armhf.deb ... 628s Unpacking libbz2-dev:armhf (1.0.8-6) ... 628s Selecting previously unselected package libpixman-1-0:armhf. 628s Preparing to unpack .../043-libpixman-1-0_0.44.0-3_armhf.deb ... 628s Unpacking libpixman-1-0:armhf (0.44.0-3) ... 628s Selecting previously unselected package libxcb-render0:armhf. 628s Preparing to unpack .../044-libxcb-render0_1.17.0-2_armhf.deb ... 628s Unpacking libxcb-render0:armhf (1.17.0-2) ... 628s Selecting previously unselected package libxcb-shm0:armhf. 628s Preparing to unpack .../045-libxcb-shm0_1.17.0-2_armhf.deb ... 628s Unpacking libxcb-shm0:armhf (1.17.0-2) ... 628s Selecting previously unselected package libxrender1:armhf. 628s Preparing to unpack .../046-libxrender1_1%3a0.9.10-1.1build1_armhf.deb ... 628s Unpacking libxrender1:armhf (1:0.9.10-1.1build1) ... 628s Selecting previously unselected package libcairo2:armhf. 628s Preparing to unpack .../047-libcairo2_1.18.2-2_armhf.deb ... 628s Unpacking libcairo2:armhf (1.18.2-2) ... 628s Selecting previously unselected package libdatrie1:armhf. 628s Preparing to unpack .../048-libdatrie1_0.2.13-3build1_armhf.deb ... 628s Unpacking libdatrie1:armhf (0.2.13-3build1) ... 628s Selecting previously unselected package libdeflate0:armhf. 628s Preparing to unpack .../049-libdeflate0_1.23-1_armhf.deb ... 628s Unpacking libdeflate0:armhf (1.23-1) ... 628s Selecting previously unselected package libdeflate-dev:armhf. 628s Preparing to unpack .../050-libdeflate-dev_1.23-1_armhf.deb ... 628s Unpacking libdeflate-dev:armhf (1.23-1) ... 628s Selecting previously unselected package libgraphite2-3:armhf. 628s Preparing to unpack .../051-libgraphite2-3_1.3.14-2ubuntu1_armhf.deb ... 628s Unpacking libgraphite2-3:armhf (1.3.14-2ubuntu1) ... 628s Selecting previously unselected package libharfbuzz0b:armhf. 628s Preparing to unpack .../052-libharfbuzz0b_10.2.0-1_armhf.deb ... 628s Unpacking libharfbuzz0b:armhf (10.2.0-1) ... 628s Selecting previously unselected package x11-common. 628s Preparing to unpack .../053-x11-common_1%3a7.7+23ubuntu3_all.deb ... 628s Unpacking x11-common (1:7.7+23ubuntu3) ... 628s Selecting previously unselected package libice6:armhf. 628s Preparing to unpack .../054-libice6_2%3a1.1.1-1_armhf.deb ... 628s Unpacking libice6:armhf (2:1.1.1-1) ... 629s Selecting previously unselected package libicu-dev:armhf. 629s Preparing to unpack .../055-libicu-dev_76.1-1ubuntu2_armhf.deb ... 629s Unpacking libicu-dev:armhf (76.1-1ubuntu2) ... 629s Selecting previously unselected package libjpeg-turbo8:armhf. 629s Preparing to unpack .../056-libjpeg-turbo8_2.1.5-3ubuntu2_armhf.deb ... 629s Unpacking libjpeg-turbo8:armhf (2.1.5-3ubuntu2) ... 629s Selecting previously unselected package libjpeg-turbo8-dev:armhf. 629s Preparing to unpack .../057-libjpeg-turbo8-dev_2.1.5-3ubuntu2_armhf.deb ... 629s Unpacking libjpeg-turbo8-dev:armhf (2.1.5-3ubuntu2) ... 629s Selecting previously unselected package libjpeg8:armhf. 629s Preparing to unpack .../058-libjpeg8_8c-2ubuntu11_armhf.deb ... 629s Unpacking libjpeg8:armhf (8c-2ubuntu11) ... 629s Selecting previously unselected package libjpeg8-dev:armhf. 629s Preparing to unpack .../059-libjpeg8-dev_8c-2ubuntu11_armhf.deb ... 629s Unpacking libjpeg8-dev:armhf (8c-2ubuntu11) ... 629s Selecting previously unselected package libjpeg-dev:armhf. 629s Preparing to unpack .../060-libjpeg-dev_8c-2ubuntu11_armhf.deb ... 629s Unpacking libjpeg-dev:armhf (8c-2ubuntu11) ... 629s Selecting previously unselected package liblapack3:armhf. 629s Preparing to unpack .../061-liblapack3_3.12.1-2_armhf.deb ... 629s Unpacking liblapack3:armhf (3.12.1-2) ... 629s Selecting previously unselected package liblapack-dev:armhf. 629s Preparing to unpack .../062-liblapack-dev_3.12.1-2_armhf.deb ... 629s Unpacking liblapack-dev:armhf (3.12.1-2) ... 629s Selecting previously unselected package liblerc4:armhf. 629s Preparing to unpack .../063-liblerc4_4.0.0+ds-5ubuntu1_armhf.deb ... 629s Unpacking liblerc4:armhf (4.0.0+ds-5ubuntu1) ... 629s Selecting previously unselected package libncurses-dev:armhf. 629s Preparing to unpack .../064-libncurses-dev_6.5+20250216-2_armhf.deb ... 629s Unpacking libncurses-dev:armhf (6.5+20250216-2) ... 630s Selecting previously unselected package libthai-data. 630s Preparing to unpack .../065-libthai-data_0.1.29-2build1_all.deb ... 630s Unpacking libthai-data (0.1.29-2build1) ... 630s Selecting previously unselected package libthai0:armhf. 630s Preparing to unpack .../066-libthai0_0.1.29-2build1_armhf.deb ... 630s Unpacking libthai0:armhf (0.1.29-2build1) ... 630s Selecting previously unselected package libpango-1.0-0:armhf. 630s Preparing to unpack .../067-libpango-1.0-0_1.56.2-1_armhf.deb ... 630s Unpacking libpango-1.0-0:armhf (1.56.2-1) ... 630s Selecting previously unselected package libpangoft2-1.0-0:armhf. 630s Preparing to unpack .../068-libpangoft2-1.0-0_1.56.2-1_armhf.deb ... 630s Unpacking libpangoft2-1.0-0:armhf (1.56.2-1) ... 630s Selecting previously unselected package libpangocairo-1.0-0:armhf. 630s Preparing to unpack .../069-libpangocairo-1.0-0_1.56.2-1_armhf.deb ... 630s Unpacking libpangocairo-1.0-0:armhf (1.56.2-1) ... 630s Selecting previously unselected package libpaper2:armhf. 630s Preparing to unpack .../070-libpaper2_2.2.5-0.3_armhf.deb ... 630s Unpacking libpaper2:armhf (2.2.5-0.3) ... 630s Selecting previously unselected package libpaper-utils. 630s Preparing to unpack .../071-libpaper-utils_2.2.5-0.3_armhf.deb ... 630s Unpacking libpaper-utils (2.2.5-0.3) ... 630s Selecting previously unselected package libpcre2-16-0:armhf. 630s Preparing to unpack .../072-libpcre2-16-0_10.45-1_armhf.deb ... 630s Unpacking libpcre2-16-0:armhf (10.45-1) ... 630s Selecting previously unselected package libpcre2-32-0:armhf. 630s Preparing to unpack .../073-libpcre2-32-0_10.45-1_armhf.deb ... 630s Unpacking libpcre2-32-0:armhf (10.45-1) ... 630s Selecting previously unselected package libpcre2-posix3:armhf. 630s Preparing to unpack .../074-libpcre2-posix3_10.45-1_armhf.deb ... 630s Unpacking libpcre2-posix3:armhf (10.45-1) ... 630s Selecting previously unselected package libpcre2-dev:armhf. 630s Preparing to unpack .../075-libpcre2-dev_10.45-1_armhf.deb ... 630s Unpacking libpcre2-dev:armhf (10.45-1) ... 630s Selecting previously unselected package libpkgconf3:armhf. 630s Preparing to unpack .../076-libpkgconf3_1.8.1-4_armhf.deb ... 630s Unpacking libpkgconf3:armhf (1.8.1-4) ... 630s Selecting previously unselected package zlib1g-dev:armhf. 630s Preparing to unpack .../077-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu1_armhf.deb ... 630s Unpacking zlib1g-dev:armhf (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 630s Selecting previously unselected package libpng-dev:armhf. 630s Preparing to unpack .../078-libpng-dev_1.6.47-1_armhf.deb ... 630s Unpacking libpng-dev:armhf (1.6.47-1) ... 630s Selecting previously unselected package libreadline-dev:armhf. 630s Preparing to unpack .../079-libreadline-dev_8.2-6_armhf.deb ... 630s Unpacking libreadline-dev:armhf (8.2-6) ... 630s Selecting previously unselected package libsharpyuv0:armhf. 630s Preparing to unpack .../080-libsharpyuv0_1.5.0-0.1_armhf.deb ... 630s Unpacking libsharpyuv0:armhf (1.5.0-0.1) ... 630s Selecting previously unselected package libsm6:armhf. 630s Preparing to unpack .../081-libsm6_2%3a1.2.4-1_armhf.deb ... 630s Unpacking libsm6:armhf (2:1.2.4-1) ... 630s Selecting previously unselected package libtcl8.6:armhf. 630s Preparing to unpack .../082-libtcl8.6_8.6.16+dfsg-1_armhf.deb ... 630s Unpacking libtcl8.6:armhf (8.6.16+dfsg-1) ... 630s Selecting previously unselected package libjbig0:armhf. 630s Preparing to unpack .../083-libjbig0_2.1-6.1ubuntu2_armhf.deb ... 630s Unpacking libjbig0:armhf (2.1-6.1ubuntu2) ... 630s Selecting previously unselected package libwebp7:armhf. 630s Preparing to unpack .../084-libwebp7_1.5.0-0.1_armhf.deb ... 630s Unpacking libwebp7:armhf (1.5.0-0.1) ... 630s Selecting previously unselected package libtiff6:armhf. 630s Preparing to unpack .../085-libtiff6_4.5.1+git230720-4ubuntu4_armhf.deb ... 630s Unpacking libtiff6:armhf (4.5.1+git230720-4ubuntu4) ... 630s Selecting previously unselected package libxft2:armhf. 630s Preparing to unpack .../086-libxft2_2.3.6-1build1_armhf.deb ... 630s Unpacking libxft2:armhf (2.3.6-1build1) ... 630s Selecting previously unselected package libxss1:armhf. 630s Preparing to unpack .../087-libxss1_1%3a1.2.3-1build3_armhf.deb ... 630s Unpacking libxss1:armhf (1:1.2.3-1build3) ... 630s Selecting previously unselected package libtk8.6:armhf. 631s Preparing to unpack .../088-libtk8.6_8.6.16-1_armhf.deb ... 631s Unpacking libtk8.6:armhf (8.6.16-1) ... 631s Selecting previously unselected package libxt6t64:armhf. 631s Preparing to unpack .../089-libxt6t64_1%3a1.2.1-1.2build1_armhf.deb ... 631s Unpacking libxt6t64:armhf (1:1.2.1-1.2build1) ... 631s Selecting previously unselected package zip. 631s Preparing to unpack .../090-zip_3.0-14ubuntu2_armhf.deb ... 631s Unpacking zip (3.0-14ubuntu2) ... 631s Selecting previously unselected package unzip. 631s Preparing to unpack .../091-unzip_6.0-28ubuntu6_armhf.deb ... 631s Unpacking unzip (6.0-28ubuntu6) ... 631s Selecting previously unselected package xdg-utils. 631s Preparing to unpack .../092-xdg-utils_1.2.1-2ubuntu1_all.deb ... 631s Unpacking xdg-utils (1.2.1-2ubuntu1) ... 631s Selecting previously unselected package r-base-core. 631s Preparing to unpack .../093-r-base-core_4.4.3-1_armhf.deb ... 631s Unpacking r-base-core (4.4.3-1) ... 631s Selecting previously unselected package liblzma-dev:armhf. 631s Preparing to unpack .../094-liblzma-dev_5.6.4-1_armhf.deb ... 631s Unpacking liblzma-dev:armhf (5.6.4-1) ... 631s Selecting previously unselected package pkgconf-bin. 631s Preparing to unpack .../095-pkgconf-bin_1.8.1-4_armhf.deb ... 631s Unpacking pkgconf-bin (1.8.1-4) ... 631s Selecting previously unselected package pkgconf:armhf. 631s Preparing to unpack .../096-pkgconf_1.8.1-4_armhf.deb ... 631s Unpacking pkgconf:armhf (1.8.1-4) ... 631s Selecting previously unselected package libtirpc-dev:armhf. 631s Preparing to unpack .../097-libtirpc-dev_1.3.4+ds-1.3_armhf.deb ... 631s Unpacking libtirpc-dev:armhf (1.3.4+ds-1.3) ... 631s Selecting previously unselected package r-base-dev. 631s Preparing to unpack .../098-r-base-dev_4.4.3-1_all.deb ... 631s Unpacking r-base-dev (4.4.3-1) ... 631s Selecting previously unselected package pkg-r-autopkgtest. 631s Preparing to unpack .../099-pkg-r-autopkgtest_20231212ubuntu1_all.deb ... 631s Unpacking pkg-r-autopkgtest (20231212ubuntu1) ... 631s Selecting previously unselected package r-cran-gmp. 631s Preparing to unpack .../100-r-cran-gmp_0.7-5-1_armhf.deb ... 631s Unpacking r-cran-gmp (0.7-5-1) ... 631s Selecting previously unselected package r-cran-mass. 631s Preparing to unpack .../101-r-cran-mass_7.3-64-1_armhf.deb ... 631s Unpacking r-cran-mass (7.3-64-1) ... 631s Selecting previously unselected package r-cran-rmpfr. 631s Preparing to unpack .../102-r-cran-rmpfr_0.9-5-1_armhf.deb ... 631s Unpacking r-cran-rmpfr (0.9-5-1) ... 631s Selecting previously unselected package r-cran-sfsmisc. 632s Preparing to unpack .../103-r-cran-sfsmisc_1.1-20-1_all.deb ... 632s Unpacking r-cran-sfsmisc (1.1-20-1) ... 632s Setting up libgraphite2-3:armhf (1.3.14-2ubuntu1) ... 632s Setting up libpixman-1-0:armhf (0.44.0-3) ... 632s Setting up libsharpyuv0:armhf (1.5.0-0.1) ... 632s Setting up liblerc4:armhf (4.0.0+ds-5ubuntu1) ... 632s Setting up libxrender1:armhf (1:0.9.10-1.1build1) ... 632s Setting up libdatrie1:armhf (0.2.13-3build1) ... 632s Setting up libxcb-render0:armhf (1.17.0-2) ... 632s Setting up unzip (6.0-28ubuntu6) ... 632s Setting up x11-common (1:7.7+23ubuntu3) ... 632s Setting up libdeflate0:armhf (1.23-1) ... 632s Setting up linux-libc-dev:armhf (6.14.0-10.10) ... 632s Setting up libxcb-shm0:armhf (1.17.0-2) ... 632s Setting up libgomp1:armhf (15-20250222-0ubuntu1) ... 632s Setting up libjbig0:armhf (2.1-6.1ubuntu2) ... 632s Setting up libpcre2-16-0:armhf (10.45-1) ... 632s Setting up zip (3.0-14ubuntu2) ... 632s Setting up libpcre2-32-0:armhf (10.45-1) ... 632s Setting up libblas3:armhf (3.12.1-2) ... 632s update-alternatives: using /usr/lib/arm-linux-gnueabihf/blas/libblas.so.3 to provide /usr/lib/arm-linux-gnueabihf/libblas.so.3 (libblas.so.3-arm-linux-gnueabihf) in auto mode 632s Setting up libtirpc-dev:armhf (1.3.4+ds-1.3) ... 632s Setting up libpkgconf3:armhf (1.8.1-4) ... 632s Setting up rpcsvc-proto (1.4.2-0ubuntu7) ... 632s Setting up libfreetype6:armhf (2.13.3+dfsg-1) ... 632s Setting up fonts-dejavu-mono (2.37-8) ... 632s Setting up libmpc3:armhf (1.3.1-1build2) ... 632s Setting up libtcl8.6:armhf (8.6.16+dfsg-1) ... 632s Setting up icu-devtools (76.1-1ubuntu2) ... 632s Setting up fonts-dejavu-core (2.37-8) ... 632s Setting up pkgconf-bin (1.8.1-4) ... 632s Setting up libjpeg-turbo8:armhf (2.1.5-3ubuntu2) ... 632s Setting up libgfortran5:armhf (15-20250222-0ubuntu1) ... 632s Setting up libwebp7:armhf (1.5.0-0.1) ... 632s Setting up liblzma-dev:armhf (5.6.4-1) ... 632s Setting up libubsan1:armhf (15-20250222-0ubuntu1) ... 632s Setting up libpcre2-posix3:armhf (10.45-1) ... 632s Setting up libcrypt-dev:armhf (1:4.4.38-1) ... 632s Setting up libasan8:armhf (15-20250222-0ubuntu1) ... 632s Setting up libharfbuzz0b:armhf (10.2.0-1) ... 632s Setting up libthai-data (0.1.29-2build1) ... 632s Setting up libxss1:armhf (1:1.2.3-1build3) ... 632s Setting up libpaper2:armhf (2.2.5-0.3) ... 632s Setting up libgcc-14-dev:armhf (14.2.0-17ubuntu3) ... 632s Setting up libisl23:armhf (0.27-1) ... 632s Setting up libc-dev-bin (2.41-1ubuntu2) ... 632s Setting up libdeflate-dev:armhf (1.23-1) ... 632s Setting up xdg-utils (1.2.1-2ubuntu1) ... 632s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 632s Setting up libcc1-0:armhf (15-20250222-0ubuntu1) ... 632s Setting up libblas-dev:armhf (3.12.1-2) ... 632s update-alternatives: using /usr/lib/arm-linux-gnueabihf/blas/libblas.so to provide /usr/lib/arm-linux-gnueabihf/libblas.so (libblas.so-arm-linux-gnueabihf) in auto mode 632s Setting up dctrl-tools (2.24-3build3) ... 632s Setting up cpp-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 632s Setting up libjpeg8:armhf (8c-2ubuntu11) ... 632s Setting up libgfortran-14-dev:armhf (14.2.0-17ubuntu3) ... 632s Setting up libice6:armhf (2:1.1.1-1) ... 632s Setting up liblapack3:armhf (3.12.1-2) ... 632s update-alternatives: using /usr/lib/arm-linux-gnueabihf/lapack/liblapack.so.3 to provide /usr/lib/arm-linux-gnueabihf/liblapack.so.3 (liblapack.so.3-arm-linux-gnueabihf) in auto mode 632s Setting up fontconfig-config (2.15.0-2ubuntu1) ... 632s Setting up gcc-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 632s Setting up libpaper-utils (2.2.5-0.3) ... 632s Setting up pkgconf:armhf (1.8.1-4) ... 632s Setting up libthai0:armhf (0.1.29-2build1) ... 632s Setting up liblapack-dev:armhf (3.12.1-2) ... 632s update-alternatives: using /usr/lib/arm-linux-gnueabihf/lapack/liblapack.so to provide /usr/lib/arm-linux-gnueabihf/liblapack.so (liblapack.so-arm-linux-gnueabihf) in auto mode 632s Setting up cpp-14 (14.2.0-17ubuntu3) ... 632s Setting up libtiff6:armhf (4.5.1+git230720-4ubuntu4) ... 632s Setting up libc6-dev:armhf (2.41-1ubuntu2) ... 632s Setting up libfontconfig1:armhf (2.15.0-2ubuntu1) ... 632s Setting up libstdc++-14-dev:armhf (14.2.0-17ubuntu3) ... 632s Setting up libsm6:armhf (2:1.2.4-1) ... 632s Setting up libicu-dev:armhf (76.1-1ubuntu2) ... 632s Setting up cpp-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 632s Setting up gfortran-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 632s Setting up libbz2-dev:armhf (1.0.8-6) ... 632s Setting up gcc-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 632s Setting up g++-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 632s Setting up fontconfig (2.15.0-2ubuntu1) ... 634s Regenerating fonts cache... done. 634s Setting up libjpeg-turbo8-dev:armhf (2.1.5-3ubuntu2) ... 634s Setting up libxft2:armhf (2.3.6-1build1) ... 634s Setting up libncurses-dev:armhf (6.5+20250216-2) ... 634s Setting up libpcre2-dev:armhf (10.45-1) ... 634s Setting up libtk8.6:armhf (8.6.16-1) ... 634s Setting up libpango-1.0-0:armhf (1.56.2-1) ... 634s Setting up libreadline-dev:armhf (8.2-6) ... 634s Setting up libcairo2:armhf (1.18.2-2) ... 634s Setting up gcc-14 (14.2.0-17ubuntu3) ... 634s Setting up gfortran-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 634s Setting up libxt6t64:armhf (1:1.2.1-1.2build1) ... 634s Setting up zlib1g-dev:armhf (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 634s Setting up cpp (4:14.2.0-1ubuntu1) ... 634s Setting up g++-14 (14.2.0-17ubuntu3) ... 634s Setting up libpangoft2-1.0-0:armhf (1.56.2-1) ... 634s Setting up libjpeg8-dev:armhf (8c-2ubuntu11) ... 634s Setting up gfortran-14 (14.2.0-17ubuntu3) ... 634s Setting up libpangocairo-1.0-0:armhf (1.56.2-1) ... 634s Setting up g++-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 634s Setting up libpng-dev:armhf (1.6.47-1) ... 634s Setting up libjpeg-dev:armhf (8c-2ubuntu11) ... 634s Setting up gcc (4:14.2.0-1ubuntu1) ... 634s Setting up r-base-core (4.4.3-1) ... 635s Creating config file /etc/R/Renviron with new version 635s Setting up g++ (4:14.2.0-1ubuntu1) ... 635s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 635s Setting up build-essential (12.10ubuntu1) ... 635s Setting up r-cran-gmp (0.7-5-1) ... 635s Setting up r-cran-sfsmisc (1.1-20-1) ... 635s Setting up r-cran-mass (7.3-64-1) ... 635s Setting up gfortran (4:14.2.0-1ubuntu1) ... 635s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode 635s update-alternatives: warning: skip creation of /usr/share/man/man1/f95.1.gz because associated file /usr/share/man/man1/gfortran.1.gz (of link group f95) doesn't exist 635s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode 635s update-alternatives: warning: skip creation of /usr/share/man/man1/f77.1.gz because associated file /usr/share/man/man1/gfortran.1.gz (of link group f77) doesn't exist 635s Setting up r-cran-rmpfr (0.9-5-1) ... 635s Setting up r-base-dev (4.4.3-1) ... 635s Setting up pkg-r-autopkgtest (20231212ubuntu1) ... 635s Processing triggers for libc-bin (2.41-1ubuntu2) ... 635s Processing triggers for man-db (2.13.0-1) ... 636s Processing triggers for install-info (7.1.1-1) ... 649s autopkgtest [16:44:48]: test pkg-r-autopkgtest: /usr/share/dh-r/pkg-r-autopkgtest 649s autopkgtest [16:44:48]: test pkg-r-autopkgtest: [----------------------- 651s Test: Try to load the R library Rmpfr 651s 651s R version 4.4.3 (2025-02-28) -- "Trophy Case" 651s Copyright (C) 2025 The R Foundation for Statistical Computing 651s Platform: arm-unknown-linux-gnueabihf (32-bit) 651s 651s R is free software and comes with ABSOLUTELY NO WARRANTY. 651s You are welcome to redistribute it under certain conditions. 651s Type 'license()' or 'licence()' for distribution details. 651s 651s R is a collaborative project with many contributors. 651s Type 'contributors()' for more information and 651s 'citation()' on how to cite R or R packages in publications. 651s 651s Type 'demo()' for some demos, 'help()' for on-line help, or 651s 'help.start()' for an HTML browser interface to help. 651s Type 'q()' to quit R. 651s 652s > library('Rmpfr') 652s Loading required package: gmp 652s 652s Attaching package: ‘gmp’ 652s 652s The following objects are masked from ‘package:base’: 652s 652s %*%, apply, crossprod, matrix, tcrossprod 652s 652s C code of R package 'Rmpfr': GMP using 32 bits per limb 652s 652s 652s Attaching package: ‘Rmpfr’ 652s 652s The following object is masked from ‘package:gmp’: 652s 652s outer 652s 652s The following objects are masked from ‘package:stats’: 652s 652s dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm 652s 652s The following objects are masked from ‘package:base’: 652s 652s cbind, pmax, pmin, rbind 652s 652s > 652s > 652s Other tests are currently unsupported! 652s They will be progressively added. 652s autopkgtest [16:44:51]: test pkg-r-autopkgtest: -----------------------] 657s autopkgtest [16:44:56]: test pkg-r-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 657s pkg-r-autopkgtest PASS 661s autopkgtest [16:45:00]: @@@@@@@@@@@@@@@@@@@@ summary 661s run-unit-test PASS 661s pkg-r-autopkgtest PASS