Large numbers without BigInteger or BigDecimal

I need to write a program that handles basic math operations on large ( 32k+ ) digit integers. I can't make use of the BigInteger or BigDecimal classes. Does anyone have any suggestions on where to start? I'm still relatively new to java programming, so when I tried to read through BigInteger to get an idea of how it's done, my head nearly exploded.
I figured the easiest way to do it would be to convert the arguments to a string of binary, and go from there, but its circular logic, since I'd need to divide a number too big to do division on in order to convert to binary.
Any help is much appreciated.

JamesEarlLMU said:
I need to write a program that handles basic math
operations on large ( 32k+ ) digit integers. I can't
make use of the BigInteger or BigDecimal classes.
Does anyone have any suggestions on where to start?
I'm still relatively new to java programming, so when
I tried to read through BigInteger to get an idea of
how it's done, my head nearly exploded.I guess this is a school assignment? Seems a little weird. It isn't exactly trivial, is it?
Is it for a maths class or just a basic java class? If it's a math class, then I guess you're stuck trying to figure out the way BigInterger does it, and replicating it, but if it's a basic programming class then it seems like a really dumb assignment.
If it's not even for assignments and possibly cause you are using a reduced JDK, then I'd try and find a 3rd party lib that will give you these features; I'm sure there are some around.
-- watercolour...yes?

Similar Messages

  • Working with Large Numbers

    Hi there,
    I am currently doing a school assignment and not looking for answers but just a little guidance.
    I am working with large numbers and the modulo operator.
    I might have some numbers such as :
    int n = 221;
    int e = 5;
    int d = 77;
    int message = 84;
    int en = (int) (Math.pow(message, e) % n);
    int dn = (int) (Math.pow(en, d) % n);Would there be a better way to do this kind of calculation. The dn value should come out the same as message. But I always get something different and I think I might be losing something in the fact that an int can only hold smaller values.

    EJP wrote:
    It might make sense in some contexts to have a positive and negative infinity.
    Yes, perhaps that's a better name. Guess I was harking back to old COBOL days :-).(*)
    But the reason these things exist in FP is because the hardware can actually deliver them. That rationale doesn't apply to BIgInteger.Actually, it does. All I'm talking about is a value that compares higher or lower than any other. That could be done either by a special internal sign value (my slight preference) or by simply adding code to compareTo(), equals() and hashCode() methods that takes the two constants into account (as they already do with ZERO and ONE).
    Don't worry, I'm not holding my breath; but I have come across a few situations in which values like that would have been useful.
    Winston
    Edited by: YoungWinston on Mar 22, 2011 9:07 AM
    (*) Actually, '±infinity' tends to suggest a valid arithmetic value, and I wasn't thinking of changing existing BigInteger/BigDecimal maths (except perhaps to throw an exception if either value is involved).

  • Using very long/large numbers

    Hi, I want to know how to "store" and use very large numbers.
    For example, say I had:
    double n = 1.23456789101112131415;
    or:
    double n = 123456789101112131415
    I know that they are too big for using double, so how would I be able to store it; and even more importantly round it ,preferably using "Math.round," to 15 decimal places?
    i.e. tell it to do this:
    n = 1.23456789101112131415;
    number = Math.round((1000000000000 * n) / 1000000000000 .0);
    System.out.println(number);

    As much as your "advice" helps, the java docs provide
    only methods for the BigDecimal/Integer
    objects. They don't show complete syntax, and don't
    contain examples. Fortunately, I have avoided the
    "35-years-old-and-still-living-in-my-mother's-basement
    -and-aren't-even-professional-programmers" path and
    have enough of a life that I try not to spend all day
    reading about Java syntax.I don't believe this. Morgalr gave you genuine help. You spent more time criticizing him than conducting a very simple google search sucha as "BigInteger"+"example". I would suggest a little attitude adjustment if you still want people to help you next time.

  • Large numbers calculation problem (determinant calculation)

    Hello experts,
    I have really interesting problem. I am calculatig determinant in ABAP with a large numbers (in CRM 5.0 system).
    My formula for determinant is :
    FORM calculate_determinant USING    det      TYPE zsppo_determinant
                               CHANGING value    TYPE f .
      value =
        (  1 * det-a11 * det-a22 * det-a33 * det-a44 ) + ( -1 * det-a11 * det-a22 * det-a34 * det-a43 ) +
        ( -1 * det-a11 * det-a23 * det-a32 * det-a44 ) + (  1 * det-a11 * det-a23 * det-a34 * det-a42 ) +
        ( -1 * det-a11 * det-a24 * det-a33 * det-a42 ) + (  1 * det-a11 * det-a24 * det-a32 * det-a43 ) +
        ( -1 * det-a12 * det-a21 * det-a33 * det-a44 ) + (  1 * det-a12 * det-a21 * det-a34 * det-a43 ) +
        (  1 * det-a12 * det-a23 * det-a31 * det-a44 ) + ( -1 * det-a12 * det-a23 * det-a34 * det-a41 ) +
        ( -1 * det-a12 * det-a24 * det-a31 * det-a43 ) + (  1 * det-a12 * det-a24 * det-a33 * det-a41 ) +
        (  1 * det-a13 * det-a21 * det-a32 * det-a44 ) + ( -1 * det-a13 * det-a21 * det-a34 * det-a42 ) +
        ( -1 * det-a13 * det-a22 * det-a31 * det-a44 ) + (  1 * det-a13 * det-a22 * det-a34 * det-a41 ) +
        (  1 * det-a13 * det-a24 * det-a31 * det-a42 ) + ( -1 * det-a13 * det-a24 * det-a32 * det-a41 ) +
        ( -1 * det-a14 * det-a21 * det-a32 * det-a43 ) + (  1 * det-a14 * det-a21 * det-a33 * det-a42 ) +
        (  1 * det-a14 * det-a22 * det-a31 * det-a43 ) + ( -1 * det-a14 * det-a22 * det-a33 * det-a41 ) +
        ( -1 * det-a14 * det-a23 * det-a31 * det-a42 ) + (  1 * det-a14 * det-a23 * det-a32 * det-a41 )
    ENDFORM.
    Det values are also f type. Problem is, that for several numbers I got the right values and for another det values I got wrong values... I also try to retype variable value on type p, but without success. Maybe I used wrong types or there is some ABAP rounding of numbers which cause wrong result.
    Any good ideas of solutions. <text removed>. Thanks for your time.
    Edited by: Matt on Sep 14, 2010 9:17 AM

    Hi Lubos,
    phew! that sounds far from SAP scope, but from Maths' numerical methods. Let's see if I can remember something about my lessons at University...
    - One issue can arise when adding and subtracting terms which are very similar, because the error tends to arise quite fast. Try to add the positive terms on one hand, and the negative terms on the other hand, then subtract one from the other.
    - Please take into account that the determinant value can be significantly close to zero when the condition number of the matrix is low, that is, when the range is 4 but the whole determinant is close to 0. Instead, try a [Singular Value Decomposition|http://en.wikipedia.org/wiki/SVD_(mathematics)] or an [LU decomposition|http://en.wikipedia.org/wiki/LU_decomposition]
    I hope this helps. Kind regards,
    Alvaro

  • How can I move columns in Numbers without distorting the formula in other cells?  In Excel I can cut and paste entire columns and the formula in other cells adjusts accordingly.  When I do it in Numbers, the formula messes up.  How can I do this?

    How can I move columns in Numbers without distorting the formula in other cells?  In Excel I can cut and paste entire columns and the formula in other cells adjusts accordingly.  When I do it in Numbers, the formula messes up.  How can I do this?
    For example: I have formulas in columns D and F that relate to columns C to CU
    If I want to move one column from one position to another (say S to T), the formula loses the colums that was moved, i.e. it doesn't recognize it has moved, rather sees it as deleted...  How can I do this without distorting the formula?

    Thanks for the feedback.
    If I often urge askers to look at the available resources, it's because  a large range of questions asked in the forums are already answered in these documents.
    As they are PDFs, they are easy to search in.
    CAUTION
    Download them while they are available.
    Given what is delivered with iBooks Author, I'm afraid that we will not get such easy to use documents.
    Searching infos in the  iBooks Author documentation available on line is awfully cumbersome and a lot of embedded links are wrongly flagged this way. In the Help files they aren't links but underlined strings.
    It seems that the tool used to generate the web pages was wrongly configured.
    Yvan KOENIG (VALLAURIS, France) dimanche 22 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k
    My iDisk is : http://public.me.com/koenigyvan

  • Store Very Large Numbers

    Hello,
    I am trying to find some info about how to store very large numbers with like 2000 digits or even more and do calculations on them.
    Does anyone have any info or links about this ??
    Thanks.

    BigDecimal?Speaking. What can I do for you?
    :)

  • Very Large Numbers Question

    I am a student with a question about how Java handles very large numbers. Regarding this from our teacher: "...the program produces values that
    are larger than Java can represent and the obvious way to test their size does not
    work. That means that a test that uses >= rather than < won?t work properly, and you
    will have to devise something else..." I am wondering about the semantics of that statement.
    Does Java "know" the number in order to use it in other types of mathematical expressions, or does Java "see" the value only as gibberish?
    I am waiting on a response from the teacher on whether we are allowed to use BigInteger and the like, BTW. As the given program stands, double is used. Thanks for any help understanding this issue!

    You're gonna love this one...
    package forums;
    class IntegerOverflowTesterator
      public static void main(String[] args) {
        int i = Integer.MAX_VALUE -1;
        while (i>0) {
          System.out.println("DEBUG: i="+i);
          i++;
    }You also need to handle the negative case... and that get's nasty real fast... A positive plus/times a positive may overflow, but so might a negative plus a negative.
    This is decent summary of the underlying problem http://mindprod.com/jgloss/gotchas.html#OVERFLOW.
    The POSIX specification also worth reading regarding floating point arithmetic standards... Start here http://en.wikipedia.org/wiki/POSIX I guess... and I suppose the JLS might be worth a look to http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html

  • Is there a way to delete large numbers of emails all at once?

    I receive large numbers of emails because of the discussion lists I'm on, but sometimes I need to delete
    most of them for lack of time.  There can be over 500 in a couple of days.  I'd like to be able to do one simple
    thing that allows me to delete all of this old mail at a time.  Is there such a way?
    Scotty

    If your email account supports it, you can tap the Trash Icon, Tap Edit and the Delete option may let you delete all. I have a Comcast mail account that allows me to do this. I also have two AOL accounts that do not support it.
    Try your mail account and see if the Delete All option comes up at the bottom of the window. Account
    Name>Trash>Edit and look in the lower left corner of the window.

  • Business Partner records with large numbers of addresses -- Move-in issue

    Friends,
    Our recent CCS implementation (ECC6.0ehp3 & CRM2007) included the creation of some Business Partner records with large numbers of addresses.  Most of these are associated with housing authorities, large developers and large apartment complex owners.  Some of the Business Partners have over 1000 address records and one particular BP has over 6000 addresses that were migrated from our Legacy System.  We are experiencing very long run times to try to execute move in's and move out's due to the system reading the volume of addresses attached to the Business Partner.  In many cases, the system simply times out before it can execute the transaction.  SAP's suggestion is that we run a BAPI to cleanse the addresses and also to implement a BADI to prevent the creation of excess addresses. 
    Two questions surrounding the implementation of this code.  Will the BAPI to cleanse the addresses, wipe out all address records except for the standard address?  That presents an issue to ensure that the standard address on the BP record is the correct address that we will have identified as the proper mailing address.  Second question is around the BADI to prevent the creation of excess addresses.  It looks like this BADI is going to prevent the move in address from updating the standard address on the BP record which in the vast majority of cases is exactly what we would want. 
    Does anyone have any experience with this situation of excess BP addresses and how did you handle the manipulation and cleansing of the data and how do you maintain it going forward?
    Our solution is ECC6.0Ehp3 with CRM2007...latest patch level
    Specifically, SAP suggested we apply/review these notes:
    Note 1249787 - Performance problem during move-in with huge addresses
    **applied this ....did not help
    Note 861528 - Performance in move-in for partner w/ large no of addresses
    **older ISU4.7 note
    Directly from our SAP message:
    use the function module
    BAPI_BUPA_ADDRESS_REMOVE or run BAPI_ISUPARTNER_CHANGE to delete
    unnecessary business partner addresses.
    Use BAdI ISU_MOVEIN_CUSTOMIZE to avoid the creation of unnecessary
    business partner addresses (cf. note 706686) in the future for that
    business partner.
    Note 706686 - Move-in: Avoid unnecessary business partner addresses
    Does anyone have any suggestions and have you used above notes/FMs to resolve something like this?
    Thanks,
    Nick

    Nick:
    One thing to understand is that the badi and bapi are just the tools or mechanisms that will enable you to fix this situation.  You or your development team will need to define the rules under which these tools are used.  Lets take them one at a time.
    BAPI - the bapi for business partner address maintenance.  It would seem that you need to create a program which first read the partners and the addresses assigned to them and then compares these addresses to each other to find duplicate addresses.  These duplicates then can be removed provided they are not used elsewhere in the system (i.e. contract account).
    BADI - the badi for business partner address maintenance.  Here you would need to identify the particular scenarios where addresses should not be copied.  I would expect that most move-ins would meet the criteria of adding the address and changing the standard address.  But for some, i.e. landlords or housing complexes, you might not add an address because it already exists for the business partner, and you might not change the standard address because those accounts do not fall under that scenario.  This will take some thinking and design to ensure that the address add/change functions are executed under the right circumstances.
    regards,
    bill.

  • Please add the ability to add multiple folders to the assets folder in order to better organize large numbers of files.

    Please add the ability to add multiple folders to the assets folder in order to better organize large numbers of files.

    Hello KDLadage
    Thank you for your recommendation. I understand the challenges of managing large numbers of files on the My Files page. I also understand the need to preserve project files.
    Perhaps a compromise would be to create an Archive tab under My Files. Previous versions and retired project files could then be automatically moved into this holding area when a new version is published, thus preserving the files in a separate area that is still accessible to the author.
    I will submit this suggestion to our product management team to consider as a future enhancement.

  • How do I delete large numbers of photos on ios7

    How do I delete large numbers of photos from ios7. I haven't got my MacBook with me

    In the Photos.app you can select all photos in a "Moment" at once, by pressing "Select" to the right of the "Moment" name. Then press the Trash icon.
    For example:

  • Random numbers without duplicates

    Hello,
    I'm having trouble locating an explained example for selecting a set of random numbers without duplicates. Specifically, I'm working on this example from Ivor Horton's Beginning Java, chapter 3.
    3. A lottery program requires that you select six different numbers from the integers 1-49. Write a program to do this for you and generate five sets of entries.
    This is not homework, I'm just trying to teach myself Java to eventually work my way up to servlets and JSPs.
    This is what I have so far. I tried to use array sorting but it didn't work (the first three numbers in my entries was always 0), so I commented out that part. I've included sample output after the code. I don't necessarily need the exact code although that would be nice; I just need at least an explanation of how to go about making sure that if a number has been picked for an entry, not to pick it again.
    Thanks for any help,
    javahombre
    package model;
    import java.util.Random;
    import java.lang.Math.*;
    import java.util.Arrays;
    public class Lottery {
    public static void main(String[] args) {
    // Lottery example.
    // We need the following data:
    // - An integer to store the lottery number range (in this case 59).
    // - A mechanism to choose a number randomly from the range.
    // - An array to store the entries (6 different numbers per entry).
    // - A loop to generate 5 sets of entries.
    int numberRange = 59;
    int currentPick = 0;
    int[] entry = new int[6]; // For storing entries.
    //int slot = -1; // For searching entry array.
    Random rn = new Random();
    for (int n = 0; n < 5; n++)
    // Generate entry.
    for (int i = 0; i < 6; i++)
    currentPick = 1 + Math.abs(rn.nextInt()) % numberRange;
    //Arrays.sort(entry);
    //slot = Arrays.binarySearch(entry, currentPick);
    //System.out.println("i: " + i + "\t| slot: " + slot + "\t| pick: " + currentPick + "\t| compare: " + (slot < 0));
    // Add the current pick if it is not already in the entry.
    //if (slot < 0)
    entry[i] = currentPick;
    System.out.println("pick entered: " + currentPick);
    // Output entry.
    System.out.print("Entry " + (n + 1) + ": ");
    for (int j = 0; j < 6; j++)
    System.out.print(entry[j] + "\t");
    System.out.println("");
    // Set the array contents back to 0 for next entry.
    Arrays.fill(entry,0);
    Sample output (notice duplicates, as in Entry 3):
    pick entered: 11
    pick entered: 29
    pick entered: 33
    pick entered: 8
    pick entered: 14
    pick entered: 54
    Entry 1: 11     29     33     8     14     54     
    pick entered: 51
    pick entered: 46
    pick entered: 25
    pick entered: 30
    pick entered: 44
    pick entered: 22
    Entry 2: 51     46     25     30     44     22     
    pick entered: 49
    pick entered: 39
    pick entered: 9
    pick entered: 6
    pick entered: 46
    pick entered: 46
    Entry 3: 49     39     9     6     46     46     
    pick entered: 23
    pick entered: 26
    pick entered: 2
    pick entered: 21
    pick entered: 51
    pick entered: 32
    Entry 4: 23     26     2     21     51     32     
    pick entered: 27
    pick entered: 48
    pick entered: 19
    pick entered: 10
    pick entered: 8
    pick entered: 18
    Entry 5: 27     48     19     10     8     18     

    NOTE: the array reference to [ i ] seems to be misinterpreted as italics by the posting form. I've reposted the message here, hopefully it will show the code properly.
    Thanks again,
    javahombre
    Hello,
    I'm having trouble locating an explained example for
    selecting a set of random numbers without duplicates.
    Specifically, I'm working on this example from Ivor
    Horton's Beginning Java, chapter 3.
    3. A lottery program requires that you select six
    different numbers from the integers 1-49. Write a
    program to do this for you and generate five sets of
    entries.
    This is not homework, I'm just trying to teach myself
    Java to eventually work my way up to servlets and
    JSPs.
    This is what I have so far. I tried to use array
    sorting but it didn't work (the first three numbers in
    my entries was always 0), so I commented out that
    part. I've included sample output after the code. I
    don't necessarily need the exact code although that
    would be nice; I just need at least an explanation of
    how to go about making sure that if a number has been
    picked for an entry, not to pick it again.
    Thanks for any help,
    javahombre
    package model;
    import java.util.Random;
    import java.lang.Math.*;
    import java.util.Arrays;
    public class Lottery {
    public static void main(String[] args) {
    // Lottery example.
    // We need the following data:
    // - An integer to store the lottery number range (in
    this case 59).
    // - A mechanism to choose a number randomly from the
    range.
    // - An array to store the entries (6 different
    numbers per entry).
    // - A loop to generate 5 sets of entries.
    int numberRange = 59;
    int currentPick = 0;
    int[] entry = new int[6]; // For storing entries.
    //int slot = -1; // For searching entry
    array.
    Random rn = new Random();
    for (int n = 0; n < 5; n++)
    // Generate entry.
    for (int i = 0; i < 6; i++)
    currentPick = 1 + Math.abs(rn.nextInt()) %
    numberRange;
    //Arrays.sort(entry);
    //slot = Arrays.binarySearch(entry, currentPick);
    //System.out.println("i: " + i + "\t| slot: " + slot +
    "\t| pick: " + currentPick + "\t| compare: " + (slot <
    0));
    // Add the current pick if it is not already in the
    entry.
    //if (slot < 0)
    entry[ i ] = currentPick;
    System.out.println("pick entered: " + currentPick);
    // Output entry.
    System.out.print("Entry " + (n + 1) + ": ");
    for (int j = 0; j < 6; j++)
    System.out.print(entry[j] + "\t");
    System.out.println("");
    // Set the array contents back to 0 for next entry.
    Arrays.fill(entry,0);
    Sample output (notice duplicates, as in Entry 3):
    pick entered: 11
    pick entered: 29
    pick entered: 33
    pick entered: 8
    pick entered: 14
    pick entered: 54
    Entry 1: 11     29     33     8     14     54
    pick entered: 51
    pick entered: 46
    pick entered: 25
    pick entered: 30
    pick entered: 44
    pick entered: 22
    Entry 2: 51     46     25     30     44     22
    pick entered: 49
    pick entered: 39
    pick entered: 9
    pick entered: 6
    pick entered: 46
    pick entered: 46
    Entry 3: 49     39     9     6     46     46
    pick entered: 23
    pick entered: 26
    pick entered: 2
    pick entered: 21
    pick entered: 51
    pick entered: 32
    Entry 4: 23     26     2     21     51     32
    pick entered: 27
    pick entered: 48
    pick entered: 19
    pick entered: 10
    pick entered: 8
    pick entered: 18
    Entry 5: 27     48     19     10     8     18

  • How to do basic corrections to large numbers of images

    I have to do basic corrections to large numbers of images that will be coming in separate
    batches and which need to be kept in their separate batches. I cant mix them together.
    Do I create a new catalog for each batch? What should I do, if anything with collections and
    what is the fastest way to make basic corrections to hundreds of images? Some of the images
    are similar but many are not.
    Oh, I was also wondering if Lightroom can import through FTP or if I need to download the
    images and then import them.
    Thank you!

    Hi Jim,
    you need to understand what is happening or you can become very frustrated
    That's for sure. I have found countless tutorials on how to do specific things and procedures in Lightroom but I wasnt able to find a macro or aerial view of what it does and how it works. Things like what is a catalog and if it mimics the file structure on the disk, if and when to have more than one catalog, where the catalog and collections files are stored and how to back them up, how to re-synchronize the catalog if you move things around with finder/explorer, etc.
    I'm slowly piecing those things together by thinking and working backwards from all the more lower level tutorials. I keep thinking I want a "Missing manual" for moving from Finder and Bridge to Lightroom.
    For instance, are you aware that in its default state Lightroom does not write any changes to the files?
    And are you aware of how to change that? Are you aware that if you make that change there will be XMP files for every raw file that you worked on?
    I knew that Lightroom doesn't  normally save changes to the image files, it basically stores a history of the adjustments in a separate file and applies them to the original, kind of like adjustment layers in photoshop dont change the background layer. I think I read that if working with a dng file the history of adjustments is saved within the dng image file but I'm not sure about that. The xmp files are the same or similar to the ones that are created in ACR, I believe.
    you really need to have a good working knowledge of the program in order to use it efficiently.
    I dont expect to be very efficient at first. I'm thinking of this experience as on the job training and thanks to all of the internet resources available and people like you I think I'll be able to adapt to Lightroom fairly quickly.
    I looked at the videos that you linked me to. Some of them I had found previously but it was good to view them again. I do that a lot, after I do some work I look back at books or videos I had previously studied and I normally get more out of it the second time.
    Is there a way that you know of to improve a few hundred images more efficiently that selecting the most similar ones for a group adjustment and doing the rest individually? I have images that are under and over exposed, tilted and with various color casts :-(
    I'm thinking about going to PDN Photo Expo over the next few days and taking retouching courses with Carrie Beene. Would you happen to be going?
    Thanks,
    Bob

  • Best practices for speeding up Mail with large numbers of mail?

    I have over 100,000 mails going back about 7 years in multiple accounts in dozens of folders using up nearly 3GB of disk space.
    Things are starting to drag - particularly when it comes to opening folders.
    I suspect the main problem is having large numbers of mails in those folders that are the slowest - like maybe a few thousand at a time or more.
    What are some best practices for dealing with very large amounts of mails?
    Are smart mailboxes faster to deal with? I would think they would be slower because the original emails would tend to not get filed as often, leading to even larger mailboxes. And the search time takes a lot, doesn't it?
    Are there utilities for auto-filing messages in large mailboxes to, say, divide them up by month to make the mailboxes smaller? Would that speed things up?
    Or what about moving older messages out of mail to a database where they are still searchable but not weighing down on Mail itself?
    Suggestions are welcome!
    Thanks!
    doug

    Smart mailboxes obviously cannot be any faster than real mailboxes, and storing large amounts of mail in a single mailbox is calling for trouble. Rather than organizing mail in mailboxes by month, however, what I like to do is organize it by year, with subfolders by topic for each year. You may also want to take a look at the following article:
    http://www.hawkwings.net/2006/08/21/can-mailapp-cope-with-heavy-loads/
    That said, it could be that you need to re-create the index, which you can do as follows:
    1. Quit Mail if it’s running.
    2. In the Finder, go to ~/Library/Mail/. Make a backup copy of this folder, just in case something goes wrong, e.g. by dragging it to the Desktop while holding the Option (Alt) key down. This is where all your mail is stored.
    3. Locate Envelope Index and move it to the Trash. If you see an Envelope Index-journal file there, delete it as well.
    4. Move any “IMAP-”, “Mac-”, or “Exchange-” account folders to the Trash. Note that you can do this with IMAP-type accounts because they store mail on the server and Mail can easily re-create them. DON’T trash any “POP-” account folders, as that would cause all mail stored there to be lost.
    5. Open Mail. It will tell you that your mail needs to be “imported”. Click Continue and Mail will proceed to re-create Envelope Index -- Mail says it’s “importing”, but it just re-creates the index if the mailboxes are already in Mail 2.x format.
    6. As a side effect of having removed the IMAP account folders, those accounts may be in an “offline” state now. Do Mailbox > Go Online to bring them back online.
    Note: For those not familiarized with the ~/ notation, it refers to the user’s home folder, i.e. ~/Library is the Library folder within the user’s home folder.

  • Large numbers! Need help

    I have problem. I need to do a multiplication of to large numbers(about 150 digits). But I don't know which way I could do it. Could anyone help me?
    Thanx for help.

    I can conribute a quick and dirty string multiplication function just to play with:
    - does not treat signs
    - does not treat decimals
    Just to show it can be done
    All credits to the yesterday's bad weather - made me think about "old days" (;-o)
    CREATE OR REPLACE
    function multiply_them(x in varchar2,y in varchar2) return varchar2 is
      retval varchar2(2001) := '0';
      i pls_integer;
      j pls_integer;
      half varchar2(1000);
      dble varchar2(2001);
      z varchar2(1000);
      w varchar2(1000);
    function number_is_it(x in varchar2) return boolean is
    begin
      if (x = '') or (x is null) then
        return FALSE;
      end if;
      return (replace(translate(x,'0123456789',rpad(chr(9),10,chr(9))),chr(9),'') is null);
    end;
    function odd_is_it(x in varchar2) return boolean is
    begin
      return (mod(to_number(substr(x,-1,1)),2) = 1);
    end;
    function add_them(x in varchar2,y in varchar2) return varchar2 is
      retval varchar2(1001) := '';
      z varchar2(1000);
      w varchar2(1000);
      i pls_integer;
      j pls_integer;
      carry pls_integer := 0;
    begin
      if x is null or y is null then
        return null;
      end if;
      if x = '0' then
        return y;
      end if;
      if y = '0' then
        return x;
      end if;
      i := length(x);  -- TO CALL FUNCTION ONLY ONCE
      j := length(y);
    -- FOR NOW WE JUST LEFT PAD THE SHORTER STRING WITH ZEROS TO MAKE THEIR LENGTHS EQUAL
    -- IN CASE OF BIG LENGTH DIFFERENCE TO DO:
    -- WHEN THE SHORTER STRING IS EXHAUSTED CONCATENATE THE HEAD OF THE LONGER STRING TO PARTIAL SUM OBTAINED
      if i > j then
        z := x;
        w := lpad(y,i,'0');  
      elsif i < j then
        z := lpad(x,j,'0');
        w := y;
        i := j;
      else
        z := x;
        w := y;
      end if;
      while i >= 0 loop
        if i > 0 then
          j := to_number(substr(z,i,1)) + to_number(substr(w,i,1)) + carry;
          carry := trunc(j/10,0);
          retval := to_char(j - 10 * carry) || retval;
        end if;
        i := i - 1;
      end loop;
      return to_char(carry) || retval;
    end;
    function double_it(x in varchar2) return varchar2 is
      retval varchar2(1001);
    begin
      retval := add_them(x,x);
      return ltrim(retval,'0');
    end;
    function halve_it(x in varchar2) return varchar2 is
      retval varchar2(1000) := '';
      i pls_integer := 1;
      j pls_integer := length(x);
      k number;
      carry pls_integer := 0;
    begin
      if x is null then
        return null;
      end if;
      if x = '1' then
        return '0';
      end if;
      if substr(x,1,1) = '1' then
        carry := 10;
        i := 2;
      end if;
      while j >= i loop  
        k := (to_number(substr(x,i,1)) + carry) / 2;
        if k = trunc(k,0) then
          carry := 0;
        else
          carry := 10;
        end if;
        retval := retval || to_char(trunc(k,0));
        i := i + 1;
      end loop;
      return retval;
    end;
    begin
    -- WE WILL DO "PEASANT MULTIPLICATION" (MORE EFFICIENT THAN CONVENTIONAL MULTIPLICATION):
    -- WHEN THE FACTOR TO BE HALVED IS ODD WE ADD THE CORRESPONDING DOUBLE TO THE RESULT (INITIALLY ZERO)
    -- AT EACH STEP WE HALVE ONE FACTOR AND DOUBLE THE OTHER
    -- STEPS ARE REPEATED UNTIL THE HALVED FACTOR IS GREATER THAN ZERO
      if x is null or y is null then
        return null;
      end if;
      if number_is_it(x) and number_is_it(y) then  -- THEY ARE BOTH NUMBERS
    -- CHECK FOR TRIVIAL RESULTS: MULTIPLICATION BY ZERO AND MULTIPLICATION BY ONE
        z := ltrim(x,'0');  -- TRIM LEADING ZEROS (JUST IN CASE)
        if z = '' then
          return '0';  -- SINCE ALL ZEROS WERE TRIMMED OFF X IS ZERO
        end if;
        w := ltrim(y,'0');  -- TRIM LEADING ZEROS (JUST IN CASE)
        if w = '' then
          return '0';  -- SINCE ALL ZEROS WERE TRIMMED OFF Y IS ZERO
        end if;
        if z = '1' then
          return w;
        end if;
        if w = '1' then
          return z;
        end if;
        i := length(z);  -- TO CALL FUNCTION ONLY ONCE
        j := length(w);
    -- WILL DO IT IN LESS STEPS IF THE LESSER FACTOR GETS HALVED AND THE GREATER FACTOR GETS DOUBLED
        if i > j then  -- X > Y => Y WILL BE HALVED AND X WILL BE DOUBLED
          half := w;
          dble := z; 
        elsif i < j then  -- X < Y => X WILL BE HALVED AND Y WILL BE DOUBLED
          half := z;
          dble := w;
        else  -- X AND Y ARE EQUAL LENGTH STRINGS SO WE COMPARE THE FIRST CHARACTERS
          if substr(z,1,1) <= substr(w,1,1) then  -- X < Y => X WILL BE HALVED AND Y WILL BE DOUBLED
            half := z;
            dble := w;
          else  -- X > Y => Y WILL BE HALVED AND X WILL BE DOUBLED
            half := w;
            dble := z;
          end if; 
        end if;
    -- PEASANT MULTIPLICATION
        while half > '0' loop
          if odd_is_it(half) then
            retval := add_them(retval,dble);
          end if;
          half := halve_it(half);
          dble := double_it(dble);
        end loop;
        retval := ltrim(retval,'0');
      else
        retval := 'at least one of the two operands is not a number';
      end if;
      return retval;
    end;Regards
    Etbin

Maybe you are looking for

  • Creation of new IS and DS for single IO?

    Hi guys, I got a requirement wherein I should create a new IS and DS for a single IO, and the source for this is a flat file. And I should create this for an already existing Info cube which has got some IO's and the source for that is from some othe

  • Sending a picture message

    *Can you send a picture message from the iPhone?*

  • Creative Media Source Player clipped tracks problem

    <span class="j2">I <span class="j2">am <span class="j2">using <span class="j2">the <span class="j2">Creative <span class="j2">Media <span class="j2">source <span class="j2">player (<span class="j2">Version <span class="j4">5.0.38 <span class="j2">wit

  • How to turn off [Scaled] images in photoshop

    I found this solution once before, but for the life of me can't now.  In photoshop, while editing, my images are of the correct resolution.  But when I save them they are squeezed on the left and right.  I know this is because the "scaled" feature is

  • Itunes7 does not let me start up because detected problem with audio config

    hi, i have had itunes for a while now but i just upgraded it to version 7. i restarted my computer afterwards but when i tried to start up itunes for the first time it said there was a problem with the audio configuration. this is the message, itunes