Exponentail operations using BIGDECIMAL

hi all
Can u someone provide me links, notes, codes and suggestions to perform exponential operations using BigDecimal.
Thankz in advance
Arun :)

If you require greater precision than double provides
and your exponent is integer try
Google [
[url=http://www.google.com/search?hl=en&ie=UTF-8&q=squa
e+and+multiply&btnG=Google+Search]square and
multiply ]Good point. I forgot the obvious. m^2 = m * m, etc.

Similar Messages

  • Using bigdecimal class

    I was using Gregory-Leibniz series to calculate PI = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + ...
    Something like:
    double pi = 0.0;      
           int limit = 3000000;      
           for (int i = 0, y = 1; i <= limit; y+=2, i++)
                     if (y == 1)
                          pi = 4;
                   else if (i % 2 == 0)
                          pi += (double)4/y;            
                     else
                          pi -= (double)4/y;                                                   
                     System.out.println(String.format("Loop %d: %.20f", i, pi));                                    }Then I realized PI isn't going to be totally accurate according to IEEE Standard for Binary Floating-Point Arithmetic that java math calculation uses, so I was trying to use BigDecimal class (new to me), this is what I got initally...
             BigDecimal pi = new BigDecimal("0.00");           
              int limit = 3000000;
              for (int i = 0, y = 1; i <= limit; y += 2, i++)
                  if (y == 1)
                          pi = new BigDecimal("4.0");
                   else if (i % 2 == 0)
                          pi = pi.add(new BigDecimal( Double.toString( (double) 4 / y )));
                     else
                          pi = pi.subtract(new BigDecimal( Double.toString( (double) 4 / y )));
                        System.out.println(String.format("Loop %d: %s", i, pi.toString()));                                       
    I realize that when I do the 4/y calculations involving both doubles... the result is probably stored according to the IEEE standards which is the thing to avoid... Is that correct? Is my PI result going to be accurate?
    I noticed with this one decimals up to the 22nd place are all filled with some numbers in the calculations compared with the first one involving only double number calculations which had zero's starting around the 15th decimal.
    Something like doesn't work and ends up with arithmeticexceptions...
    pi = pi.subtract(new BigDecimal("4").divide(new BigDecimal(Integer.toString(y))));
    So I'm actually confused about the right way of using BigDecimal class in this type of calculation to get accurate results. I do realize it's an immutable class and probably a bad idea to use it like this 3 million times in a loop.

    quoting from the API documentation on BigDecimal
    "The BigDecimal class gives its user complete control over rounding behavior. If no rounding mode is specified and the exact result cannot be represented, an exception is thrown; otherwise, calculations can be carried out to a chosen precision and rounding mode by supplying an appropriate MathContext object to the operation."
    That explains the arithmetic exceptions.
    You would be advised to choose your scale first, (that would be the number of decimal places that you want to be using for your calculation. ) Then use the BigDecimal constructors that use the scale value. Construct your BigDecimal 4 outside of the loop so that you are not constructing it over and over again. And finally, read the documentation on how the scale of the result will depend upon the scale of the components going in.
    A little reading and possibly re-reading of the documentation will help in the understanding of the BigDecimal class.

  • KEY LOOKUP Operator using TCL

    Hi,
    I am trying to create a key lookup operator using tcl.
    OMBALTER MAPPING 'TESTMAP' ADD KEY_LOOKUP OPERATOR 'INSTITUTION_CHARACTERISTIC_DIM'\
    SET PROPERTIES (BOUND_NAME,CREATE_NO_MATCH_ROW, LOOKUP_CONDITION)VALUES
    ('INSTITUTION_CHARACTERISTIC_DIM','true','OUTGRP1.INSTITUTION_CHAR_SRCKEY
    = INGRP1.INST_CHAR_SRCKEY')
    and then adding an attribute to the INGRP
    OMBALTER MAPPING 'TESTMAP'ADD ATTRIBUTE 'LAST_ACTIVITY_DATE' OF GROUP 'INGRP1' OF OPERATOR 'INSTITUTION_CHARACTERISTIC_DIM'
    This is creating a key lookup operator by the name
    INSTITUTION_CHARACTERISTIC_DIM, and i can see the Bound Name in the
    properties window, but when i double click and open the key lookup, i
    dont see the result table under the LOOK UP tab.Because of this, the
    attributes dont get added in the OUTGRP of the key lookup.
    Am i missing some important property of a key look up?
    can some one please help me with this...
    Thanks in advance...

    Hi,
    you have to bind the lookup operator to the table:
    OMBALTER MAPPING 'MAP_LOOKUP' ADD KEY_LOOKUP OPERATOR 'MY_LOOKUP' BOUND TO TABLE '/MY_PROJECT/MY_DB/DIM_CUSTOMERS'
    OMBALTER MAPPING 'MAP_LOOKUP' MODIFY OPERATOR 'MY_LOOKUP' SET PROPERTIES (CREATE_NO_MATCH_ROW, LOOKUP_CONDITION)VALUES ('true','OUTGRP1.ID_CUSTOMER=INGRP1.ID_CUSTOMER')
    OMBALTER MAPPING 'MAP_LOOKUP' ADD ATTRIBUTE 'ID_CUSTOMER' OF GROUP 'INGRP1' OF OPERATOR 'MY_LOOKUP'Regards,
    Carsten.

  • Sharepoint 2013 copy/move operation using Content and Structure fails

    Hi,
    We had a recent upgrade from SP2010 to SP2013 environment. After the migration, we realized that the
    copy/move operations using Manage content and structure(sitemanager.aspx) is not working as expected, neither does this give any error nor is it stuck. In fact if I check the content and structure log I find the message as
    succeeded but file/item is not copied to the target. 
    The strange thing is that if I am performing this operation with Full Control permission level it
    does not work but if I do the operation as Site collection admin it works without problem. I know if sub-sites are to moved then one should be site col admin but in this case I am trying to move just documents or pages.
    Any help will be greatly appreciated.
    Thanks

    Hi Vineet,
    According to your description, my understanding is that copy/move operation using Content and Structure cannot work in SharePoint.
    I recommend to check if there are any custom fields in the source list/library and target list/library. If yes, delete the custom fields to see if the issue still occurs.
    Here is a similar thread for you to take a look:
    http://social.technet.microsoft.com/Forums/en-US/56d803d7-8573-4c29-9f6b-c63023941f44/manage-content-and-structure-cannot-move-or-copy-items?forum=sharepointgeneralprevious
    To copy or move files/items between sites, we need to have
    appropriate permissions on both sites.
    I recommend to check if the user has full control on both sites.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • How to perform merge operation using Data services designer?

    I am new here and new to Data Services Desinger as well.
    And currently, I want to do a merge operation using query transform or table comparison transform. But sadly, neither one of them is giving me what I want.
    So, wonder if you could help clarify if either one of them could achieve MERGE operation between and source and target tables?
    if positive, then how?
    PS:
    by MERGE, i mean, if data exists in target table, then only do update, else, do insert. same with the standard MERGE operation of oracle.
    If you need any more info, let me know!
    Thanks in advance.

    You can do this.
    You don't need the Tabe_Comparison transform actually.
    Just query the data you need and output the flow from your query to your target table.
    Then, you'll have to check the "Auto correct load" option: this will insert new lines and updates old ones. One checked, you can ckeck the "Auto correct load" checkbox.
    By default, BODS will know a line already exists based uppon the primary key columns of your target table. If you want to change the columns used to determine if a line should be inserted or updated, use the "Use input key" checkbox (and define some PK column in your query).
    Hope this helps
    Guillaume

  • Safari doesn't work ! Version 6.0.2 - but the internet connection is operational using Skype - what to do?

    Safari doesn't work ! Version 6.0.2 - but the internet connection is operational using Skype - what to do? runing 10.8.2
    Thanks for your support in advance.

    I don't know about Growl as I've never used it. But I'd remove anything that might involve your internet connection. To remove Growl: http://growl.info/documentation/growl-package-removal.php
    In my earlier post I asked do you have any Anti Virus software installed?
    Do you have access to another computer so you could download another browser, perhaps onto a USB stick and then install it on your Mac just to see if the problem is Safari specific:
    Google Chrome: https://www.google.com/intl/en_uk/chrome/browser/
    Firefox: http://www.mozilla.org/en-US/firefox/new/

  • Mathematical calculations using BigDecimal

    Hi all,
    I am doing some mathematical calculations using float variables. They are not working properly because of rounding issues....So, before I change the whole program to do the same calculations using BigDecimal, just wanted to check out whether there are any catches in that also. Like, is it safe if I do BigDecimal.add, subract etc. instead of addding the floating point numbers directly.....Can I be assured that the results will be precise, to 2 decimal places?
    Any help will be appreciated...
    Thanks

    The "catch" is that computers do not work with real numbers. They work with representations of real numbers like finite decimals or fractions. My advice is to continue to use doubles, but do not expect infinitely precise results and round the values when outputting them.

  • Determine Number of Decimal Place using BigDecimal

    I was interested to have the following getNumberOfDecimalPlace function :
    System.out.println("0 = " + Utils.getNumberOfDecimalPlace(0)); // 0
    System.out.println("1.0 = " + Utils.getNumberOfDecimalPlace(1.0)); // 0
    System.out.println("1.01 = " + Utils.getNumberOfDecimalPlace(1.01)); // 2
    System.out.println("1.012 = " + Utils.getNumberOfDecimalPlace(1.012)); // 3
    System.out.println("0.01 = " + Utils.getNumberOfDecimalPlace(0.01)); // 2
    System.out.println("0.012 = " + Utils.getNumberOfDecimalPlace(0.012)); // 3
    I use the following code
        public static int getNumberOfDecimalPlace(double value) {
            final BigDecimal bigDecimal = new BigDecimal("" + value);
            final String s = bigDecimal.toPlainString();
            System.out.println(s);
            final int index = s.indexOf('.');
            if (index < 0) {
                return 0;
            return s.length() - 1 - index;
        }However, for case 0, 1.0, it doesn't work well. I expect, "0" as result. But they turned out to be "0.0" and "1.0". This will return "1" as result.
    0.0
    0 = 1
    1.0
    1.0 = 1
    1.01
    1.01 = 2
    1.012
    1.012 = 3
    0.01
    0.01 = 2
    0.012
    0.012 = 3
    Any solution?

    Please [don't cross-post!|http://stackoverflow.com/questions/2296110/determine-number-of-decimal-place-using-bigdecimal], it's considered rude. If you must do it, then at least link each post so that people can find out which answers you've already got in order to avoid duplicate work on our part.
    Please read [_How To Ask Questions The Smart Way_|http://www.catb.org/~esr/faqs/smart-questions.html].

  • Can we perform Join operation using SQLCall with Datatabae Query

    Hi,
    I am working on Toplink SQLCall query. I am performing join operation but, it is giving error.
    so please, any can tell me . we can perform join operation using SQLCall with Database Query
    Thanking You.

    You can use joining with SQLCall queries in TopLink, provided your SQL returns all of the required fields.
    What is the query you are executing and what error are you getting?

  • How to determine mobile operator used

    I have bought a second hand iPhone 4s. The seller did not know which operator used. I need this info in order to unlock the mobile and switch operator. How can I determine the old operator used?

    Go to settings, general, about, and see what it says for carrier. I would be concerned about a phone that I purchased where the person selling it did not know who the carrier was. Did they not know who they paid for sevice? I would not be surprised if you cannot use this phone.

  • Disabling attributes or operations using StandardMBean

    In the Best Practices document at http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/best-practices.jsp I find the following advice:
    If you need some particular abilities of Dynamic MBeans, for example the ability to supply descriptions for the attributes or operations, or the ability to disable certain attributes or operations, then you should consider subclassing javax.management.StandardMBean rather than implementing the DynamicMBean interface.
    I'm trying to learn about the various types of MBeans. Are there any details available on how to disable certain attributes or operations using a subclass of StandardMBean, and does anyone have a good use case for this feature?
    Thanks...

    Hi,
    Disabling attributes and operation is not something I would recommend, but if
    you need to do it it should be relatively easy to use javax.management.StandardMBean
    for that.
    For instance if you want to disable invoke for a given MBean, you could
    write a subclass of StandardMBean and override its invoke method to do something
    like:
    @Override
    public Object invoke(String methodName, Object[] params, String signature)
               throws ... {
       // disable method whatever
       if (methodName.equals("whatever"))
          throw UnsupportedOperationException("method whatever is disabled");
       // allows other methods
       return super.invoke(methodName,params,signature);
    }For background reading see:
    javax.management.StandardMBean: When and Why.
    http://blogs.sun.com/jmxetc/entry/javax_management_standardmbean_when_and
    -- daniel
    http://blogs.sun.com/jmxetc

  • Assignment of components to operations using LSMW

    Hi
    i created routing using LSMW.
    i created all the operations using direct nput methode
    and  material to group assignmebt using batch input methode.
    but i was not able to assign my components of the BOM to my routnig operations.
    How to do this.
    which one is the best and easy way. direct or batch input methode.

    Dear,
    Now I am clear.
    You need to create different 2 BOM and with BOM items, as below,
    example - total requirement of material A is say 10.
    Semi finished Product- X BOM
    BOM item 1 - material A-qty 8
    BOM item 2 - material B-qty -5
    Finished material Y - BOM
    BOM item 1 - semifished material X-qty 10
    BOM item 2 - material C-qty 10
    BOM item 3 - material A-qty 2
    BOM item 4 - material D-qty -2
    You need to create above 2 BOM's if you want to see semifished product into inventory, if not proceed as below
    Finished material Y - BOM
    BOM item 1 - material A-qty 8 assign it to routing operation 10
    BOM item 2 - material B-qty -5 assign it to routing operation 10
    BOM item 2 - material C-qty 10 assign it to routing operation 20
    BOM item 3 - material A-qty 2 assign it to routing operation 30
    BOM item 4 - material D-qty -2 assign it to routing operation 30
    I think this is the only way you can map it.

  • Creating Routings Operations using BAPI_ROUTING_CREATE

    Hello,
    I am creating Routing operations using BAPI_ROUTING_CREATE. The parameters which I am using are:
    PROFILE
    TASK
    MAT_ALLOC
    OPERATIONS.
    The group counter and group are given internal number assignment.
    In my case for 1 material number plant combination only 1 task exist. This can be considered as Header record. For this Header record there are multiple operations. My program calls BAPI only When any combination of MATNR or WERKS changes in MAT_ALLOC. It works fine for 1 operation but fails incase of multiple operations. The error is routing material assignment does not exist. I have checked for all madatory parameters in FM documentation. The BAPI when executed independently works fine but in program it fails.File format is
    Mat. No. Plant Key Date Status Usage Operation Number Work center Control Key Description val unit.
    I am calling BAPI only when Mat no or plant changes.Unitl then I append the data in internal tables.
    Passing the data in this format every operation is given Mat No and Plant, then y it is giving error routing material assignment does not exist.
    Please help in this regard.
    Thanks
    Khushboo

    Well actually that´s almost exactly what my task is as well.
    So what i do is:
    - reading the headdata of the given routing (the one which is to be copied)
    - reading the positiondata of the given routing (the one which is to be copied)
    then calling the BAPI_ROUTING_CREATE while exporting the headdata and the positiondata to the BAPI.
    It works perfect for the routing itself, but the BAPI doesnt create any operations while it displays a sucess message and NO errormessages.

  • Upload Multiple Operation using BAPI_ROUTING_CREATE

    Sir,
    I have to upload routing operation using this BAPI_ROUTING_CREATE. I have created a upload program for that.
    I have collect the data in Task, material and Operation table. They have multiple line item against One Material.
    but after executing this bapi gives this type of error.
    E
    Create task list: Consistency check was not successful
    A
    For further processing, the routing entry is missing.
    So Please Guide me how to do this.
    Data :
    Multiple Operation have One Material.
    Thanks!
    Ram

    Well actually that´s almost exactly what my task is as well.
    So what i do is:
    - reading the headdata of the given routing (the one which is to be copied)
    - reading the positiondata of the given routing (the one which is to be copied)
    then calling the BAPI_ROUTING_CREATE while exporting the headdata and the positiondata to the BAPI.
    It works perfect for the routing itself, but the BAPI doesnt create any operations while it displays a sucess message and NO errormessages.

  • Why i can't make a normal video call over my cellular operator using by iphone 4s ????!!!! is it possible that if my mobile is iphone so i can not contact (Video Call - or Send Files over Bluetooth ) people do not have iphone ??????!!!!!!!!!

    why i can't make a normal video call over my cellular operator using by iphone 4s ????!!!!
    is it possible that if my mobile is iphone so i can not contact (Video Call - or Send Files over Bluetooth ) people do not have iphone ??????!!!!!!!!!
    i'm still looking for solution, but if i there is no solution so i will throw My Own iPhone 4S in the nearest Trash.
    (I had got a big problem and thanks for Nokia saved me. and if i don't care about apple products i will never send to you this, so kindly find solution or people in middle east will stop using iphone)

    No clue why you cannot make video calls over your cellular operator... have you tried contacting them?
    If you're referring to FaceTime, it is currently limited to Wi-Fi only.
    Sending files via Bluetooth is not a supported feature of the iPhone or iOS.  A simple search of the web or these forums would have made that abundantly clear.
    Threatening to throw away valuable items in these forums only serves to make you look less than intelligent.  No one here is an Apple employee, we are all users like yourself.  As such, we could care less what you do.  If you choose to be stupid, that's up to you.
    Educate yourself and stop whining.

Maybe you are looking for

  • Processing options for EDI vendor Invoices

    I'm trying to get a better understanding of what my options are for processing EDI vendor invoices and would appreciate some help.  I'm using  message type INVOIC02 with process code INVL and in configuration I've set the processing option in table T

  • How can I run a 27" Apple Cinema Display and another monitor from my MacBook Pro?

    Hi everyone, I recently purchased a brand new 15"  MacBook Pro to replace my old one. I was told when ordering it that I would be able to hook up two external monitors to it using the Matrox DualHead2Go hardware. So, I also bought a 27" Cinema Displa

  • Can i use exchange 2010 in the mail(4.5)?

    Can i use exchange 2010 in the mail(4.5)? i can't use exchange 2010 in the mail (4.5),but i can use normally in the mail (3.6).why?

  • Pop up in manual orders but not in EDI

    Hi Friends, Please help me. I have  anice issue. When the user try to create a sales order he is getting a pop up or a warrning message saying that the line item has to be a delivery quanity of 20 40 60,when 1 box + 20 pices ,viz. This pop up is only

  • Designing D

    Hi, where can i get an application to design my dabatase structure ? Like a flowchart...to insert Tables, Fields, relations,... so that i can print it and include in the proposal to my client. Thanks, Pedro MG null