Bug #15151 Updated: Decimals/Numerics stored as int64 always display as xxx.2
| From: | sniper@php.net | Date: | Mon, 29 Apr 2002 19:20:15 +0000 |
| Subject: | Bug #15151 Updated: Decimals/Numerics stored as int64 always display as xxx.2 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-6500@lists.php.net to get a copy of this message | ||
ID: 15151
Updated by: sniper@php.net
Reported By: mitch@tropical.co.cr
-Status: No Feedback
+Status: Closed
Bug Type: InterBase related
Operating System: Windows
PHP Version: 4.1.1
Previous Comments:
------------------------------------------------------------------------
[2002-04-29 00:00:03] php-bugs@lists.php.net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2002-03-28 06:05:26] daniela@php.net
I think it must be already fixed in CVS.
Have a look at it and if you can try it on Win32.
Daniela
------------------------------------------------------------------------
[2002-03-27 12:17:45] derick@php.net
please make a patch against the current CVS version.
Derick
------------------------------------------------------------------------
[2002-03-27 11:08:06] mitch@tropical.co.cr
The original fix I posted has its own bug (due to me not VC++) when the
number is less than 0 but greater than -1 the negative sign does not
appear. This fixes it (and the original problem also):
Add these declarations:
ISC_INT64 tv64;
ISC_INT64 iv64;
ISC_INT64 fv64;
then change the code:
case SQL_INT64:
tv64 = (ISC_INT64) *((ISC_INT64 *) data);
iv64 = (tv64 / (int) pow(10.0, (double) -scale));
fv64 = (ISC_INT64) abs((int) tv64
% (int) pow(10.0, (double) -scale));
val->type = IS_STRING;
if ( tv64 < 0 && iv64 == 0 )
val->value.str.len = sprintf(string_data, "-0");
else
val->value.str.len = sprintf(string_data, "%Ld", iv64);
val->value.str.len += sprintf(string_data +
val->value.str.len, ".%0*Ld", -scale, fv64);
val->value.str.val = estrdup(string_data);
break;
------------------------------------------------------------------------
[2002-03-27 11:06:10] mitch@tropical.co.cr
The original fix I posted has its own bug (due to me not VC++) when the
number is less than 0 but greater than -1 the negative sign does not
appear. This fixes it (and the original problem also):
case SQL_INT64:
tv64 = (ISC_INT64) *((ISC_INT64 *) data);
iv64 = (tv64 / (int) pow(10.0, (double) -scale));
fv64 = (ISC_INT64) abs((int) tv64 % (int) pow(10.0, (double)
-scale));
val->type = IS_STRING;
if ( tv64 < 0 && iv64 == 0 )
val->value.str.len = sprintf(string_data, "-0");
else
val->value.str.len = sprintf(string_data, "%Ld", iv64);
val->value.str.len += sprintf(string_data + val->value.str.len,
".%0*Ld", -scale, fv64);
val->value.str.val = estrdup(string_data);
break;
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/15151
--
Edit this bug report at http://bugs.php.net/?id=15151&edit=1