I think Bob has a good idea here, split the string values and the
concatenate them to make the whole value.
If the data is really stored in strings, you need to break it down into
substrings around the decimal and then convert both sides into integers
and combine them into an integer value. It is
Paul Waring wrote:
I've got the following script which demonstrates a problem I'm having
with floating point numbers and intval:
$times100 = (-37.12 * 100);
print $times100 . "\n";
$intval100 = intval($times100);
print $intval100 . "\n";
print ($intval100 / 100) . "\n";
I expect the output t
On Thursday 06 May 2010 08:39:03 Bob McConnell wrote:
> From: David McGlone
>
> >On Thursday 06 May 2010 07:19:48 Paul Waring wrote:
> >> David Otton wrote:
> >> > On 6 May 2010 11:52, Paul Waring wrote:
> >> >> If I was designing the system from scratch, that's what I'd do.
> >> >> Unfortunately
David McGlone wrote:
On Thursday 06 May 2010 07:19:48 Paul Waring wrote:
David Otton wrote:
On 6 May 2010 11:52, Paul Waring wrote:
If I was designing the system from scratch, that's what I'd do.
Unfortunately this is an add-on to a legacy system where currency values
are already stored as st
From: David McGlone
>On Thursday 06 May 2010 07:19:48 Paul Waring wrote:
>> David Otton wrote:
>> > On 6 May 2010 11:52, Paul Waring wrote:
>> >> If I was designing the system from scratch, that's what I'd do.
>> >> Unfortunately this is an add-on to a legacy system where currency
values
>> >> are
On Thursday 06 May 2010 07:19:48 Paul Waring wrote:
> David Otton wrote:
> > On 6 May 2010 11:52, Paul Waring wrote:
> >> If I was designing the system from scratch, that's what I'd do.
> >> Unfortunately this is an add-on to a legacy system where currency values
> >> are already stored as strings
David Otton wrote:
On 6 May 2010 11:52, Paul Waring wrote:
If I was designing the system from scratch, that's what I'd do.
Unfortunately this is an add-on to a legacy system where currency values are
already stored as strings in the database (yes, not ideal I know, but you
have to work with wh
On 6 May 2010 11:52, Paul Waring wrote:
> If I was designing the system from scratch, that's what I'd do.
> Unfortunately this is an add-on to a legacy system where currency values are
> already stored as strings in the database (yes, not ideal I know, but you
> have to work with what you've got)
On 06/05/10 11:52, Paul Waring wrote:
Ashley Sheridan wrote:
Why don't you store them as integer values and add in the decimal point
with something like sprintf() afterwards? Store the values as pence and
then you won't have any rounding problems.
If I was designing the system from scratch, th
Ashley Sheridan wrote:
Why don't you store them as integer values and add in the decimal point
with something like sprintf() afterwards? Store the values as pence and
then you won't have any rounding problems.
If I was designing the system from scratch, that's what I'd do.
Unfortunately this i
On Thu, 2010-05-06 at 11:40 +0100, Paul Waring wrote:
> Ashley Sheridan wrote:
> > It's part of the rounding problem you get with most languages out there.
> > Why can't you compare the floating point values though? Currency should
> > only have one decimal place anyway.
>
> You can't compare flo
Ashley Sheridan wrote:
It's part of the rounding problem you get with most languages out there.
Why can't you compare the floating point values though? Currency should
only have one decimal place anyway.
You can't compare floating point values because if you have, for
example, a user-entered v
On Thu, 2010-05-06 at 11:24 +0100, Paul Waring wrote:
> I've got the following script which demonstrates a problem I'm having
> with floating point numbers and intval:
>
> $times100 = (-37.12 * 100);
> print $times100 . "\n";
>
> $intval100 = intval($times100);
> print $intval100 . "\n";
>
> p
I've got the following script which demonstrates a problem I'm having
with floating point numbers and intval:
$times100 = (-37.12 * 100);
print $times100 . "\n";
$intval100 = intval($times100);
print $intval100 . "\n";
print ($intval100 / 100) . "\n";
I expect the output to be:
-3712
-3712
-3
14 matches
Mail list logo