Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.forth    |    Forth programmers eat a lot of Bratwurst    |    117,927 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 116,611 of 117,927    |
|    Krishna Myneni to All    |
|    Overflow Test for M*/    |
|    10 Jul 24 06:16:01    |
      From: krishna.myneni@ccreweb.org              Here's a simple check to see what your Forth system does when M*/ is       given arguments which will overflow a double length result. The standard       states that this is an ambiguous condition.              : ipow ( n u -- d ) 1 s>d rot 0 ?DO 2 pick 1 m*/ LOOP rot drop ;              65 21 ipow d.       117809547936177440979200839996337890625 ok \ result ok (64-bit system)              65 22 ipow d.       Floating point exception (core dumped) \ kForth-64 (since last commit)              65 raised to the power of 22 will overflow the double number result on a       64-bit system and crash on kForth-64. Prior to my recent patch it would       overflow silently and print an incorrect result.                     In kForth, a SIGFPE handler may be installed as shown in the example       sigfpe.4th.              include sigfpe       \ ...       65 22 ipow d.       Floating point exception       Line 16: VM Error(-258): Return stack corrupt       65 22 ipow d.        ok \ returns to the Forth prompt                     To be clear there is no floating point operation involved in IPOW as       defined above, but the exception generated for integer division overflow       for a double length number divided by a single length number generates       SIGFPE on linux.              --       Krishna              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca