Skip to content

Commit

Permalink
Check for nan and infinity when setting scientific notation text
Browse files Browse the repository at this point in the history
  • Loading branch information
vetux committed Oct 10, 2022
1 parent 667b61e commit 77eb01e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/addon/gui/numberview.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ def slot_set_value(self, value, signal = True):
if signal:
self.signal_value_changed.emit(format(r, 'f'))

self.scitext.setText('%E' % r)
if r.is_nan():
self.scitext.setText("NaN")
elif not r.is_finite():
self.scitext.setText("Inf")
else:
self.scitext.setText('%E' % r)

ri = r.to_integral_value()

Expand Down

0 comments on commit 77eb01e

Please sign in to comment.