Skip to content

Commit ac90160

Browse files
committed
validate for negative values when using sqrt or log10
1 parent ddc1058 commit ac90160

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main.py

+6
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ def plot_function(self):
7676
self.show_error_message("Min value must be less than Max value.")
7777
return
7878

79+
if ("log10" in function or "sqrt" in function) and min_x < 0:
80+
self.show_error_message(
81+
"Min value must be non-negative for functions with log10 or sqrt."
82+
)
83+
return
84+
7985
x = np.linspace(min_x, max_x, 400)
8086
try:
8187
y = eval(self.prepare_function(function, x))

0 commit comments

Comments
 (0)