Mail Archives: djgpp/2000/01/06/15:00:26
> but 1.0 gets converted to 0!!!!
> and even worse, 2.0 gets converted to 2... strange.. not a general
> behaviour...
> Is this a bug or is it me that are to dumb? (I have coded almost the
> whole
> night)...
Even Perl has that "bug" !!
Before I re-coded your code into perl, I re-coded it in C:
my C-Code:
#include <iostream>
int main()
{
double i = 0;
while(i<2.0)
{
i += 0.1;
cout << "Double:" << i << ", Integer:" << int(i) << endl;
}
return (0);
}
my Perl-Code:
$i = 0;
while($i<2.0)
{
$i += 0.1;
$iint = int($i);
print "Double: $i, Integer: $iint\n";
}
Jens Luedicke <jens AT irs-net DOT com> // YAPW32H
======================================================================
>> Remove NO-SPAM to reply!
>> PGP-Keys: pgp-keys AT irs-net DOT com
======================================================================
perl -e unlink("microsoft")
- Raw text -