Adding numbers with a length of 50 digits.

Hi folks,
Could any one please tell me how to add two numbers with 50 digits each.
What should be the datatype for each column, in a table, to hold the above said precision.
However, I know that NUMBER couldn't hold this b'coz its precision is upto 32 digits. Am I right?
What could be the solution?
Your favour would, indeed, be remembered and acknowledged, as well.
Cheers, PCZ.

you could write your own function if you need arbitrary precision
I tried (not very fast) :
SCOTT@LSC01> create or replace function bigadd(n1 varchar2,n2 varchar2)
  2      return varchar2
  3  is
  4      result varchar2(4000);
  5      s number:=0;
  6      i1 number;
  7      i2 number;
  8  begin
  9      if (n1 is null or n2 is null) then
10          return null;
11      end if;
12      if (translate(n1||n2,'x0123456789','x') is not null) then
13          raise_application_error(-20001,'parameter is not an integer');
14      end if;
15      for i in 0..greatest(length(n1),length(n2))-1 loop
16          if (i>=length(n1)) then
17              i1:=0;
18          else
19              i1:=substr(n1,length(n1)-i,1);
20          end if;
21          if (i>=length(n2)) then
22              i2:=0;
23          else
24              i2:=substr(n2,length(n2)-i,1);
25          end if;
26          s:=i1+i2+s;
27          result:=mod(s,10)||result;
28          s:=trunc(s/10);
29      end loop;
30      return nullif(s,0)||result;
31  end;
32  /
Function created.
SCOTT@LSC01> select bigadd('10000000000000000000000000000000000000000000000000','1') from dual;
BIGADD('10000000000000000000000000000000000000000000000000','1')
10000000000000000000000000000000000000000000000001Message was edited by:
Laurent Schneider
discovered one bug already... fixed
Message was edited by:
Laurent Schneider

Similar Messages

  • I was adding items with the intent of command z 'ing them back to their original when it crashed, autosaved, and my original numbers were lost to the temp numbers plugged in... how can i get back to the previous version? Because it had closed, command z

    I was adding items with the intent of command z 'ing them back to their original when it crashed, autosaved, and my original numbers were lost to the temp numbers plugged in... how can i get back to the previous version? Because it had closed, command z

    Sorry, this happened in CLOUD numbers....

  • Datagrid doesn't display numbers with more than 19 digits

    With patch 1 the SQL Developer datagrid should display numbers with more than 10 digits. But the limit seems to be 19 digits now. Number20 and Number21 fields are not displayed on my machine.
    WinXP Prof. 2002 SP2
    SQL Developer 1.0.0.14.67
    Personal Oracle Database 10g Release 10.2.0.2.0 - Production with options Partitioning, Spatial and OLAP

    I saw this as well and am working on fixing it.
    -kris

  • Calculate numbers with digits

    Hi all,
    Can someone tell me how to calculate numbers with digits.
    Let me explain first. The price comes in a xml format like: <price>2,90</price> (comma instead of dot)
    var price:String = XML(dgProducts.selectedItem).child("price").toString();
    total += Number(price); --> this won't work, if I use 2.90 there is no problem.
    So, how can I fix this?
    Hans

    Try using NumberBase's formatDecimal property to first convert it to "." separated and then using parseNumberString method of it to extract Number.
    then do calculation and finally you can convert to comma separated again.
    Formatted Object always returns a string .
    check this ref link.
    http://livedocs.adobe.com/flex/3/langref/mx/formatters/NumberBase.html
    mark post accordingly if it helps.
    Cheers,
    Prad.

  • Bizarre error adding Numbers in Flex 4

    I'm having a bizarre error adding numbers in Flex 4.  In all cases, I'm getting the correct result, but sometimes I'm getting extra precision with a 5 at the end.
    For example,
    If I try to add 5 and 1.56, I get 6.5600000000000005
    a lot of numbers add correctly, it's just certain combinations that have the problem.
    Here is a small app that demonstrates the issue:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
         <s:layout>
              <s:VerticalLayout/>
         </s:layout>
         <fx:Script>
              <![CDATA[
                   protected function button1_clickHandler(event:MouseEvent):void
                        var num1:Number = Number(number1.text);
                        var num2:Number = Number(number2.text);
                        var result:Number = num1 + num2;
    //                    result = 1.56 + 5;
    //                    result = Number(1.56) + Number(5);
                        resultLabel.text = String(result);
              ]]>
         </fx:Script>
         <s:TextInput id="number1"/>
         <s:TextInput id="number2"/>
         <s:Button label="Add Values" click="button1_clickHandler(event)"/>
         <s:Label id="resultLabel"/>
    </s:Application>
    Any assistance would be appreciated!
    Thanks!
    Jon Keener
    [email protected]

    This question comes up all the time. It's a Fact Of life of modern microprocessors and computer languages, which implement floating-point arithmetic using binary fractions (1/2, 1/4, 1/8, etc.), not decimal fractions (1/10, 1/100, 1/1000, etc.), according to the IEEE-754 spec. Many decimal fractions, such as 1.56, cannot be exactly represented as a finite binary fraction. (Or the exact representation in binary might be finite but require more fractional digits that the spec allows.) Although your source program says "1.56", it gets compiled and executed as the IEEE-754 binary-fraction that is closest to 1.56, but it isn't exactly equal to 1.56, and then this slight error gets propogated through calculations, and the conversion back to decimal is again inexact.
    Generally, people just use methods like toPrecision() to round things off a bit and hide this problem. Or they go write or find a (much slower) ActionScript library that does true decimal floating-point arithmetic by storing decimal fractions rather than binary fractions.
    Gordon Smith
    Adobe Flex SDK Team

  • CreateTempFile(String prefix, String sufix) is adding numbers to the prefix

    Hi folks,
    When I call createTempFile("filename", ".dat") it is adding numbers to the prefix. In my temporal directory I get a file called "filename34486.dat" instead a file called "filename.dat"! Do you know why ?
    Thanks in advance.

    bifiado wrote:
    Hi folks,
    When I call createTempFile("filename", ".dat") it is adding numbers to the prefix. In my temporal directory I get a file called "filename34486.dat" instead a file called "filename.dat"! Do you know why ?
    Thanks in advance.If you wanted a file named explicitly "filename.dat", then don't use createTempFile - that's for creating, well, temporary files with a (hopefully) unique name so as to not collide with other processes who might also be trying to create temporary files of the same name pattern.

  • Sorting an array of numbers with loops

    Hi, i'm looking for a way to sort an array or numbers with loops.
    my array looks like this. int[] numbers = {5,2,7,9,1}
    i know how to use the "sort" method and i want to do it without the sort method, but i am not very clear on the logic behind it.
    by the end it should look like this, {1,2,5,7,9}
    i know 2 loops are used, can you please give me a logic to work with.
    i have started the loops but what to do inside???
    int temp;
    for (int i=0; i<numbers.length; i++){
    for (int j=1; j<numbers; j++){
    if (numbers<numbers[j])
    temp = numbers[i];
    Any suggestions i will be thankful for.
    thank you.

    fly wrote:
    no not really a homework question.. i want to improve my logic because it is very poor at the moment.. but i'm sure someone knows how to sort an array with loops only.Yes, we do know how to do it, I once wrote a heapsort in assembly code, as a real work project. But you rarely get a project like that the good ones were all done years ago.
    All the algorithms I suggested you look at use loops. the simplest and slowest is the bubble sort. This one runs by comparing values and swapping their locations, the wikipedia article http://en.wikipedia.org/wiki/Bubble_sort has the algorithm.

  • Footnotes - restart numbering with every chapter (workaround)

    Hello Everyone,
    AFAIK there is no way how to reset the footnote numbering in ID CS4 (it would be ideal to have any possibility to choose the paragraph style, which could invoke that). There are available only three options for reseting, every IMHO quite useless for double sided documents - page, pair of pages and division (I have it localized so names can differ). My chapters starts always on the recto page. If individual 'divisions' would be created for every chapter and reseting set to the beginning of each that division, as the division starts on the verso page !!! (cannot be changed), it resets footnote numbers of the previous chapter if they appear on that verso page. But I agree that for single side documents this option would be sufficient for me.
    Is there any workaround how to restart footnotes numbering with every chapter in double sided documents? Could it be scripted? I really need this...
    Regards,
    Jan

    There you go. Don't forget, where it says "head", fill in the paragraph style name for your start of chapter style.
    The first two lines delete ALL EXISTING SECTIONS, which may come in handy. If you defined some sections yourself (e.g., to change page numbering to roman numerals for some front matter) and wish to preserve them, you must DELETE these lines -- and manually delete all sections made earlier by the script as well.
    //DESCRIPTION:Magic Section Marker
    // A Jongware Script 8-Sep-2010
    // Dangerous Curve: Remove *ALL* existing Sections
    while (app.activeDocument.sections.length > 1)
         app.activeDocument.sections[-1].remove();
    // The script Proper
    // Find the style using the regular Find command
    app.findTextPreferences = null;
    app.findTextPreferences.appliedParagraphStyle = "head"; // <- Change Me.
    list = app.activeDocument.findText();
    // Loop over the found items
    while (list.length)
        // Fetch next item -- a Text -- and get the Frame it's in
        next = list.pop().parentTextFrames[0];
        // It might be nested somewhere 'deep' so go up and up in the chain until ..
        while (!(next instanceof Page || next instanceof Spread || next instanceof Application))
            if (next instanceof Character)
                next = next.parentTextFrames[0];
            else
                next = next.parent;
        // .. we find the actual page. First check if there isn't already a section ..
        if (next instanceof Page &&
            next.appliedSection.pageStart != next)
            // No -- let's add one! All settings are set to sensible defaults, it appears.
            app.activeDocument.sections.add(next);

  • Entering phone numbers with an extention in the contacts app?

    How to enter a phone number in the contacts app phone number section so that it will automaticly dial the extention or pause and then dial the extention?  i.e. (123) 123-4567 ext890
    Can this even be done?
    Thank You.

    When you manually dial on a land line or with other cell phones, does it matter if you omit the "(0)"?  Is it in EVERY number?  What happens if you manually dial the iPhone with the (0)? 
    I don't know the official "standard" dialing format where you are, but what was programed into the iOS doesn't appear to require those characters, and the phone can't recognize numbers with them as telephone numbers.
    In the US, land line carriers usually require a "1" added to the beginning of a long distance call to go through.  Most cell carriers don't need the 1, but the call goes through with or without it.
    You can provide feedback to Apple:
    http://www.apple.com/feedback/iphone.html

  • I have an iphone4 and my husband merge his numbers with mine and i think it was deleted can you tell me how can he get his number back on his phone

    have an iphone4 and my husband merge his numbers with mine and i think it was deleted can you tell me how can he get his number back on his phone

    Do you possibly mean the contacts have been merged?
    If so, where are each of you syncing contacts?  A supported application on the computer? iCloud or another cloud service? An Exchange server?
    WIthout details, it's difficult to offer specific resolutions.

  • Have an issue regarding library books. My ereader is validated with Kobo account and Adobe Digital Editions account, but I get an error: 'this document is protected bij DRM and isn't available with your Adobe ID'.

    Have an issue regarding library books. My ereader is validated with Kobo account and Adobe Digital Editions account, but I get an error: 'this document is protected bij DRM and isn't available with your Adobe ID'.

    same problem for me. I am using abe edition 3 as I don't think 4 can be used with kobo. Book has been downloaded to kobo but it can't be read as it is not authorised.Help please

  • Just updated my iphone. Now I can se I have two? iCloud accounts? One of them appears on my phone, and I have forgotten the password. When I try to add the other account, I get the message that this account is already added, but with the name of the first

    Just updated my iphone. Now I can se I have two! iCloud accounts? One of them appears on my phone, and I have forgotten the password. When I try to add the other account, I get the message that this account is already added, but with the name of the first account where there is no available password. I have tried several times to reset the password, bun I don't get the information I need - I have no access to email. What can I do?

    Hi, thanks for the suggestion. I have tried as you suggested, and when opening the "purchased" apps some have the icloud logo next to them, but I only have "OPEN" against "Find My iPhone". When opening it up, it goes through the same routine; needs to be updated before proceeding, and wouldn't update because I don't have IOS8.
    Anything else I could try, or am I doomed!
    All of your help is much appreciated, thanks

  • Bapi for Creation of PO(Purchase Order) with Factor & Length

    Dear Experts,
    we wnat to create Po automatically by using Bapi.
    I come to know, there are some bapis like BAPI_PO_CREATE1,BAPI_PO_CREATE.
    Normal PO, we are able to create with these bapis.
    But we want to give factor & Length in PO Creation.
    Because we are using the Mill Products(cable Industry).
    so how to create the PO with Factor & Length.
    Plese help me to sort this issue.
    Thanks in advance,
    Regards,
    Rahul
    Edited by: M.Rahul Reddy on Oct 15, 2009 1:07 PM
    Dear Experts,
    I am looking for  your valuable sujjection to sort the issue.

    This is version problem in the Sap system.
    we are communicating with SAP people.

  • Batch Input : Adding component with C002

    Hi all
    I try to add component on a production ordrer with C0O2 but i have problem with the item category 'R' (Variable-size item). In fact, SAP ask me to fill variable-size item data but i can't run this step with batch input.
    For example with the batch input recorder, i obtain :
    SAPLCOKO1 0110 X
         BDC_OKCODE                         /00
         CAUFVD-AUFNR          10001280
    SAPLCOKO1 0115 X
         BDC_OKCODE          =KPU2
    SAPLCOMK 0120 X
         BDC_CURSOR          RESBD-LGORT(23)
         BDC_OKCODE          /00
         FILTER_BOX          NO_FIL
         SORT_BOX          ST_STA
         RESBD-MATNR(23)      SAM6506P00055
         RESBD-MENGE(23)          2
         RESBD-EINHEIT(23)     M
         RESBD-POSTP(23)          R
         RESBD-VORNR(23)          0040
         RCOLS-APLFL(23)          23
         RESBD-WERKS(23)          0200
         RESBD-LGORT(23)          0010
         BDC_SUBSCR          SAPLCOKO1                               0800ORD_HEADER
         BDC_SUBSCR          SAPLCOMK                                0050BUTTONS
         BDC_SUBSCR          SAPLCOMD                                0160SUBSCR_0100
         BDC_CURSOR          RESBD-ROMEI
         RESBD-MATNR          SAM6506P00055
         RESBD-ROMS1          1000
         RESBD-ROMEI          MM
         RESBD-ROKME          M
    Is there other way to fill variable-size item ? Have you got ideas to simulate this step ?
    I don't use FM because i have to fill the field RESBD-VORNR.
    Thanks in advance for your response.
    Patrick.

    In fact the choice that i have made was wrong.
    Adding component with CO02 is possible with ls_params-nobinpt = ''.

  • Reg creation of  value added service with delivery material

    hi
    I want to create the material which is used for the value added service with delivery .do u know the material type for creating the service material other than material type 'dien '. if i use the material type as ' DIEN ' , then i can't create the shipment. in  my scenario , i need to create the shipment. kindly help me in this scenario with the material type & the procedures

    hi
    I want to create the material which is used for the value added service with delivery .do u know the material type for creating the service material other than material type 'dien '. if i use the material type as ' DIEN ' , then i can't create the shipment. in  my scenario , i need to create the shipment. kindly help me in this scenario with the material type & the procedures

Maybe you are looking for

  • How do i get my contacts back on my iphone???

    my contacts have disappeared off my iphone i've turned it on and off again, i've taken out the sim and i've plugged it into itunes but my contacts still have not come back

  • How can I determine what software needs to be installed for images to display in a Safari browser?

    Hi Everyone, I had to rebaseline my MacBook Pro and I am starting from scratch.  When I open certain webpages in Safari, the images I know should be displayed are not coming up as though I am missing some sort of COTS software.  I do have Adobe Flash

  • My Zen Micro won't start!

    Hi, my zen micro turns on when it is connected to the computer. but it only says, "creative, copyright...." how do i get it to start again? i tried it on different computers to see if it was a pc problem but that didn't help either. then, i tried cha

  • Reg. process chains - FAQ

    Hi Shall I get FAQ on Process Chains with solutions. Thanks. regards Sridhar [email protected]

  • Tomcat User

    Ihave intall tomcat and JDK1.4 in Unix HP. When I launch Tomcat and Click at Administration I recieve this errormessage description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jaspe