1. Member
Join Date
Oct 2014
Posts
2
Rep Power
0

Scanner scan = new Scanner(System.in);
double val = scan.nextDouble();
System.out.println(val - 11.5);

Why is the output 56.397000000000000006 instead of 67.897?

Thanks

2. ## Re: Question about Doubles?

Hard to say without seeing the value in val.

3. Member
Join Date
Oct 2014
Posts
2
Rep Power
0

Apologies. The value for val is 67.897.

4. Senior Member
Join Date
Jan 2013
Location
Northern Virginia, United States
Posts
6,226
Rep Power
13

Originally Posted by Marquis de Faux
Apologies. The value for val is 67.897.
I think you need to read your first post and restate the question.

Regards,
Jim

5. ## Re: Question about Doubles?

What is the value of 67.897 - 11.5?

6. Moderator
Join Date
Apr 2009
Posts
13,541
Rep Power
26

7. ## Re: Question about Doubles?

Can't we nail that link to the entrance of this forum? (together with the remark that you can't use == for object (String) equality comparison).

kind regards,

Jos

8. Just a guy
Join Date
Jun 2013
Location
Netherlands
Posts
5,114
Rep Power
12

NO DON'T!

Nailing things to the entrance is a surefire way of making them completely invisible.

9. ## Re: Question about Doubles?

Originally Posted by gimbal2
NO DON'T!

Nailing things to the entrance is a surefire way of making them completely invisible.
We could nail it to their forehead ...

kindest regards,

Jos

#### Posting Permissions

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