Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #57994
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: mixed double and single signed division |
| Date | 2017-04-24 13:23 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2017Apr24.152326@mips.complang.tuwien.ac.at> (permalink) |
| References | <bbcfd72a-4597-4839-aba0-3d4b98009995@googlegroups.com> <odh5gb$1j9o$1@gioia.aioe.org> <zY2dneeIGsT8u2HFnZ2dnUU7-V-dnZ2d@supernews.com> <f8a33236-78f6-462e-9bc1-67e2ca5c92b7@googlegroups.com> <80263ccc-e291-4a54-9ae7-b9b5ba2a9d7c@googlegroups.com> |
krishna.myneni@ccreweb.org writes:
>The latter result in a crash out of the Forth system, while the fo=
>rmer case is handled with an error message and does not result in an ungrac=
>eful ejection from the Forth environment -- the cost is an extra division t=
>est.
If all you want is to suppress the signal, you can just set SIGFPE to SIG_IGN.
>c" 40000000000" number? drop 2constant FORTY_BILLION
> ok
>FORTY_BILLION 2 FM/MOD
>Floating point exception (core dumped)
>$ ( back to OS terminal prompt )
...
>Incidentally, I don't know the reason for giving a floating point exception=
> error here, since no floating point operations are being performed when th=
>e exception occurs.
My guess is that you are running a Unix. Unix reports integer
overflows and other integer computation errors through SIGFPE (my
guess is that when they designed signals, they had hardware which had
FP exceptions, but no integer exceptions, so they did not introduce a
SIGINTE).
If you catch the signal, you can use the si_code field of the siginfor
struct to find out what the cause of the signal was. E.g., if it is
FPE_INTDIV, it's an integer division by zero (and, as we will see,
possibly other integer division errors). Gforth does all that, and
therefore you get, on AMD64:
1 0 /
:1: Division by zero
1 0 >>>/<<<
Backtrace:
0 1 1 um/mod .s
:2: Division by zero
0 1 1 >>>um/mod<<< .s
Backtrace:
Looking up
<http://x86.renejeschke.de/html/file_module_x86_id_72.html>, I see
that both division by zero and an out-of-range result produce a DE
(divide exception) on AMD64. I guess Linux just translates this into
FPE_INTDIV, without differentiationg between division by zero and the
other cases.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2016: http://www.euroforth.org/ef16/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-22 08:21 -0700
Re: mixed double and single signed division NN <november.nihal@gmail.com> - 2017-04-22 09:14 -0700
Re: mixed double and single signed division NN <november.nihal@gmail.com> - 2017-04-22 09:22 -0700
Re: mixed double and single signed division Coos Haak <htrofhc@gmail.com> - 2017-04-22 23:31 +0200
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-23 06:44 -0700
Re: mixed double and single signed division hughaguilar96@gmail.com - 2017-04-23 13:24 -0700
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-23 06:41 -0700
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-23 13:29 -0700
Re: mixed double and single signed division Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-04-22 11:40 -0500
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-23 06:52 -0700
Re: mixed double and single signed division "HAA" <someone@microsoft.com> - 2017-04-23 13:02 +1000
Re: mixed double and single signed division "Elizabeth D. Rather" <erather@forth.com> - 2017-04-22 17:58 -1000
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-23 13:36 -0700
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-23 16:33 -0700
Re: mixed double and single signed division anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-24 13:23 +0000
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-24 18:49 -0700
Re: mixed double and single signed division anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-24 13:12 +0000
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-24 18:35 -0700
Re: mixed double and single signed division "Elizabeth D. Rather" <erather@forth.com> - 2017-04-24 15:52 -1000
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-25 02:18 -0700
Re: mixed double and single signed division Paul Rubin <no.email@nospam.invalid> - 2017-04-25 02:25 -0700
Re: mixed double and single signed division anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-25 11:30 +0000
Re: mixed double and single signed division "Elizabeth D. Rather" <erather@forth.com> - 2017-04-25 08:08 -1000
Re: mixed double and single signed division anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-26 14:48 +0000
Re: mixed double and single signed division anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-25 08:40 +0000
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-25 02:25 -0700
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-25 03:00 -0700
Re: mixed double and single signed division anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-25 11:37 +0000
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-25 05:27 -0700
Re: mixed double and single signed division anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-25 13:34 +0000
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-25 15:29 -0700
Re: mixed double and single signed division "HAA" <someone@microsoft.com> - 2017-04-27 14:02 +1000
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-27 16:00 -0700
Re: mixed double and single signed division "Elizabeth D. Rather" <erather@forth.com> - 2017-04-27 19:20 -1000
Re: mixed double and single signed division "HAA" <someone@microsoft.com> - 2017-04-28 22:41 +1000
Re: mixed double and single signed division Coos Haak <htrofhc@gmail.com> - 2017-04-25 15:32 +0200
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-25 15:22 -0700
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-23 06:55 -0700
Re: mixed double and single signed division "Elizabeth D. Rather" <erather@forth.com> - 2017-04-23 13:30 -1000
Re: mixed double and single signed division krishna.myneni@ccreweb.org - 2017-04-23 16:45 -0700
Re: mixed double and single signed division "HAA" <someone@microsoft.com> - 2017-04-24 10:56 +1000
Re: mixed double and single signed division "Elizabeth D. Rather" <erather@forth.com> - 2017-04-23 15:06 -1000
Re: mixed double and single signed division hughaguilar96@gmail.com - 2017-04-23 19:10 -0700
Re: mixed double and single signed division Paul Rubin <no.email@nospam.invalid> - 2017-04-23 19:12 -0700
Re: mixed double and single signed division "Elizabeth D. Rather" <erather@forth.com> - 2017-04-23 16:31 -1000
Re: mixed double and single signed division hughaguilar96@gmail.com - 2017-04-23 21:17 -0700
Re: mixed double and single signed division Paul Rubin <no.email@nospam.invalid> - 2017-04-23 21:47 -0700
Re: mixed double and single signed division hughaguilar96@gmail.com - 2017-04-23 22:58 -0700
Re: mixed double and single signed division hughaguilar96@gmail.com - 2017-04-23 23:22 -0700
Re: mixed double and single signed division Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-04-24 04:46 -0500
Re: mixed double and single signed division "HAA" <someone@microsoft.com> - 2017-04-24 12:59 +1000
Re: mixed double and single signed division "Elizabeth D. Rather" <erather@forth.com> - 2017-04-23 18:03 -1000
Re: mixed double and single signed division hughaguilar96@gmail.com - 2017-04-23 21:22 -0700
Re: mixed double and single signed division "HAA" <someone@microsoft.com> - 2017-04-25 12:53 +1000
Re: mixed double and single signed division "Elizabeth D. Rather" <erather@forth.com> - 2017-04-24 21:55 -1000
Re: mixed double and single signed division "HAA" <someone@microsoft.com> - 2017-04-25 20:00 +1000
csiph-web