How to make floating point division

I have tried many alternatives but i couldnt make any single floating point number printed to a page...
I am compiling the servlet with eclipse 3.2 without any error but the jsp page says      java.lang.NoSuchFieldError: floatnumber even i have that variable...
i have tried double,float but both of them makes the error above...but i can print long as well.
can anyone teach me to divide 2 integer values and print the exact result like;
3 / 5 = 0.6

can anyone teach me to divide 2 integer values and
print the exact result like;
3 / 5 = 0.6
int a= 3, b= 5;
double result= ((double)a)/b;... or any valid variation thereof.
kind regards,
Jos

Similar Messages

  • How can floating point division be faster than integer division?

    Hello,
    I don't know if this is a Java quirk, or if I am doing something wrong. Check out this code:
    public class TestApp
         public static void main(String args[])
              long lngOldTime;
              long lngNewTime;
              long lngTimeDiff;
              int Tmp;
              lngOldTime = System.currentTimeMillis();
              for( int A=1 ; A<=20000 ; A++)
                   for( int B=1 ; B<=20000 ; B++)
                        Tmp = A / B;
              lngNewTime = System.currentTimeMillis();
              lngTimeDiff = lngNewTime - lngOldTime;
              System.out.println(lngTimeDiff);
    }It reports that the division operations took 18,116 milliseconds.
    Now check out this code (integers replaced with doubles):
    public class TestApp
         public static void main(String args[])
              long lngOldTime;
              long lngNewTime;
              long lngTimeDiff;
              double Tmp;
              lngOldTime = System.currentTimeMillis();
              for( double A=1 ; A<=20000 ; A++)
                   for( double B=1 ; B<=20000 ; B++)
                        Tmp = A / B;
              lngNewTime = System.currentTimeMillis();
              lngTimeDiff = lngNewTime - lngOldTime;
              System.out.println(lngTimeDiff);
    }It runs in 11,276 milliseconds.
    How is it that the second code snippet could be so much faster than the first? I am using jdk1.4.2_04
    Thanks in advance!

    I'm afraid you missed several key points. I only used
    Longs for measuring the time (System.currentTimeMillis
    returns a long). Sorry you are correct I did miss that.
    However, even if I had, double is
    also a 64-bit data type - so technically that would
    have been a more fair test. The fact that 64-bit
    floating point divisions are faster than 32-bit
    integer divisions is what confuses me.
    Oh, just in case you're interested, using float's in
    that same snippet takes only 7,471 milliseconds to
    execute!Then the other explaination is that the Hotspot compiler is optimizing the floating point code to use the cpu floating point instructions but it is not optimizing the integer divide in the same way.

  • How to make floating image with dim background

    hi guys, i would like to know how to make a floating image and the background will dim? like for example when you click a thumbnail, the bigger version of that image will pop up on the same page and will have a dim background? can someone point me to a tutorial? any help would be appreciated, thanks in advance!

    Hi,
    If you look at the tutorials in fireworks such as changing images/rolover images you will start to get an understanding.
    Cheers

  • How to  make Measuring Point Description Field scrollable on the Detail Read Screen

    In the Measuring Point Read Detail Screen (Rounds Manager), the description field does not have a scroll bar like it does on the Point Read Counter Detail Screen.  This means that the end-user has to arrow-over to the right on the handheld device to see the entire description.  We changed the transaction property to be the same as that on the measuring point field on the Counter screen but that did not resolve the issue.  We are assuming that the field width is defined in columns but are not sure if columns is the same as pixels.  It seems like there is some type of behind the sceens calculation based on the number of pixels used by the characters in the description.  The transaction property does have word wrap activated but it seems to make no difference. Does anyone have any suggestions on what can be done to make the measuring point description have a scrollbar and have the description wrap?  The Rounds Server is version 2.3.
    Tags edited by: Michael Appleby

    1. wall of unformatted code. Use \ tags when posting code.
    2. you're not even asking a question. You're just saying "it doesn't work" and then you dump the code. What do you expect? That people now go to debug it for you?                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to make Shipping point mandatory in VT01N transaction

    my requirement is when we goto transaction VT01N and provide TransportPlanningPlant
    and Shipment type , and click on delivery there is a field Shipping point which i need to make as mandatory.
    or if the user wants to continue without Shipping point  it should give some message and further processing should not be done.
    is there any user exit/badi for this?
    please let me know if there is any way other than transaction varient.

    These are the BADIs/User Exits available. Also check for Enhancement points.
    Enhancement
    V56USVDP                                Preparation for updating new objects for transport?
    V56USVDO                                Update new objects for transport
    V56USTAT                                User-individual definition of transportation planning status
    V56UNUMB                                Shipment number allocation
    V56UDLUP                                Obsolete as of 4.6C: Delivery Update on Delivery Routines
    V56UCHCO                                Check shipments are complete
    V56UCHCH                                Shipment processing: Check whether changes were made
    V56TDLIF                                Filter Delivery Items for Shipment
    V56SLDET                                Shipment processing: Leg determination
    V56MVT04                                Extensions for Collective Processing of Shipments
    V56LOCID                                Shipment Processing: Determine Location Identification
    MV56AINI                                Initialization of transaction control for transportation
    V56AFCCH                                Shipment processing: Check function code allowed
    V56AGTAR                                User Exit for Filtering Shipping Unit Calculation
    V56ARCHV                                Customer-spec. checks for archiving shipments
    V56ATKTX                                Change the number of lines for text input in shipment
    V56BMOD                                 Transportation processing: Field modification
    V56DISTZ                                Shipment Processing: Determine Distance
    V56FCOPY                                Shipment processing: Copy delivery data
    V56FSTAT                                Shipment processing: Activities when setting a status
    V56L0001                                Status of Shipments for a Delivery
    V56LDELI                                Read Delivery Data for Shipment Processing
    Business Add-in
    BADI_LE_SHIPMENT                        BadI: Shipment Processing
    BADI_V56N                               User Exit Transport - Message Determination
    Alistair

  • How to make Path point from inputed variable

    Hi Im wandering how I can replicate the rectangle tool in Illustrator where by I can input sizes into a window and it shall draw an object for me. The problem I have is stating that a point should be a (variable1,variable2) instead of (X,Y)
    im using the java ExtendScript Toolkit. so im trying:
      var docRef = documents.add();
        var piRef = activeDocument.pathItems;
        var pathRef = piRef.add();
      pathRef.setEntirePath( new Array(
      new Array(0, 0),
      new Array((shapeWidth), (shapeHeight)) ) ) ;
    Although what im looking to do is more complex this is the part giving me trouble
    any help would be greatly appreciated

    Thank you for the response
    Yeah, I understand. I have to put the keyword first, the problem is sometimes I transfer almost around 800 photos at once. I haven't had much time to sort every photos and put the keyword on every Path photo. Beside so many photos in my library, and not well-organized. Also I have tried any possibilities of relevant criteria in smart album. But still zero result.
    So, before I actually take the time to organize my thousands of photos manually, I was thinking maybe there's another way, simple and smart one, with this smart album feature. Anyone?
    Ismail

  • How to make the pointer work when clicking?

    Hi,
    I have purchased a new Macbook Pro and am at set up stage yet. I can't go further because the pointer is not working when I am clicking. I can't click on "Start using Mac OS X Lion." I have become so frustrated now! Please let me know if I can fix it or I have to return it to apple centre for fixing.
    Cheers,
    Mehrshaad

    Press the 'tab' key on your keyboard a couple of times. You should see the blue highlight/focus move between options. When its on the option you want, hit the spacebar.
    There may be something wrong with your trackpad. Try pressing down quite hard in the bottom left corner. It it takes an unreasonable amount of force, take it back to the shop to have it cleaned or replaced.
    I had exactly this problem from new (in 2009) and never bothered to get it fixed because I mostly use 'tap to click'
     > System Preferences > Trackpad | One Finger - tap to click
    but it is an PITA in installation and recovery mode where that gesture is off by default.

  • Floating-point addition unit

    Hello All,
    I am very new to NI and I am looking for an example of floating-point addition unit. Basically, I am looking for some example to perform addition of two floating point number (single or double precision). -- just how to create floating-point addition unit using logical gates model (i.e. AND, OR, XOR, etc)
    Thank you!
    Leo
    Message Edited by smuStudent on 12-05-2005 11:51 PM

    Most (if not all) of us, when we want to do floating point math just put the Add function onto the block diagram. I would suggest you google for floating point gates or something similar. You can create subVIs that make up the basic functions such as a full adder and then link them together as needed.
    Attachments:
    Full Adder.JPG ‏9 KB

  • 128-bit floating point numbers on new AMD quad-core Barcelona?

    There's quite a lot of buzz over at Slashdot about the new AMD quad core chips, announced yesterday:
    http://hardware.slashdot.org/article.pl?sid=07/02/10/0554208
    Much of the excitement is over the "new vector math unit referred to as SSE128", which is integrated into each [?!?] core; Tom Yager, of Infoworld, talks about it here:
    Quad-core Opteron? Nope. Barcelona is the completely redesigned x86, and it’s brilliant
    Now here's my question - does anyone know what the inputs and the outputs of this coprocessor look like? Can it perform arithmetic [or, God forbid, trigonometric] operations [in hardware] on 128-bit quad precision floats? And, if so, will LabVIEW be adding support for it? [Compare here versus here.]
    I found a little bit of marketing-speak blather at AMD about "SSE 128" in this old PDF Powerpoint-ish presentation, from June of 2006:
    http://www.amd.com/us-en/assets/content_type/DownloadableAssets/PhilHesterAMDAnalystDayV2.pdf
    WARNING: PDF DOCUMENT
    Page 13: "Dual 128-bit SSE dataflow, Dual 128-bit loads per cycle"
    Page 14: "128-bit SSE and 128-bit Loads, 128b FADD, 128 bit FMUL, 128b SSE, 128b SSE"
    etc etc etc
    While it's largely just gibberish to me, "FADD" looks like what might be a "floating point adder", and "FMUL" could be a "floating point multiplier", and God forbid that the two "SSE" units might be capable of computing some 128-bit cosines. But I don't know whether that old paper is even applicable to the chip that was released yesterday, and I'm just guessing as to what these things might mean anyway.
    Other than that, though, AMD's main website is strangely quiet about the Barcelona announcement. [Memo to AMD marketing - if you've just released the greatest thing since sliced bread, then you need to publicize the fact that you've just released the greatest thing since sliced bread...]

    I posted a query over at the AMD forums, and here's what I was told.
    I had hoped that e.g. "128b FADD" would be able to do something like the following:
    /* "quad" is a hypothetical 128-bit quad precision  */
    /* floating point number, similar to "long double"  */
    /* in recent versions of C++:                       */
    quad x, y, z;
    x = 1.000000000000000000000000000001;
    y = 1.000000000000000000000000000001;
    /* the hope was that "128b FADD" could perform the  */
    /* following 128-bit addition in hardware:          */
    z = x + y;
    However, the answer I'm getting is that "128b FADD" is just a set of two 64-bit adders running in parallel, which are capable of adding two vectors of 64-bit doubles more or less simultaneously:
    double x[2], y[2], z[2];
    x[0] = 1.000000000000000000000000000001;
    y[0] = 1.000000000000000000000000000001;
    x[1] = 2.000000000000000000000000000222;
    y[1] = 2.000000000000000000000000000222;
    /* Apparently the coordinates of the two "vectors" x & y       */
    /* can be sent to "128b FADD" in parallel, and the following   */
    /* two summations can be computed more or less simultaneously: */
    z[0] = x[0] + y[0];
    z[1] = x[1] + y[1];
    Thus e.g. "128b FADD", working in concert with "128b FMUL", will be able to [more or less] halve the amount of time it takes to compute a dot product of vectors whose coordinates are 64-bit doubles.
    So this "128-bit" circuitry is great if you're doing lots of linear algebra with 64-bit doubles, but it doesn't appear to offer anything in the way of greater precision for people who are interested in precision-sensitive calculations.
    By the way, if you're at all interested in questions of precision sensitivity & round-off error, I'd highly recommend Prof Kahan's page at Cal-Berzerkeley:
    http://www.cs.berkeley.edu/~wkahan/
    PDF DOCUMENT: How JAVA's Floating-Point Hurts Everyone Everywhere
    http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
    PDF DOCUMENT: Matlab's Loss is Nobody's Gain
    http://www.cs.berkeley.edu/~wkahan/MxMulEps.pdf

  • IEEE 754 standards for representing floating point numbers

    HI All..
    Most of us are not awared how the actually Floating point numbers are represented . IEEE have set standards as how should we represent floating point numbers.
    I am giving u the link with which u can know how actually these are represented.
    http://en.wikipedia.org/wiki/IEEE_754
    If u have any doubts u can always reach me.
    Bye
    Happy learning
    [email protected]

    A noble but misguided attempt at dispelling the recurring problems the programmers have over and over again. There have been repeated posts to links about the IEEE standard, to little or no avail. The newbies who run into the problems will continue to do so, without regard to yet another post about it here.

  • Tcl event manager floating point with tcl_precision

    Hello,
    How can the floating point be modified in a event manager tcl script ?
    Currently I am trying to write a tcl script to check for disk utilization. I am dividing the free space upon the total space to get a percentage.
    and I am always getting "0", so no floating point.
    I have tried to modifiy the "floating point" with set tcl_precision but I get the following error :
    --> can't set "tcl_precision": can't modify precision from a safe interpreter
    Is there a way to modify the floating point ?
    I appreciate very much the help on this issue,
    Thank you in advance,

    IOS doesn't do floating point.  You can trick it, though, with something like:
    set used [expr ${free}.0 / ${total}.0]

  • How to make the text in sub-division

    Hi,
    I am usign text  module in my adobe forms.
    Text in text module contains sub-divisions as a), b) and c). Each sub-division are in a separate line.
    While in pdf, all the sub-division combines and comes a single paragraph.
    What  would be the problem for this issue? Any Idea?
    May I know how to make the text in sub-division as in text  module?
    Thanks,
    Thiyagu
    Edited by: Thiyagu on Oct 26, 2009 7:08 PM

    Hello, experiment with Object - Field tab. Do you have your text field with "allow multiple lines" checked? I guess so. And what about the field format? Plain text or Rich text? Please try:)) Regards, Otto

  • How to make the WTR 610N external (USB) storage port my network common BackUP point..

    My networked PC's (XP Pro & VISTA Ultimate OS's) are set up to share those Folders & files I've selected for BackUp.  I intend to connect a 600 Gb ext HD to my WTR 610N Ext Storage port.  I hope a simple instruction (Move to...;Copy to...; even  Point & drag) will suffice to create the BackUp.  What commands should I use to select location and name of that special BackUp port.?

    How to Make my Macbook Pro's internal HDD external, when I get a SSD?
    Get an externel enclosure at the same time.
    You can order from OWC
    http://eshop.macsales.com/shop/hard-drives/2.5-Notebook/
    Put the SSD in the externel enclosure and use something like Carbon Copy Cloner,  to clone the internal drive and all it content to the SSD.  Then swap them out.
    Always good to have more than one backup.

  • How to gather a set of floating point numbers from a web page form?

    I am pretty new to Java and I am working on a project to apply Benfords law to find the probability of digits submitted by the user. My first step is to gather set of floating point numbers from a web page. How do I go about doing this? Any suggestion or a proper site where I can learn this stuff will be highly appreciated.

    I am using NetBeans IDE 5.5.1 and for this project. I have realized that the first question was not well phrased.
    I created a web project with 2 jsp files and a class file in it. When my jsp file runs I ask the user to enter a number for finding the probablility based on Benfords law.
    This is what I got so far:
    This is input.jsp
    <h1></h1>
    Please enter a number to be checked
    <form action="result.jsp" method="post">
    <input type="number" name="number" >
    <input type="submit" value="Check number">
    </form>
    </body>
    </html>
    This is result.jsp
    String number=request.getParameter("number");

  • How does Java store floating point numbers?

    Hello
    I'm writing a paper about floating point numbers in which I compare an IEEE-754 compatible language [c] with Java. I read that Java can do a conversion decimal->binary->decimal and retain the same value whereas c can't. I found several documents discussing the pros and cons of that but I can't find any information about how it is implemented.
    I hope someone can explain it to me, or post a link to a site explaining it.
    Cheers
    Huttu

    So it is a myth.
    I still ask because I observed a oddity: When I store 1.4 in c and printf( %2.20f\n",a); it I get 1.39999999999999991118. If I do the same in Java with System.out.printf( %2.20f\n",a); I get 1.4. If I multiply the variable with itself I get 1.95999999999999970000:
    double a=1.4;
    a=a*a;
    System.out.printf( %2.20f\n",a);
    {code}
    Does this happen because of the rounding in Java?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • STARTUP ON MY NOTEBOOK WANTS TO GO TO REPAIR AND THEN RESTORE

    Lately my HP Pavilion g7 notebook PC A7A44UA#ABA goes to a white screen when I turn it on. Then it wants to repair and then restore. I have turned it off and restarted a couple of times to try to start it normally.It does start but there are lines at

  • Org.apache.openjpa.persistence.PersistenceException: Getrennte Verbindung

    Hello, did someone know something helpfull to the following errormessage? JB Exception: ; nested exception is: javax.ejb.EJBException: EJB Exception: : <openjpa-1.1.1-SNAPSHOT-r422266:965591 nonfatal general error> org.apache.openjpa.persistence.Pers

  • Missing table begin XSL context for: ?end if?

    I have 8 if clauses with grouping sub grouping data shown. when I try to validate my RTF file I am getting following error msg: [061112_073853972][][ERROR] [Line 3322.83] Missing table begin XSL context for: <?end if?> [061112_073854018][][ERROR] [Li

  • Multi currency payment program

    Hi Experts, how to implement multi currency payment program for international payroll. and also how to implement multi currency offcycle payments. give me some brief procedure, right now my client doing only one currency, upgrading to multi currency

  • How I reinstall removed Mac App Store

    Hi everyone, I have a problem. I'm using Mac OS X Mountain Lion 10.8.5 and I removed the Mac App Store from my iMac (accidentally). Now, I want to install the new Mac OS X Mavericks but I need the App Store to do. I tried to extract "AppStore.app" fr