fixed floating number incorrectly rendered (as mentioned by giancarlo@niccolai.ws in BUG #14755)

This commit is contained in:
Daniela Mariaschi 2002-03-19 15:29:17 +00:00
parent 32a4f35580
commit c3daa18168

View File

@ -1787,13 +1787,14 @@ static int _php_ibase_var_pval(pval *val, void *data, int type, int len, int sca
val->type = IS_STRING; val->type = IS_STRING;
if (scale) { if (scale) {
int i, len; int j, f = 1;
char dt[20];
double number = (double) ((ISC_INT64) (*((ISC_INT64 *)data))); double number = (double) ((ISC_INT64) (*((ISC_INT64 *)data)));
char dt[20];
number /= - 10 * scale; for (j = 0; j < -scale; j++) {
f *= 10;
}
sprintf(dt, "%%0.%df", -scale); sprintf(dt, "%%0.%df", -scale);
val->value.str.len = sprintf (string_data, dt, number); val->value.str.len = sprintf (string_data, dt, number/f );
} else { } else {
val->value.str.len = sprintf (string_data, "%Ld", val->value.str.len = sprintf (string_data, "%Ld",
(ISC_INT64) (*((ISC_INT64 *)data))); (ISC_INT64) (*((ISC_INT64 *)data)));