BigDecimal scale, rounding and ArithmeticException

Can anyone refer me to a good article or site where the appropriate use of the BigDecimal Class is shown. I keep having a lot of ArithmeticException especially when doing division or setting scale. It is becoming frustrating that I refer to doing calculation with double and changing them back to BigDecimals.
Thanks in advance
Michael

okmich wrote:
thanks for the reply,
but my most confusing part of the use of MathContext object.
the rounding up constants are also easy to use, but the java doc does not really explain the vital importants of the MathContext class.
I would appreciate if you can throw light on the class MathContext.
Regards,
MichaelSome light on MathContext: The int you specify when you make it is the number of decimal places it will use at a maximum. By default I'm pretty sure it rounds half up. You can apply it to an operation like BigDecimal.divide(BigDecimal, MathContext); It should work for stuff like subtract and multiply in the same way.

Similar Messages

  • Why doesn't Photoshop CS5 automatically scale strokes and effects?

    I am looking everywhere for why Photoshop CS5 doesn't automatically scale strokes and effects. I could've sworn there was a preference in CS4 but there's nothing resembling this in CS5. Driving me crazy!
    Whenever I do a Free Transform, the effects are completely out of whack and force me to waste time resetting them individually, layer by layer. I used to be able to grab any object or group of objects, do a transformation and Photoshop automatically recalculated. If anyone has a tip on how to avoid the annoyance of having to go layer by layer and forcibly adjusting that would be great.

    Layer style effect setting are in absolute pixel size values so if you change the scale of a layer the style size remains the same. You can edit the layers style effects after tou do a transform on the layer and change the absolute setting. If the layer has been rastersized or flattened you can not. I have request that Adobe add support for relative settings like inches, cm, mm etc which is relative to the documents dpi resolution. This would be very helpful for recording actions. 
    However photoshop can scale existing layer style for you when you use Image Size there is a check box.  If you need to scale a single layer and have its style scaled you need to do it in a round about way. Convert the layer to a smart object. Then instead of using transform double click on the layser smart object icon in the layers palette.  Photoshop will open that layer embedded smart object in Photoshop for you to work on it.. Use Image Size to resize the layer up or down in size and check resample constrain and the scale style check box.  Then use menu File>Save.  Photoshop will then update the embedded smart object in the smart object layer and you can close the document Photoshop opened for you to work on the smart object.

  • My ipod 60gb classic is showing as fully charged until I connect it to my pc when it comes up with the error message, 'please wait very low battery' and the little wheel goes round and nothing happens, can anyone explain why this is and what i can do?

    My ipod 60gb classic is showing as fully charged until I connect it to my pc when it comes up with the error message, 'please wait very low battery' and the little wheel goes round and nothing happens, can anyone explain why this is and what i can do?

    I have worked my way through the assistant and nothing works. I have tried connecting in disc mode but although the screen on the ipod is showing that the device is charged and that it is in disc mode as soon as I connect it to the computer it comes up with the error message 'please wait very low battery' and stays like that until I disconnect when it appears to be OK again. I have tried on both pc and mac.
    BTW the ipod is an ipod video not classic if that makes any difference.
    Thanks

  • So my Ipod touch hasn't been connecting to computer, or charging for a week or two until i turn it off completely and now i try to reset all content and setting, the circle goes round and round for like hrs(24) and it still does not complete the reset

    so my Ipod touch hasn't been connecting to computer, nor charging for a week or two until i turn it off completely and now i try to reset all content and setting,(thinking it may connect to the computer and itunes and also charge) but the circle goes round and round for like hrs(24) and it still does not complete the reset.
    pls pls pls pls help .
    i have tried alot of solutions, but non of them have worked.

    Have you tried walking it into the nearest Apple Store and asking for assistance there...?
    I'm guessing you don't have Apple Care on it.

  • Sql query usig round and decode together

    can i get one sql quer for returning whole number using round and decode function
    eg:
    the value 47
    if value=47
    then
    the query should return 50
    if the value =44
    then
    the quer should return 40
    pls give me sql query for above example using round and decode function
    Edited by: user11368167 on Jul 9, 2009 3:35 AM

    A wild guess. If you want the ROUND Function to work only when your column value is 44 or 47 then you could use something like:
    SQL> WITH test_tab AS
      2       (SELECT 44 col_1
      3          FROM DUAL
      4        UNION ALL
      5        SELECT 15 col_1
      6          FROM DUAL
      7        UNION ALL
      8        SELECT 47 col_1
      9          FROM DUAL
    10        UNION ALL
    11        SELECT 45 col_1
    12          FROM DUAL)
    13          -- end of test data
    14  SELECT col_1,
    15         DECODE (col_1,
    16                 44, ROUND (col_1, -1),
    17                 47, ROUND (col_1, -1),
    18                 col_1
    19                ) rounded_value
    20    FROM test_tab
    21  /
         COL_1 ROUNDED_VALUE
            44            40
            15            15
            47            50
            45            45
    4 rows selected.
    SQL> CASE Statement can be used as well instead of DECODE.
    Good Luck,
    Regards,
    Jo

  • I'm trying to update my apps using the creative cloud desktop app. I can't see any apps in the app tab, the wheel just spins round and round and nothing happens. Has anyone got any ideas? I've tried uninstalling the desktop app and reinstalling but it sti

    Hi
    I'm trying to update my apps using the creative cloud desktop app. I can't see any apps in the app tab, the wheel just spins round and round and nothing happens. Has anyone got any ideas? I've tried uninstalling the desktop app and reinstalling but it still has the same problem.
    Cheers
    Rachel

    Hi Rachel,
    You can follow the article: App doesn't open | Progress wheel spins continually to get your issue fixed.
    Let us know if the issue still persists or not.
    Regards,
    Ratandeep Arora

  • HT1414 Itunes just goes round and round when i tap on recent purchases and cant get at recent songs purchased on my non apple laptop. I don't connect my iPad to a computer. How do I tackle this?

    When I open iTunes on my iPad and tap on purchased for music, the timer just goes round and round and won't find my purchased tunes and I can't therefore download any new items I have bought. Any suggestions on how to reload the software?

    Make sure you have a good wifi connection.
    Make Sure iOS is updated to the latest version
    Reboot the device by pressing and holding down the home and sleep/wake buttons (power) at the same time until the apple logo appears on the screen, then let go.
    If that doesn't work then reset the device by going to settings/general/reset/reset all settings

  • XY Graph-Setting Y-Scale visible to False still Shows Corresponding Y scale Max and Min

    Hi Guys,
    I use XY graph to display the data with 3 Y-scales.
    When I set any Y scale Visiblity property to False,its still display the Y scale Max and Min range Lines in plot area of the  Graph and making cross line or extra parralel line with other visible scales.
    Attached the screen shot  for ref.
    And I know the cross line may be due to different Y scales range setting.But XY graph should not display the invisible Y scales and its property  as well.
    please provide your suggestions to avoid that.
    Solved!
    Go to Solution.

    The scales and the lines associated with those scales are separate properties. I have never tried it, and right now I am not at a computer, but there should be properties for setting the grid line colors. Set them to transparent.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Default Pay scale group and Level in infotype-0008

    Hi,
    While hiring should display the default Pay scale group and Level in infotype-0008 or the pay scale group and level can default from the Job or position. Itu2019s possible? Thanks in advance.
    Regards

    No there is no standard Feature to default PSG and PSL. TARIFF is for PSA and PST.
    Wait for some body may have some information.
    Afrasyab

  • Went to use my ipad tonight and the screen is blank except for a little circle going round and round and I ccant switch the device off

    Went to use my ipad tonight and the screen is black with just a small circle in the middle going round and round.  I thought i would switch it off but it wont let me do that either.  HELP

    Try a soft-reset : press and hold both the sleep and home buttons for about 10 to 15 seconds, after which the Apple logo should appear and it should reboot - you won't lose any content, it's the iPad equivalent of a reboot.

  • How do i cancel after the circles of hell go round and round?

    I have been in the circles of hell trying to cancel my subscription which my credit card, i was surprised to learn, had been charged for- only to find it is already cancelled! See below
    Adobe ExportPDF, Annual
    Cancelled: Effective February 2, 2016
    Restart
    But I have just been billed for it anyway. And probably be billed for it in another year - 2016. And then it will probably "automatically" (see fine print) restart.and so on till i am very very old. interesting to see on other posts that cancelling the credit card does not help which seems odd but then again after two hours of wandering round and round the site (love the hilarity of the non-functioning chat icon - much hilarity every Christmas in the accounting department.) I'm not surprised. It is clear that adobe has one of the most difficult "unsubscribes" online. Despite the professionals hunting them down and killing them, there are still websites devoted to the topic of why can't I unsubscribe and why is this so hard and surely this is illegal. Adobe clearly makes most of its money out of the unsubscribe because the two products I bought didn't work anyway. Fair enough, should have known, but remind me to employ a lawyer in future before even opening an adobe document.

    Hi there,
    Sorry for the frustrating experience, looking at the account I could see the billing has been stopped for the subscription and you will continue to have the access to software till 2016.
    Please update this thread if you would like to cancel the subscription and get refund.
    ^Ani

  • Can't access my files, the circle thing keeps going round and round

    I can't access my files, the little cursor thing keeps going round and round, is there a way to by pass that or is my powerbook going dead

    What version of OS X are you running?
    Useful article here on the causes of the Spinning Beach Ball and how to troubleshoot it:
    http://www.computerworld.com/s/article/9177479/Troubleshoot_the_spinning_beach_b all?taxonomyId=89&pageNumber=1
    and also this:
    http://www.thexlab.com/faqs/sbbod.html

  • Pay Scale Group and PS Level

    Hi everyone,
    We use Pay Scale Group and PS Level in our company (values are defaulted in IT0008); Sometimes we need to add new pay scale groups and levels, that is done in customizing client and transported to productive system using transport requests.
    Is there any other way to give permission to users to create new pay scale groups and levels directly in produqctive system?
    Thanks a lot in advance.
    Tata

    Hello
    In general practice it is not recommended to directly create PS grp and level in production as it needs a lot of testing.It may create problem in production.
    Try to follow the transport process.
    Cheers
    Rahul

  • Defaulting Pay Scale Group and Level

    Dear All,
    Is there any way of defaulting Pay Scale Group and Level as they are fixed for Employee Sub-Groups?
    Regards,
    Ahsan Zaidi

    TARIF: Default Pay Scale Type and Area in the Basic Pay                                                                               
    Object                                                                               
    Feature                                                                               
    Task                                                                               
    With this feature you control whether the default value is determined                                                  
         from the T001P from the personnel area and personnel subarea, or whether                                               
         the default value is determined direct from the feature.                                                                               
    The return value must have the form xx/yy, when xx is the pay scale                                                    
         type, and yy the pay scale area.                                                                               
    If the feature returns SPACE as a value, then the value pay scale type                                                 
         or pay scale area is determined by table T001P. If the value does not                                                  
         equal SPACE, then this value will be taken as the pay scale type or pay                                                
         scale area.                                                                               
    You can either enter return both values or only one of the two values.                                                 
         The missing value is determined from table T001P.

  • Hey! I don't know if my MacBook Air is frozen, but the screen is gray with the apple logo and an icon below turning round and round as if it's opening, but has been like that for a few days. I've switched it off and then on again several times, still the

    Hey
    I don't know if my mac book air is frozen, but the screen is gray with the apple logo in the middle of the gray screen, with the 'booting' icon turning round and round. I have switched it off fron both the power and power button on the computer, it goes off, when I put it on, same screen comes on again. Help Please!

    Take each of these steps that you haven't already tried. Stop when the problem is resolved.
    Step 1
    The first step in dealing with a boot failure is to secure your data. If you want to preserve the contents of the startup drive, and you don't already have at least one current backup, you must try to back up now, before you do anything else. It may or may not be possible. If you don't care about the data that has changed since your last backup, you can skip this step.   
    There are several ways to back up a Mac that is unable to boot. You need an external hard drive to hold the backup data.
         a. Boot into the Recovery partition, or from a local Time Machine backup volume (option key at startup.) When the OS X Utilities screen appears, launch Disk Utility and follow the instructions in this support article, under “Instructions for backing up to an external hard disk via Disk Utility.”
    b. If you have access to a working Mac, and both it and the non-working Mac have FireWire or Thunderbolt ports, boot the non-working Mac in target disk mode. Use the working Mac to copy the data to another drive. This technique won't work with USB, Ethernet, Wi-Fi, or Bluetooth.
    c. If the internal drive of the non-working Mac is user-replaceable, remove it and mount it in an external enclosure or drive dock. Use another Mac to copy the data.
    Step 2
    Sometimes a boot failure can be resolved by resetting the NVRAM.
    Step 3
    If you use a wireless keyboard, trackpad, or mouse, replace or recharge the batteries. The battery level shown in the Bluetooth menu item may not be accurate.
    Step 4
    If there's a built-in optical drive, a disc may be stuck in it. Follow these instructions to eject it.
    Step 5
    Press and hold the power button until the power shuts off. Disconnect all wired peripherals except those needed to boot, and remove all aftermarket expansion cards. Use a different keyboard and/or mouse, if those devices are wired. If you can boot now, one of the devices you disconnected, or a combination of them, is causing the problem. Finding out which one is a process of elimination.
    If you've booted from an external storage device, make sure that your internal boot volume is selected in the Startup Disk pane of System Preferences.
    Step 6
    Boot in safe mode. Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Post for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    When you boot in safe mode, it's normal to see a dark gray progress bar on a light gray background. If the progress bar gets stuck for more than a few minutes, or if the system shuts down automatically while the progress bar is displayed, your boot volume is corrupt and the drive is probably malfunctioning. In that case, go to Step 6.
    If you can boot and log in now, empty the Trash, and then open the Finder Info window on your boot volume ("Macintosh HD," unless you gave it a different name.) Check that you have at least 9 GB of available space, as shown in the window. If you don't, copy as many files as necessary to another volume (not another folder on the same volume) and delete the originals. Deletion isn't complete until you empty the Trash again. Do this until the available space is more than 9 GB. Then reboot as usual (i.e., not in safe mode.)
    If the boot process hangs again, the problem is likely caused by a third-party system modification that you installed. Post for further instructions.
    Step 7
    Launch Disk Utility in Recovery mode (see Step 1.) Select your startup volume, then run Repair Disk. If any problems are found, repeat until clear. If Disk Utility reports that the volume can't be repaired, the drive has malfunctioned and should be replaced. You might choose to tolerate one such malfunction in the life of the drive. In that case, erase the volume and restore from a backup. If the same thing ever happens again, replace the drive immediately.
    This is one of the rare situations in which you should also run Repair Permissions, ignoring the false warnings it may produce. Look for the line "Permissions repair complete" at the end of the output. Then reboot as usual.
    Step 8
    Reinstall the OS. If your Mac was upgraded from an older version of OS X, you’ll need the Apple ID and password you used to upgrade.
    Step 9
    Repeat Step 6, but this time erase the boot volume in Disk Utility before installing. The system should automatically reboot into the Setup Assistant. Follow the prompts to transfer your data from a Time Machine or other backup.
    Step 10
    This step applies only to older Macs (not current models) that have a logic-board ("PRAM") battery. Both desktop and portable Macs used to have such a battery. The logic-board battery, if there is one, is separate from the main battery of a portable. A dead logic-board battery can cause a boot failure. Typically the failure will be preceded by loss of the settings for the startup disk and system clock. See the user manual for replacement instructions. You may have to take the machine to a service provider to have the battery replaced.
    Step 11
    If you get this far, you're probably dealing with a hardware fault. Make a "Genius" appointment at an Apple Store, or go to another authorized service provider.

Maybe you are looking for

  • Header and footer of RTF template not getting carried over to Excel output

    We have Header and Footer in RTF template defined. The output of the report will be in Excel. When we run the report, the header and footer on the report are not getting carried over to excel has header and footer, instead the header and footer are p

  • Adobe Reader 11.0.03 won't open

    I am using a Dell laptop with Windows 7. Until today, I could open my PDF files using Adobe Reader 11.0.03. Now the reader window opens then closes when I try to open a file. I have uninstalled AR and reinstalled it. I have gone through the trouble s

  • Newsstand on iPad

    After updating my iPad 2 to ios7 I have noticed that the icon for 'Newsstand' is missing from the settings, Why? Roger24

  • Multiple iPod devices in Finder

    When I connect my iPod to my computer, Finder begins adding multiple copies of the iPod to the Devices list in the left panel. None of these can be dismounted - I get a message that the device is in use and I should try quitting applications. Restart

  • Dont want account posting while return

    Dear All    I am facing one problem in one scenario. In return case i dont want one condition type to post. i dont want post one condition in that particular account. i am using the same pricing procedure for sales cycle and return sales. and that co