How to fix ValueError, math domain error

Hi I try to use math.log in my function, but it does not return any values, I get ValueError, math domain error, how do I fix it? Thank you.
N=
x=0
for x in range(0,len(stressrange)):
stressval=stressrange/1000
logval=math.log(stressval,10)
nvalue=math.pow(10,C-m*logval)
x+=1
N.append(logval)
print N

The domain of a logarithmic function is from 0 to +infinity. if stressval is ever not a number >= 0, you’ll see this error.

Thank you for telling me that info, I transfered vba code into ignition in python, I want to caculate the cycles, In vba function I need to use log function, but the formular contains changing variabe, so I build a loop in ignition, how to fix that problem, do you have some better idea? thanks

Use of Apache commons math will return -inf instead of a domain error

from org.apache.commons.math3.analysis.function import Log, Log10

# Construct the log functions
xe = Log()
x10 = Log10()

print xe.value(0)
print x10.value(0)

Thank you so much!