Results 1 to 3 of 3
  1. #1
    hannes is offline Member
    Join Date
    Nov 2009
    Posts
    54
    Rep Power
    0

    Default Strange double counting

    Hey,

    I have some problems when i want to a double to another, an example:

    0.3+0.1 =0.39999999... .

    Code:

    Java Code:
    double lowest=0.0;
    double highest=1.0;
    double interval=0.1
    int meeteller=0;
    for( double count=lowest;count<=highest;count+=interval,meeteller++)
    {
    	g.drawString(count+"", 10, (int) ( heigth-( meeteller*pixelInterval ) ) );
    }
    Can someone explain me what the problem is?

    Hannes

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

  3. #3
    hannes is offline Member
    Join Date
    Nov 2009
    Posts
    54
    Rep Power
    0

    Default

    Thanks for the link, i've read a part of it and i know what the problem is, but is there a way to solve it??

    Hannes

Similar Threads

  1. Counting help
    By jksmithson in forum New To Java
    Replies: 1
    Last Post: 11-06-2009, 02:43 AM
  2. Check if double is double
    By marshalthrone in forum New To Java
    Replies: 8
    Last Post: 09-30-2009, 02:51 PM
  3. Replies: 5
    Last Post: 03-21-2009, 09:32 PM
  4. Recursive Counting
    By zlwilly in forum New To Java
    Replies: 1
    Last Post: 01-29-2009, 08:42 PM
  5. Double.valueOf() vs Double.parseDouble()
    By greenbean in forum New To Java
    Replies: 10
    Last Post: 01-12-2009, 08:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •