The Artima Developer Community
Sponsored Link

Actors in Scala Forum
Java -Decimal Numbers

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
raam medaramitla

Posts: 2
Nickname: mpraam
Registered: Dec, 2013

Java -Decimal Numbers Posted: Dec 8, 2013 10:15 PM
Reply to this message Reply
Hello Artima;
Good Morning

Here I come up with a code that donot produce an accurate result
// my program goes like this

public class FloatingNumber {

public static void main(String...args) {

double i;
double num=0.0;



// output: 0.9999999999999999

the same code writen in C produced an Accurate result
// the C program goes like this



double i, num=0.0;


// output: 1.0000

/** please explain me the difference and suggest me a bettrcode to obtain an accurate result through Java
Thanks in advance.

Topic: Writing test cases in ScalaTest - pointers requested Previous Topic   Next Topic Topic: My book delevery

Sponsored Links


Copyright © 1996-2018 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use