* Jim Jagielski wrote: > At 7:16 PM +0100 3/11/03, André Malo wrote: >>* Jim Jagielski wrote: >> >>> Not sure about >>> >>> + if (!string || !*string) { >>> + return 1.0f; >>> + } >>> + >>> >>> Why return 1 if passed a NULL?? >> >>Because no supplied qvalue is the same as qvalue = 1. If I'm wrong with >>that assumption, please correct me. >> > > methinks that's wrong. If atof/strtod is passed NULL, or a > null string, they return 0. If atoq is supposed to be similar, > then it should also return 0. It looks like a definition on our side. What do we do with invalid qvalues? ignore as it were no qvalue supplied (q=1) or ignore as it were q=0? I'm also not sure, but in my feeling the former is better :) > In any case, I'm unsure of the need for this anyway... Seems > a lot of trouble to force a float that, we hope, will only have > 3 places after the decimal (ie: that 12345.0/1000.0 will be exactly > 12.345 all the time, on all systems in all uses). Does it really matter > if internally we calculate the above as 12.3450001 if we actually > make sure the entries in the headers conform? No, it doesn't matter (aside from the chaos theory ;-). But multiplying several times with the (in IEEE 754 periodic) 0.1 is probably less efficient than one division by 1000. But I didn't benchmark it, just theory for now ... nd -- \$_=q?tvc!uif)%*|#Bopuifs!A`#~tvc!Xibu)%*|qsjou#Kvtu!A`#~tvc!KBQI!)*|~ tvc!ifmm)%*|#Qfsm!A`#~tvc!jt)%*|(Ibdlfs(~ # What the hell is JAPH? ; @_=split/\s\s+#/;\$_=(join''=>map{chr(ord( # André Malo ; \$_)-1)}split//=>\$_[0]).\$_[1];s s.*s\$_see; # http://www.perlig.de/ ;