Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6f5fd6f

Browse files
solve division by zero v2
1 parent 43d810f commit 6f5fd6f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ def plot_function(self):
9999
"Min value must be non-negative for functions with log10 or sqrt."
100100
)
101101
return
102-
# deal with the case of division by zero
103-
if "1/x" in function and 0 in [min_x, max_x]:
102+
103+
# deal with the case of division by zero ex(x/0)
104+
if "/0" in function:
104105
self.show_error_message("Division by zero is not allowed.")
105106
return
107+
106108
x = np.linspace(min_x, max_x, 400)
107109
if "log10" in function:
108110
x = np.where(

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /