delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/06/15:00:26

Message-ID: <B0000025990@nordhorn.de>
Date: Thu, 6 Jan 2000 18:42:48 +0100
From: Jens Luedicke <jens AT irs-net DOT com>
To: djgpp AT delorie DOT com
Subject: Re: DJGPP BUG!!!!!!! ???
X-Mailer: Jens Luedicke's registered AK-Mail 3.1 publicbeta2 [ger]
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019