1. How to prevent division by zero?
- Posted by SnakeCharmer Sep 15, 2012
- 1193 views
I need to prevent division by zero. As I know, Euphoria's atoms used for integer and float numbers. Whether means it, what I should check both cases?
if x = 0 or x = 0.0 then y = INFINITE else y = 1 / x end if
Perhaps, more correct to make so?
if x > -0.0000000001 and x < 0.0000000001 then
Please, don't suggest me to intercept an exception! I understand that it is the most ideologically certain way, but it is superfluous difficult for my modest utilities.
2. Re: How to prevent division by zero?
- Posted by DerekParnell (admin) Sep 15, 2012
- 1200 views
SnakeCharmer said...
I need to prevent division by zero.
This should be enough ...
include std/math.e if x = 0 y = PINF -- Positive infinity else y = 1 / x end if
[/quote]