termgraph icon indicating copy to clipboard operation
termgraph copied to clipboard

ValueError: math domain error if value == 0

Open sgelb opened this issue 4 years ago • 1 comments

If termgraph is used as a module and a value is 0, a ValueError: math domain error is thrown by math.log in utils.py::cvt_to_readable(num) here: https://github.com/mkaz/termgraph/blob/09e17cc3510b62969fc12075dd698817357a5a93/termgraph/utils.py#L16

Problem is that there is there is no zero check for num. This is done correctly in termgraph.py::cvt_to_readable(num): https://github.com/mkaz/termgraph/blob/4aa3b6711136fb0232bf149a64afa4b49c2b28f3/termgraph/termgraph.py#L197

sgelb avatar Nov 06 '21 13:11 sgelb

I made a pull request to fix this.

frankbryce avatar Nov 24 '21 17:11 frankbryce