Describe the bug
watts_to_dbw(watt) computes 10 * log10(watt) directly. For watt <= 0, this produces -inf (0) or nan/warnings (negative). For a conversion utility, this should usually raise a clear ValueError.
https://electricpy.readthedocs.io/en/latest/_modules/electricpy/conversions.html
Reproduction Code
# Setup
import electricpy.conversions as conv
print(conv.watts_to_dbw(0)) # log10(0) -> -inf
print(conv.watts_to_dbw(-1.0)) # log10(negative) -> nan / runtime warning
Expected behavior
A clear exception (e.g., ValueError("watt must be > 0")) rather than returning -inf/nan silently.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. Linux]
- Python Version [e.g. 3.11.6]
- Version [e.g. 0.4.0]
Additional context
This one’s “edge-case,” but it’s a common footgun in unit conversion helpers.