Here is a strange behaviour in Poplog 16 using round and round(sqrt(i)):

    vars i;
    for i from 2 to 10000 do
         [^i ^(2**i) ^(round(sqrt(2**i)))]=>;
    endfor;

Poplog 16 throws an error for 2**126:
"""
.....
** [123 10633823966279326983230456482242756608 3260954456333195264]
** [124 21267647932558653966460912964485513216 4611686018427387904]
** [125 42535295865117307932921825928971026432 6521908912666390528]

<<<<<<< System Error: Signal = 8, PC = 00000000005B31F7 >>>>>>>


;;; MISHAP - serr: SYSTEM ERROR (see above)
;;; FILE     :  /home/hakank/poplog/me/test_sqrt.p   LINE NUMBER:  16
;;; PRINT DOING
;;; DOING    :  round trycompile
"""

It is the same error if intof(sqrt(i)) is used.
    vars i;
    for i from 2 to 10000 do
         [^i ^(2**i) ^(intof(sqrt(2**i)))]=>;
    endfor;

The previous Poplog version ("Version 15.65 Sat May  5 06:42:58 CEST 2012")
managed to handle 2**1024 without any problem, and after that it throws a
FLOATING POINT OVERFLOW error.

If just sqrt(i) is used then Poplog16 manage to handle 2**1024, then a
System error is thrown:
    vars i;
    for i from 2 to 10000 do
         [^i ^(2**i) ^(sqrt(2**i))]=>;
    endfor;

"""
** [1024
179769313486231590772930519078902473361797697894230657273430081157732
6758055009631327084773224075360211201138798713933576587897688144166224
9284743063947412437776789342486548527630221960124609411945308295208500
5768838150682342462881473913110540827237163350510684586298239947245938

<<<<<<< System Error: Signal = 8, PC = 00000000005B330E >>>>>>>

479716304835356329624224137216
;;; MISHAP - serr: SYSTEM ERROR (see above)
;;; FILE     :  /home/hakank/poplog/me/test_sqrt.p   LINE NUMBER:  19
;;; PRINT DOING
;;; DOING    :  => trycompile
"""

Interestingly, if 2,0**i is used then Poplog16 only mangage to 2**1023 and
then throws an explicit FLOATING-POINT ERROR

   vars i;
    for i from 2 to 10000 do
         [^i ^(2**i) ^(2.0**i)]=>;
    endfor;

"""
....
** [1023
898846567431157953864652595394512366808988489471153286367150405788663
3790275048156635423866120376801056005693993569667882939488440720831124
6423715319737062188883946712432742638151109800623047059726541476042502
8844190753411712314407369565552704136185816752553422931491199736229692
39858152417678164812112068608 8988465674311600000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000.0]

;;; MISHAP - FLOATING-POINT OVERFLOW
;;; INVOLVING:  2.0 1024
;;; FILE     :  /home/hakank/poplog/me/test_sqrt.p   LINE NUMBER:  19
;;; PRINT DOING
;;; DOING    :  ** trycompile
"""

Perhaps it's more clear with the following interaction in Poplog16:
"""
$ rlwrap pop11

Sussex Poplog (Version 16.0 sun  5 jan 2020 07:38:08 CET)
Copyright (c) 1982-1999 University of Sussex. All rights reserved.

: dataword(sqrt(2**1024))=>
** decimal

: dataword(sqrt(2**1025))=>

;;; MISHAP - FLOATING-POINT OVERFLOW (converting biginteger)
;;; INVOLVING:
 35953862697246318154586103815780494672359539578846131454686016
;;; 2315465351611001926265416954644815072042240227759742786715317579537628
;;; 8332449856948612789482487555357868497309705526044392024921882389061659
;;; 0417001153767630136468492576294782622108165447432670102136917259647989
;;; 4491876959432609670712659248448274432
;;; PRINT DOING
;;; DOING    :  sqrt pop_setpop_compiler

: dataword(round(sqrt(2**125)))=>
** biginteger
: dataword(round(sqrt(2**126)))=>

<<<<<<< System Error: Signal = 8, PC = 00000000005B31F7 >>>>>>>


;;; MISHAP - serr: SYSTEM ERROR (see above)
;;; PRINT DOING
;;; DOING    :  round pop_setpop_compiler
"""

My system:
- Linux Ubuntu 18.04.3 LTS
- gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
- Intel(R) Core(TM) i9-7940X CPU @ 3.10GHz (28 cpu)
- 64Gb RAM
- anything more needed to know?

I installed Poplog16 from the getpoplog.sh that was created Jan 5 01:34,
using the latest_poplog_base.tar.bz2 from Jan 5 02:01 (perhaps Swedish
time). I.e. the version that Aaron announced per Jan 5.

/Hakan

-- 
Hakan Kjellerstrand
http://www.hakank.org/
http://www.hakank.org/webblogg/
http://www.hakank.org/constraint_programming_blog/
http://twitter.com/hakankj
https://www.facebook.com/hakankj

Reply via email to