Re: Help with ESQL/C and float data types
Posted in 1994
In article <47040018@hpcc01.corp.hp.com>, dallara@hpcc01.corp.hp.com (Jon Dallara) writes: > We are encountering a possible conversion problem while using > ESQL/C and an On-Line 5.01 data base while inserting values > into table fields of type float. For example, we insert the > value -11.71 into the table, but isql retrieves the value -12.38. > Any clues as to what we are doing wrong? We are using doubles > for the C variables. Here is the relevent code: Usually what I usually do is store (say, money) values as cents, rather than whole + fraction of dollars. So, e.g., -11.71 would be minus 1,171 cents. Things get a little trickier of you *really* need to store floats or doubles, but almost always you can come up with "number of significant digits" and go from there. Hope this helps. - MisterSci