BigDecimal and Math.exp() precision problem

Hi,
I'm working with huge numbers, and I need to calculate
Math.exp(800)/Math.exp('also very big') = 'not so big'
One of the problems is that Math.exp is a double!!!
Is this possible in java, maybe with BigDecimal, or something like that.
Thanks in advance
Luca

Math.exp(x) gives you e^x and not 10^x (I just mention it so you know. You can use some calculus,
e^x/e^y = e^(x-y)
It will helps if x and y are big but about equal in size.

Similar Messages

  • Acrobat Pro 6 Average Daily Production and Math.round problem

    Acrobat Pro 6 Average Daily Production and Math.round problem
    (Production.0) (154) (whole units) . (Production.1) (90) (fractional) / (divided by) 31 (days) results in (Average.0) (4)(whole units) . (Average.1) (10) (fractional) using :Math.round.� Noticed that 154 (whole units) . 85 through 99 (fractional) also show 4.10. (without Math.round : 5.00)
    Method:
    �Production.0� (whole units) . �Production .1� (fractional) / Days = (Average Daily Production) (�Average.0� (whole units) . (Average.1) (fractional)
    � Production.0 (value not calculated)�, � Production 1 (calculated) (event.value = util.printx("0099", (event.value)).substr(-2,2); � �Average.0 (value not calculate)�, and �Average.1 has following calculation:
    var punits = this.getField("Production.0");
    var pfrac = this.getField("Production.1");
    var average = 0.0;
    average = (punits.value + pfrac.value / 100) / this.getField("Days").value;
    this.getField("Average.0").value = average - average % 1;
    this.getField("Average.1").value = util.printx("0099", Math.round((average % 1 * 100))).substr(-2,2);
    �Math.round� appears to be a problem. Also, could you explain the purpose of �0099� . Anyway, why would 154.85 through 154.90 divided by 31 give 4,10. Also, their must be a better way, to find the average daily production. All you have to do is divided the production (whole. fractional) by the days, and display the average daily production as (whole. fractional). Any suggestions??

    There are a many loose ends in your question.
    First, I have never seen before a variable type called 'var'. Is it a java primitive or a class?
    Next, I cannot seem to find any class that has the printx method.
    When it comes to substr(-2,2), I get confused. First, I thought that it was a method of the String class, but I only got as far as substring(beginIndex, endIndex).
    If you really must break the production and average into pieces, try this:
    float average = (punits + pfrac/100) / days;
    int avg_units = (int)average;
    int avg_frac = (int)( (average - avg_units) * 100 );My guess is that util.printx("0099", x) formats x having two optional digits and two mandatory digits, showing 0-99 as 00-99, but allows to show numbers with three and four digits.
    154.85/31 = 4,9951612903225806451612903225806
    154.99/31= 4,9996774193548387096774193548387
    If you round the fraction of theese numbers multiplied by 100 ( = 99.51.. and 99.968...) you get 100, and this will be the output of printx. My guess for "4.10" is that substr(-2,2) returns the two first characters of the string, because the start index should not be zero. (According to java docs, substring throws an exception on a negative index, so what kind of class are you really using ??????)

  • Math.exp with BigDecimal

    Hi
    I am trying to do
    currentSp = Math.exp(currentSpVal.add(runningSpVal));
    where currentSp , currentSpVal and runningSpVal are all BigDecimals.
    Is there a way to do this without using Math.exp(double) and directly with BigDecimals and not type double.
    The given line of code obviously gives an error.
    Thanks

    Why would you want to do this? The method's resultant accuracy is limited by the exp variable which is only defined to double accuracy. I'm curious as to what specification would require this degree of accuracy and why.

  • Hi - for any photo, info in mountain lion shows a different file size than Photoshop does. I've tested with CS3 and CS6 and get the same problem. Doesn't happen with CS3 and OSX10.4 or any previous versions of Photoshop and OSX. Anyone know why?

    Hi - for any photo, info in mountain lion shows a different file size than Photoshop does. I've tested with both CS3 and CS6 on 10.8.2 and get the same problem. This doesn't happen with CS3 and OSX10.4 or any previous versions of Photoshop and OSX. Anyone know why?

    this one is actually a really rare symptom of a flaky connection to the ipod on a Windows PC. there's more going on in terms of hardware on nanos and 5th gens than in the earlier models ... so if the connection is flaky to precisely the right/wrong degree, itunes will see the ipod, but misidentify it as an earlier version of ipod.
    tracking down the cause of the flakiness can be tricky ... as you already know ...
    just checking. have you tried connecting with a different (known-good) USB cable? does that seem to have any impact on the rate of occurence of the problem?

  • Garageband, snap to grid and editing with precision

    I'm *this* close to buying an iPad mini. The main reason is that I run a podcast and like the idea of editing it during my daily commute. I usually create the podcast with Garageband on my Mac, so was thinking Garageband on iPad would be the obvious app.
    BUT when I tested it out today on a store iPad I could not figure out a way to turn of "snap to grid" when editing audio, which means that it's impossible to make precise edits to speech - you can't just cut and join wherever you like, only at 1/16-beat (or whatever) intervals.
    I'm hoping that someone here who uses their iPad for audio editing will either tell me that 1.) I'm wrong, and you can in fact turn of the grid-snapping and edit audio with precision, or 2.) there's a different app for iPad that can edit audio with precision, ideally a multitrack editor. Double bonus points if the finished multitrack can be fine-tuned on a Mac later.
    Anyone?

    I wasn't able to find clean up by right clicking, but on the finder menu in view, clean up is present and it works. Problem fixed.
    Thanks a lot galantesteve!

  • DV6-3122us/ after and during Factory restore problems

    This is a DV6-3122us 64 bit notebook, 500GB hard drive, 4 GB ram, Windows 7 Home Premium OS. I restored it from the Factory purchased recovery discs, and I had a problem with that, had to do it 3 times kept locking up at 9% on the restore part. It finally went through then said couldn't install, turned it off, and it was installed. This is Windows 7 Home Premium. Now I have lock ups when updating. The HP assistant  loads but says it has errors at the very top, and doesn't show the system information at the bottom. The hard drive only shows 80 GB allocated, and 397 unallocated. This is all the original hardware, which has been tested and has passed, memory has passed. Any Help would be greatly appreciated.

    1. Right click on the partition ( C:\ ) you want to Extend into the now unallocated partition and click on Extend Volume.
    2. Click on Next for the Welcome to the Extend Volume Wizard window
    3. Select the amount of space in MB you want to use from the unallocated partition to use to Extend this partition
    4. Select all of the available space .
    5. Click on Next.
    6. Click on Finish in the Completing Extend window
    You will now see the Disk Management console with the new extended partition volume ready to be used.
    7. Close Computer Management.
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • I recently had to swap out my iphone 4s and I am having problems restoring photos and videos from icloud.  I get a message on my phone that says " the URL you are requesting is not found on this server".  Pics and videos have been deleted too.

    I recently had to swap out my iphone 4s and I am having problems restoring photos and videos from icloud.  When I restored my phone from icloud, half of my pics and videos have been deleted, the pics that were restored on my phone are very blurry, and the videos won't play.  I get a message on my phone that says " the URL you are requesting is not found on this server".  I have erased and reset my phone twice, but every time I do it, more pics and videos are deleted.  I have backed up to icloud and iphoto, however, some of the pics are no longer on iphoto either.  Is there someway to get the videos to play on my phone again?  Make the photos not as blurry as they are now and to restore the pics and videos that have been lost?  I really would love to have them back, this phone is supposed to be the best and right now it doesn't seem to be.  Please help if you can.

    I too have noticed that once i restored from iCloud. Pictures blurry and videos wont play!
    Need help too!!

  • I am using a work laptop and have the same problem. When I try to change the "configure proxy", they only available option is "use this proxy server for all protocols". Could it be that my system administrator blocked me from changing it since they don'

    I am using a work laptop and have the same problem. When I try to change the "configure proxy", they only available option is "use this proxy server for all protocols". Could it be that my system administrator blocked me from changing it since they don't want us to use Firefox.
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.4; FNGP_SYS)

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the ''Safe mode'' start window.
    You have to close and restart Firefox after each change via "File > Exit" (on Mac: "Firefox > Quit")

  • I have an iPhone 4S and never had a problem with syncing it. But suddenly, when I connected my phone to my mac, it says that its in recovery mode, and I need to restore it in order to sync. I've updated both my phone and my itunes, and it didnt work.Help?

    I have an iPhone 4S and never had a problem with syncing it. But suddenly, when I connected my phone to my mac, it says that its in recovery mode, and I need to restore it in order to sync. I've updated both my phone and my itunes, and it didnt work.Help?

    fighter19lisa wrote:
    that only makes it say its synced, when its not.
    No, it does not.  It transfers purchases from the iDevice to the computer.  The computer must be authorized for the Apple ID that the content was acquired with.
    fighter19lisa wrote:
    my playlists wont show up on the phone.
    Are they selected to sync?  Is Manually Manage content on the device selected?
    fighter19lisa wrote:
    i had to change my password for my aol account again and i still cannot get my email on my phone to even work
    What does that have to do with syncing content to the device?  FYI, nothing.

  • HT201304 Hi! My My mom bought me an iPhone 5 and I have a problem with my facetime I cant find it! Cant find it in settings and restrictions. She bought this in Bahrain both my iPhone and she ipad mini and she has facetime on her. What should I do?

    Hi! My My mom bought me an iPhone 5 and I have a problem with my facetime. I cant find it! Cant find it in settings and restrictions. I remember when she gave me this I see facetime in settings and after a couple of days its gone! She bought this in Bahrain both my iPhone and her iPad Mini. And I'm just wondering why she has facetime and why mine is missing? Please help! My iMessage is perfectly working. I lived in the Philippines

    Are you trying to use the phone in Bahrain with a supported carrier there? I suspect not. If you try to use this phone outside of Bahrain, you won't have FaceTime. This is done to prevent folks from simply crossing the border to purchase iPhones in Bahrain...FaceTime is banned in Saudi Arabia & the UAE. Sorry, but you'll only have FaceTime on that phone while using it in Bahrain on a supported carrier's network there.

  • TS3048 My early 2009 Mac Pro does not connect via bluetooth to my sound bar or bluetooth mini speakers. Both my wireless keyboard and mouse have no problems connecting. What do I need to do to connect to external bluetooth devices?

    My early 2009 Mac Pro does not connect via bluetooth to my sound bar or bluetooth mini speakers. Both my wireless keyboard and mouse have no problems connecting. What do I need to do to connect to external bluetooth devices?

    I would always have a wired keyboard and mouse on hand (need not be expensive ... any cheap wired devices will work).  "Emergency recovery" procedures can activate features in random order, so the opportunity to select a recovery partition may pass before the wireless devices are recognized.
    That will let you select the "turn on Bluetooth" icon.

  • I have just bought my iphone 4S 32GB from three weeks ago and 'am facing a problem that in the middle of my calls it suddenly says call failed and it keeps on doing it every call i make

    I have just bought my iphone 4S 32GB from three weeks ago and 'am facing a problem that in the middle of my calls it suddenly says call failed and it keeps on doing it every call i make .. I Don't know what to DO Please anyone help me i've got OS 5.0.1 and it's factory unlocked i've boughted from USA and it was sent to me where 'am living now in Egypt ...ANy Helpppppppppp Pleasee

    try general>settings>reset>reset all settings and start up as an new phone.

  • I need advise and help with this problem . First , I have been with Mac for many years ( 14 to be exact ) I do have some knowledge and understanding of Apple product . At the present time I'm having lots of problems with the router so I was looking in to

    I need advise and help with this problem .
    First , I have been with Mac for many years ( 14 to be exact ) I do have some knowledge and understanding of Apple product .
    At the present time I'm having lots of problems with the router so I was looking in to some info , and come across one web site regarding : port forwarding , IP addresses .
    In my frustration , amongst lots of open web pages tutorials and other useless information , I come across innocent looking link and software to installed called Genieo , which suppose to help with any router .
    Software ask for permission to install , and about 30 % in , my instinct was telling me , there is something not right . I stop installation . Delete everything , look for any
    trace in Spotlight , Library . Nothing could be find .
    Now , every time I open Safari , Firefox or Chrome , it will open in my home page , but when I start looking for something in steed of Google page , there is
    ''search.genieo.com'' page acting like a Google . I try again to get raid of this but I can not find solution .
    With more research , again using genieo.com search eng. there is lots of articles and warnings . From that I learn do not use uninstall software , because doing this will install more things where it come from.
    I do have AppleCare support but its to late to phone them , so maybe there some people with knowledge , how to get this of my computer
    Any help is welcome , English is my learned language , you may notice this , so I'm not that quick with the respond

    Genieo definitely doesn't help with your router. It's just adware, and has no benefit to you at all. They scammed you so that they could display their ads on your computer.
    To remove it, see:
    http://www.thesafemac.com/arg-genieo/
    Do not use the Genieo uninstaller!

  • Office Report Generation Toolkit 1.0.1 and MS Office 2000 problem

    Hello.
    I'm tring to make a repot in word using a template..everything works just fine when in development..but when i make the executable the problem arises.
    I get error code 7  (Cannot open vi reference) in NewReport.vi.. FYI i'm running the aplication in the same machine i'm developing.
    I'm sure everything else is ok..- changed paths to work in executable, template in correct folder...i'm adding the necesary support llb to the executable(Win200), etc - ..i tried reinstaling office and the report generation toolkit but i still have the same problem...
    How can i solve this?....
    Thanks in advance for all yur help.

    Well..that was a very good answer to my question...and it solved my problem. Thank you.
    I thought that by adding just the llb as support files would be enogh..but now i see this is not correct..thanks again.

  • Sending a bug report on the OS and a sleep mode problem.

    I find the bug button in Safari really convenient for sending Apple bug reports. And when other applications crash, you usually get an error dialog with a button to send a bug report. But sometimes problems arise that require reporting, but which don't fall in either of these categories. It would be very handy to have a bug "button" for the OS, or perhaps just a menu selection in the Finder menu bar that invokes a bug report dialog box. I know you can dig around and find the URL for Apple's bug report web page, but I am always forgetting it -- I suppose I could just bookmark it, but then I'd just have to dig around in all the bookmarks to find it. Better would be a utility built-in to the OS for sending bug reports (like Safari's). It could also automatically transfer necessary info about the OS rev and such.
    The problem I had was this. I have a script that puts my iMac to sleep. I put the script alias on the task bar and a single click puts the computer to sleep (easier than using the menu). Unfortunately, I sometimes click it by mistake when I am trying to click an adjacent icon in the task bar, and the Mac starts going through its cycle to enter sleep mode and is impervious to anything I do to try and cancel it. I tried pressing the space bar continuously to prevent it from going to sleep, but that did not work. Worse, when it went to sleep and I woke it up again, the task bar would not appear, clicking on app windows did not activate them, Finder menus could not be selected, etc. The cursor would move, but I could not do anything else. (I wish now I had noted if the clock in the menu bar was still advancing, but I didn't think to do that.) I powered down the iMac from the power key and rebooted. Things are working fine now.
    I wanted to send a bug report on this, but realized that unlike Safari, there was no button or menu selection for doing that. So here I am.
    Any suggestions are welcome.
    TIA,
    Drake

    [email protected]
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

Maybe you are looking for