ccwu <
ccwu6...@gmail.com> writes:
>I'm writing my own Forth. While building floating point numbers from digits, I'd like it generates an exception if any overflow occurs, instead of wrapping the result.
If you are using IEEE FP representation, producing an infinity on
overflow looks like the way to go.
There is no standard assignment of exception numbers to error
conditions, so you pick what seems appropriate, or introduce a new,
system-specific one. -43, -11, -46, -54, and -55 would appear
fitting, to various degrees. In my programming practice, the only
role the number plays is to determine which error message is produced;
when I test for a specific error after CATCHing, it maybe other people
test for specific throw codes after CATCHing it's a throw code that I
coded into my program (i.e., not a code that the system threw).
- 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 2017:
http://euro.theforth.net/