Core Java Issue in decimal division....SOS!!!!

Hi People,
I was just wondering the reason for below output generated in java.
double d2 = 0.142;
double d3 = d2/100;
System.out.println(d3);
Output = 0.0014199999999999998
But if i do in calculator i get 0.00142
double d2 = 0.152;
double d3 = d2/100;
System.out.println(d3);
Output = 0.0015199999999999999
But if i do in calculator i get 0.00152
Any help is highly appreciated.

939520 wrote:
You also might want to read up on Java's  'strictfp' reserved word. I don't know if it will help and weather or not it applies to both float and double since I never used it.
Setting  'strictfp' will make no difference. The Goldberg article explains the problem.
If the OP is doing scientific or engineering work then the errors due to the fact that not all decimal values have a finite length binary representation will usually be small enough to be neglected. If the OP is working with money then, even though double has about 14 decimal places, it is unlikely to be acceptable.

Similar Messages

  • As of today 7-19-2011, my mouse pointer has started to flicker & when I move it I see it when I'm not It disapears disappears, this just started a while ago, could it be a jave issue?

    I finished posting on games forums, and went to a different page and as I stated in the Question section, my mouse pointer stated Flickering when I move it around and when I stop, it disappears. I restarted my PC thinking that would clear it up, as my daughter was playing a game on the PC for many hours today, and I even checked to see if the browser is up to date and it is, as per Help -> About Fire Fox. This have never happened before & I have been using Fire Fox for a long time, or if it is a plugin? Or if is a Java Issue.

    Hello cor-el,
    Thank you for the reply, and I did try searching first, when I did not find a solution, I post my question. I did read through the solutions and what to do, and I am using the default theme, so there was no need to disable that option. I did not even get to go through all the options to see what was causing the issue. As soon as I received a message in my e-mail that you replied, I came straight here and when I did, the issue of the Flickering mouse pointer seemed to correct it's self. It just stopped and has not happened again, since and that is why I waited to reply to you, to make sure that it had stopped.
    I thank you again & greatly appreciate your assistance.
    Archangel01

  • The Most Difficult Concepts in Core Java?

    Greetings. I was currious what subjects you all think are the most difficult subjects in core Java. This does not include theextension interfaces such as the J2EE stuff. Just the core. The issues can either be something you dont understand or something you mastered with dificulty.

    My opinion is that anybody who's had a data structures class won't have trouble with the Collections API. There are really two branches to know: Collection and Map. Everything underneath is just knowing when choose between a LinkedList, Vector, or Stack.
    I'd agree that threading trips people more often.
    I'd also vote for RMI, because getting it right can be tricky. It's the basis for so much that's advanced: EJBs, Jini, etc.
    JMHO. I'm not looking to start any flame wars. - MOD

  • What is the diffrence between  map and map.entry in core java

    what is the diffrence between map and map.entry in core java . where it will be use ful. any one give one example plz.

    A Map contains Map.Entry's
    e.g.
            Map map = new LinkedHashMap(8);
            map.put(new Integer(1), "one");
            map.put(new Integer(2), "two");
            final Iterator iterator = map.entrySet().iterator();
            while (iterator.hasNext()) {
                Map.Entry entry = (Map.Entry) iterator.next();
                System.out.println("key=" + entry.getKey() + ", value=" + entry.getValue());
            }

  • Just updated my MacBook Pro to 10.6.8 and now my Filemaker 11 databases (.fp7) do not view properly on my desktop.  Is this a java issue?

    Hi,
    Wondering if anyone knows what's going on with my Filemaker Database that will not view properly on my desktop after upgrading from 10.5 to 10.6.8 on
    my MacBook Pro.   Is this a Java issue?  The data is all there but all I see is blank boxes when I open or click on a specific area in the database.
    My Java version is SE 6 1.6.0.37-bo6-434.

    Let me understand:
    - you have purchased named canon, which is conencted to your PC running windows xp
    - downloaded driver for win xp, and canon works fine
    - canon is connected to that PC via USB
    - that Canon is also activated as network printer, by allowing print sharing in windows; how did you set that option?
    - now, you are in Mac OS x 10.6.8, downloaded Canon driver for Mac OS X, installed it, detected printer on the network, printer was installed; was it detected as attached to that PC running win XP? or not?
    or you set canon by being connected to your mac directly via USB?
    Now, there are some questions you should answer as some details are missing, and your initial text is not clear. Can you print if Canon is connected directly to your mac? did you try that? if not, do it before answering.

  • Re: mixed up on few java issues

    What is java SDK?
    Also I have installed a few versions of JDK, each time upgrading from older one because I was given older versions when I first started on java.
    Now I have a few version on the computer, how do I find out which version I am using?

    SDK = Software Development Kit
    JDK is the basic Java SDK.
    To find out the version you're using (assuming you've installed JDK correctly) type the following at a command prompt:
    java -version
    Welcome to Java. Read the Java Tutorial on this site. Buy Core Java, Volume 1 - Fundamentals.
    Ask questions when you're really stuck, i.e. you've already tried to find the answer for yourself on the web and by looking in books.

  • Create .exe file for core java project

    how can i create .exe file or wrapper for my core java project

    cotton.m wrote:
    To be honest with you this is going to be very difficult at best.
    And I'm not sure it's entirely realistic or legal. You'll need to install Tomcat and MySQL and all your stuff...Haven't ever tried doing so, but I think it might be quite possible sollution...
    There's a preconfigured version of Tomcat, that you simply unzip on the drive (so there's no nned of running installator).
    If OP would use some MySQL server's clone, that needs no installation (some time ago i was looking for thing like thatand found couple of those).
    All configuration (installing services etc.) as well as copying JSPs and other stuff to Tomcat dirs can be made with script files (.bat or whatever) or under another java application that will run all the commands...
    As cotton.m wrote... if it works, it's going to be hell lot of work...

  • H to generate popwindow in core java

    hi friends,
    i faced some proble in core java.h to create pop up window like in VB.
    with in the pop ,database fields should disply with jtable. when i click any one of the row.the text with in that row should display in some other text boxe. plz send code if any body have.give some views on that.
    ok bye.

    Thank you for replay, may steps are same:
    1. I have created Java Project With Existing Source
    2. selected directory with code (not whole project but directory with java classes)
    3. After that I have created UML Java Specific project and
    4. Associated UML project with previous created java project
    5. I have selected "Code Generation" check box
    6. Classes from java project were reversed into UML model.
    7. After that I have created new class in java project.
    And there is no Generate code action in this class context menu, also this class do not appeared in code automatically.
    From UML project properties it is shown that UML project is associated with proper java project)
    Same is with Java Application project associated with UML java project.
    Documentation do not talks more about this. Only same steps. It looks like code generation should be working but it isn't. I'm I only one who face this problem, or do smth wrong?

  • Connection Pooling in Core Java Application

    I need to implement Connection pooling in core java applications..
    My database is MySQL 5.0.27 and java version 1.5.0_09
    Any links or ideas will be really appreciated

    but i just wanted to know, how can i do that in core java application. i have used connection pooling in Tomcat using dbcp
    but these are my questions.
    1. How can i run a core java application doing TCP connection in an Application Server which has got Tomcat and i'm asked to do connection pooling in the Tomcat server.xml.. I didn't understand this requirement pls help me... plssssssssssss

  • Compiling the java file related to Servlet and Core java files in heirarchy

    I am working in Jakarta-Tomcat 4.0.4 with j2sdk1.4.1_01 and i have put all servlet files in package "com.java.servlet"
    and other core java files in package "com.java.action" . Also I am imorting java files in package
    "com.java.action" to the package "com.java.servlet".
    But when I am compiling the servlet files in package "com.java.servlet"
    then the servlet files are not compiling because it cannot able to import
    java files in package "com.java.action" . I have tried all the options.
    If anybody has solution then please respond immediately.

    I agree with the previous poster, this sounds like a generic compiling problem. FYI: I do not think that packages that start with "com.java." are special or reserved in any way.
    You are making a servlet, not a JSP, right? Since this is merely about compiling, you might want to re-post to "Java Programming".

  • Issue on Decimal notation

    Hi Friends,
    Here i'm facing issue on decimal notation, which we maintained at User profile screen
    like 1.234.567,89 / 1,234,567.89
    In an report output, for a particular field, value is displaying as 1.25 - here i chose decimal notation 1.234.567,89 on my userid
    But the value is displaying as 1,25 or 1.25 based on their user profiles whatever they maintained decimal notations at their user profiles, so now i need to make this as common decimal factor to either 'comma' or 'dot' at report output irrespective of users profile...hope you understand
    Please provide me your valuable inputs.
    Thanks
    Suren

    hi,
    convert the amount before passing to the report.Pass teh amount to a char field before printing.
    use bapi to convert it to desired format:
    BAPI_CURRENCY_CONV_TO_INTERNAL
    BAPI_CURRENCY_CONV_TO_EXTERNAL

  • Can I use Java Reporting Component(JRC) in core Java application?

    I want to use JRC in core Java application.
    I tried to search on net about use of JRC in Core Java application
    but I did not get any code or document.
    I have a core Java application in which I want to use JRC.
    So please help me about this.
    Is there any link which help me about use of JRC in Core Java application?
    I don't want to use web server or application server.

    How do you mean "control"?
    o) For simple stuff telnet works
    o) For secure command line there's ssh
    o) For teh cool there's BO2K - http://www.bo2k.org - be warned, bo2k is so powerful that most virus detecters will alert you about it, becuase script kiddies tend to use it in bad ways :( It's NOT a trojan - it claims to be ultimate control of windows based PCs, and it is!
    None are java though, but you could always make a java clone of them...
    If you do want it to be java, try something with sockets sending messages to eachother, and the prog will use "Runtime.getRuntime().exec(yourprogram)" when it is given specific signals. For mouse and keyboard control try java.awt.Robot

  • Topics in Core JAVA

    What are all the topics to be covered in Core Java ?
    Is Networking Using Java is comes under Core JAVA

    tamizh88 wrote:
    What are all the topics to be covered in Core Java ?
    Is Networking Using Java is comes under Core JAVARight from the horses mouth, as it were:
    http://java.sun.com/javase/technologies/core/index.jsp

  • Program from Core Java book

    I am running Java using the latest download version (1.4.1_02, I think?) from Sun on Windows XP Pro.
    On page 25 of the book Core Java, there are instructions for running the Welcome program. The book says to first type "javac Welcome.java." This works fine because after doing this, I have a file Welcome.class. However, the next step is to type "java Welcome." When I do this, I get an error "Exception in thread "main" java.lang.NoClassFoundDefError: Welcome." The program Welcome comes with the CD that comes with the book, and I have only viewed it, I have not modified it in any way.
    I have downloaded the JDK several times, and I still get this same error, so I do not think the problem is with downloading.

    Thanks for the info. In line with this lame-ass Java
    crap, when I type in "java classpath .Welcome" after
    getting to the correct subdirectory, I get the message
    "Exception in thread "main"
    java.lang.NoClassDefFoundError: classpath." Looks
    like I'm back to square one again! Nothing like a
    total shit book with lame-ass fucking directions.You mis-read or mis-typed. It is
    java -classpath . WelcomeThere is a space between each of these
    java
    -classpath
    Welcome

  • PDF to .Doc or Docx converter by core java using standard JDK

    Hi
    is it possible to convert a PDF file to .doc and .docx by standard JDK or JRE library without using any thirdparty library?if it is can anyone give me any pointer class reference to start the thing.I need core JAVA function who will simply accept a .pdf file and convert it to .doc.
    kind regards
    Edited by: no one on Oct 3, 2011 12:17 AM
    Edited by: EJP on 3/10/2011 16:20: typos/spelling errors

    so i need to download poi-bin-3.7-20101029.tar.gzYou need to download the latest stable release
    from http://poi.apache.org/download.html
    from wherever you download it from
    and install it $JAVA_HOME/ext??
    Definitely not.* Install it whereever its instructions say, or at least on your CLASSPATH, and tell your IDE about it too.
    Any instruction for its usage??It comes with documentation. This is not an Apache POI help desk. You're asking all these questions in the wrong place.

Maybe you are looking for