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. 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? Agreed, however that the locale/LC_NUMERIC stuff is an issue. -- =========================================================================== Jim Jagielski [|] [EMAIL PROTECTED] [|] http://www.jaguNET.com/ "A society that will trade a little liberty for a little order will lose both and deserve neither" - T.Jefferson