Is it possible to set the precision for the subtraction operator?

Hi everyone.
I have two complex double precision numbers that are suppose to be equals. Each one is the result of different sets of equations.
When I subtract one from the other the result is not zero.
I think this can be explain by the fact that they are quite large numbers (about 1E+101), causing the subtraction operator to drop (or round, or do something not legit with) the two numbers. Moreover, if I repeat the subtraction with different large numbers, I obtain about half of the time the expected result (zero) and the rest of the time I obtain a value between 1E+84 and 1E+86.
What I would like is to get the result right everytime, so I thought about setting a precision to the subtraction operator. Is that possible? If it is, how am I suppose to do that and if not, what's wrong with the subtraction operator?
Thanks
tonh

Thought 1: 1e+101 is pretty big!  Do you *need* all your calcs to carry such a big exponent?  For example, can you run all the calcs on values that have been scaled by 1e-100, then at the end of all the calcs scale back by 1e+100? 
Thought 2: If you just need to compare for approximate equality, you could divide the difference by the larger of the two values being subtracted.  If you subtract two virtually equal 1e+101 values, you may get a difference in the order of 1e+85.   The division will give you a ratio of ~1e-16.  Ratios in that realm will mean that the two original values are about as nearly equal as the floating point representation can express.   This type of method scales pretty well to work with both very small and very large floating point numbers.
Thought 3: If the inputs to your calcs are in the order of 1e+85 or less, you may really have your work cut out for you.  You'll need to think carefully about floating point representation error at each step of the calculations to know where you can round, truncate, approximate, etc.  There may be places where rounding will be *necessary* and other places where it is *disastrous*.
To summarize: you need to apply some of your error knowledge to your code.  The 1e+101 calculated values probably don't have more than 6-8 *significant* digits of accuracy, right?  (Most numbers come from some kind of measurement, or a rounded-off value for a scientific constant, etc.)  You'll need to analyze your values and calcs to understand about how many digits of the 1e+101 numbers are truly *significant*.  Then your code will need to treat values which differ by less than that amount as if they are truly equal.
-Kevin P.

Similar Messages

  • Is it possible to set a password for the camera roll without jailbreak?

    Why don't apple add this feature to iphone software update?  I don't wanna type password again and again to awake my iphone.  The only thing I need password to get access to is the cameral roll !! I really don't want to jailbreak.  Hope apple would consider my thoughts.

    No one here would know why Apple does anything unless they announce.  We are all iphone users just like you.
    http://www.apple.com/feedback

  • Set "serveroutput on" for the current session.

    I'm still new to PL/SQL and I use "*SET SERVEROUTPUT ON SIZE 100000"* always before I run a PL program block to get dbms_output. I really need to know why should we specify a size in this line & what that size will be applied for. Also I need to know whether there is any possibility to set serveroutput enabled for the current session, rather than running this code line before each and every PL block.
    I Tried *"ALTER SESSION SET SERVEROUTPUT ON SIZE 1000000"* ; But it was not successfully executed.
    Thanks!

    michaels2 wrote:
    I will have to always write it above my PL block, and run this line with that PL block.before the first dbms_output call you can also issue dbms_output.enable() :
    declare
    my_var varchar(30);
    begin
    my_var:='&input';
    dbms_output.enable();
    for i in 1..5 loop
    dbms_output.put_line('Hello '||my_var);
    end loop;
    end;
    /This should always work, irrespective of how you SET SERVEROUT in sql*plus.Nope.
    SQL> ed
    Wrote file afiedt.buf
      1  begin
      2    dbms_output.enable();
      3    dbms_output.put_line('TEST');
      4* end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL>dbms_output.enable is used to enable the output buffer (or set the size of it) on the server side of things. It can't influence the client application into retrieving and displaying the output from the buffer, even if that is SQL*Plus. ;)

  • I have a 4 gen Time Caps. and a 2nd Gen Airport Extreme I would like to extend my TC network to use the Extreme for the purpose of having internet available to my TV box wired.  Is this possible and how to I get them to work together?

    I have a 4 gen Time Caps. and a 2nd Gen Airport Extreme I would like to extend my TC network to use the Extreme for the purpose of having internet available to my TV box wired.  Is this possible and how to I get them to work together?
    How can I get my Time Cap (TC 4 gen) to recognise my 2gen Airport Extreem (AE)
    Frank

    Thanks for the info, this really helps.
    Power up the AirPort Extreme for a few minutes, then hold in the reset button on the back of the Extreme for 10 seconds and release. Allow a full minute for the Extreme to restart to a slow, blinking amber light.
    It might be possible to use wireless to configure the Extreme, but I recommend using a wired connection. Temporarily, connect an Ethernet cable from your Mac to one of the LAN <-> ports on the Extreme.
    Click the AirPort icon at the top of the Mac's screen and wait a few seconds for a listing of New AirPort Base Station to appear. Just below that, click on  AirPort Extreme.
    The illustration below shows an AirPort Express. You will see AirPort Extreme on your screen.
    AirPort Setup will open up automatically and take a minute to analyze the network, then announce that the Extreme will be configured to extend the Time Capsule network.
    Enter a device name that you want to use for the Extreme and click Next
    Wait a minute while AirPort Setup configures things for you. When you see the message of Setup Complete, click Done.
    You can disconnect the Ethernet cable that you used for the set up now. Things should be working. The Extreme is providing additional wireless coverage the the Ethernet ports are enabled. You can connect to any port that you want since they all operate the same in this type of setup.

  • Where is the hyphen (-) on the apple TV?  I am trying to set up my network and there is a hyphen in the password for the network

    Where is the hyphen on the apple TV?  I am trying to set up my network and there is a hyphen in the password for the network

    A few options to try:
    They hyphen should be next to the + on the character map.
    If you are still having issues, provided your ATV software is up to date, you can now connect an Apple Wireless Keyboard through bluetooth connections.
    Change your network password so it does not use a hyphen
    Good luck!

  • Purchased a new Apple TV and the remote double clicks each time I press the button. It worked fine during set up and for the first two days.  I have since moved it and this problem started. Restarted,reset,unplugged,change remotes, no change.Help please.

    Purchased a new Apple TV and the remote double clicks each time I press the button. It worked fine during set up and for the first two days.  I have since moved it and this problem started. Restarted,reset,unplugged,changed remotes, no change. Latest software update. This is really annoying.  iPhone remote app works just fine.  Any suggestions?

    That's one of the weird things.. it recognizes it maybe 10% of the time. And usually, only after I do the two-button reset. Problem is.. since it won't charge above 2%, anytime I try to do a restore or anything like that using iTunes, my device shuts off and I lose whatever progress I'd made.
    So, an update... after reading through a bunch of similar complaints (there are literally 1000's of them so there's NO WAY this isn't somehow ios7 related, thanks a lot APPLE ) I decided to try a restore in recovery mode. After 3 hours and several disconnections... I ended up having to just set it up as a new iPad, as the restore did nothing. Weirdly though... as I was doing the restore in recovery mode.. I noticed I'd gotten up to a 10% charge.. higher than it's been since September, so after setting it up as a new device, I turned it off and plugged it in using the wall charger. 2 hours later and I was up to 38%. Still not great, as my iPad, before ios7 could've fully charged twice in the amount of time it took for me to now get 28% more of a charge. And that's with a fully cleaned out device.. so that really ***** and I'm now more confused than ever.
    But I'm gonna leave it overnight charging and see what I come up with tomorrow. Sadly, when I paid $600 for it in February, I never expected to have to play "wait and see" with it...

  • Would Like to Get Report of Daily Emails In and Out from Members to a DL Exchange version : 2007 I am the supervisor for the group and want to quantify this information. I do not need to see the content, just quantity is it possible ?

    Would Like to Get Report of Daily Emails In and Out from Members to a DL
    Exchange version : 2007
    I am the supervisor for the group and want to quantify this information. I do not need to see the content, just quantity
    is it possible ?

    Well, distribution groups don't really have a concept of "in" or "out". They only serve to distribute messages sent to them -- unless you're asking to know who was a member of the distribution group at the time a message was sent to the DL.
    Message tracking logs hold the information you want, though. You'd have to look for EXPAND events that reference the distribution group and take the sender's e-mail address from that event. If the DL is a simple one that's not a member of any other groups
    you could also look for RECEIVE events sent to the e-mail address of the group and get the sender's name from that event.
    You can use Powershell extract the rows of data from the logs, but you'll have to write the code to get the data out of those rows and into a format you want. Perhaps LogParser could be useful in place of Powershell?
    --- Rich Matheisen MCSE&I, Exchange MVP

  • How do I set a reminder for the last day of every month

    Have I missed something? But how do you set a reminder for the last day of every month to recurr indefinatley in iOS6? Sorry if this is really simple but I just can't seem to work it out. Any help gratefully received.

    Hey Mattye88 not sure if you have seen but actully you can do this, but for some reason you have to use Siri.  If you bring up Siri and say "set a reminder ever 4 weeks from next wednesday to check the gas meter" it will set one and it will work just fine, I have reminders to water a Bonsai every three days and it works fine it just shows as custom repeat on the user interface.  Alas it seems you can not use Siri to set one for the end of the month though which is why I am in this threed.  Still hope it helps you to know how to sort this problem atleast.

  • How to set the icon for the entire application with JFrame.setIconImage

    I set the icon on the main frame using JFrame.setIconImage(). The icon is shown properly in the main frame.
    If more JFrames are opened from the main frame, the newly opened JFrames also show the icon.
    However if JDialogs are opended, in some cases the icon set on the main frame is shown and in other cases the coffee cup.
    What is JFrame.setIconImage() expected to do? Setting the icon for a single JFrame or the entire application?
    How can I set the icon for the entire application?
    How can I set the icon for JDialogs?
    Thank you

    In order for your dialogs to use the same icon as the frame, you must parent the dialogs to the frame which has the custom icon.
    See the following thread for more information: http://forum.java.sun.com/thread.jsp?forum=57&thread=362542
    cheers,
    Greg

  • Iv just bought  Ipad 2 for back home in UK in usa. I'm trying to set it up for the plane ride home on my sisters pc which already has itunes installed. Will I be able to sync it with my own PC back home.

    Iv just bought  Ipad 2 for back home in UK in usa. I'm trying to set it up for the plane ride home on my sisters pc which already has itunes installed. Will I be able to sync it with my own PC back home.

    Yes, but all the data from your sisters PC will be erased and replaced with yours, which is probably what you want anyhow.

  • "Display PDF in Browser" setting - $500 reward for the solution

    The corporate policy requires the "Display PDF in Browser" setting to be unchecked for all applications, this is to open the PDF document in new reader instance but our specific application needs the reader to be opened in the same browser even if the preference "Display PDF in Browser" is unchecked.... The setPreference from javascript (html) doesn't seemed to work... How do i make this work? I am looking for programatic way to set this preference in HTML javasript or Java Applet or ActiveX or any other means. I am currently using JS and Object tag, the only functions that we need at this point are page navigation and getting current page using JS.
    Also, I need the links the browser to open in new browser once the PDF is loaded... do I need to reset the preference once it is loaded for the links to open in new browser? How can this be progrmatically achieved without altering the original PDFs?
    I realize that this may be difficult and am looking for workarounds or alternate solutions to meet my req. $500 for anyone who could can provide solution.. Please email me [email protected]
    thanks,
    - Ray

    Convince your IT people to allow folks to set their preference to display in browser.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Sun, 13 Nov 2011 14:58:23 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: "Display PDF in Browser" setting - $500 reward for the solution
    Re: "Display PDF in Browser" setting - $500 reward for the solution
    created by pdf_disp_issue<http://forums.adobe.com/people/pdf_disp_issue> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4023302#4023302

  • I just bought a power adapter and it is not working, says "not charging".   The same for the mobile charger.   Anything I need to do in the setting?

    I just bought a power adapter and it is not working, says "not charging".   The same for the mobile charger.   Anything I need to do in the setting?

    The device is locked to the carrier it was purchased through unless you specifically purchased it as unlocked directly from Apple.
    Only the carrier to whom it is locked can authorize it's unlocking.  To do so, the user much contact them to start the unlock process.

  • What is the default for the "Display PDF in Browser" setting?

    What is the default for the "Display PDF in Browser" setting in Adobe Reader 9 and X?
    Also, are any statistics available on what proportion of users have this setting set to on?

    For all three the default is "checked".
    Be well...

  • Is it possible to choose several folders for the Recognize text-operation in Adobe Acrobat X Pro?

    Is it possible to choose several folders for the Recognize text-operation in Adobe Acrobat X Pro?

    You can choose multiple files, or a single folder. If you choose a folder,
    though, all of the files in all of its sub-folders will be processed as
    well.

  • Error while setting up enviroment for the application

    Hi,
    Im getting a popup box displaying the error message
    C:\WINDOWS\system32\ntvdm.exe
    Error while setting up enviroment for the application. Choose 'Close' to terminate the application.
    When I try to excute an external exe, why am I getting this error? and is there a way of getting this exe to execute properly without the error?
    Here my code for excuting the external exe
    String[] cmd = {"C:/gen.exe", "C:/a.zip"};
    Process p = Runtime.getRuntime().exec(cmd);
    p.waitFor(); "gen.exe" is the program i wish to execute and "a.zip" is the parameter i wish to excute it with.

    class ExecRuntime {
    public static void main(String args[]) throws Exception {
    String[] cmd = {"C:\\gen.exe", "C:\\a.zip"};
    Process p = Runtime.getRuntime().exec(cmd);
    p.waitFor();
    } Here we need to use backslashes, because the command is passed to the OS as is.
    If you need to be in C:\ to execute from command line, you will also need to use the
    exec() version that allows you to specify the 'current directory'
    Edited by: baftos on Mar 7, 2008 12:13 PM

Maybe you are looking for

  • 3 problems in one .. sort of.

    this problem just came up today. i went to plug in my 1gen nano to update it with new songs, only after a split second the "do not disconnect" screen disappeared and it obviously did not update. i disconnected the ipod and reconnected it, only this t

  • Kms on server 2012

    Hi All, i install server 2012 with 2012 kms host  license. now i know if i enter the kms of 2012 license it valid all the way down for win 2012,2008,8...   to activated but i only want to activate with that kms is win 7 and 8 and no servers. i want t

  • Weird Behavior not saving correctly

    I have a JSP page that uses the <tiles:insert> . Every time I go to save it, it takes the contents of the definition file and INSERTS it at the bottom of the JSP I am working on. I can therefore, never save this file correctly. This appears to be a m

  • Browser prompts for LDAP password when trying to log into portal

    We migrated some portals,  after the migration everything works fine for the portals, you can log in with your LDAP id and all authorization are working correctly.   The only issue is, it prompts you to enter your password.  It's using the password f

  • PI Installation Error

    Hi experts I am trying to install SAP Netweaver NW2004s with PI component as a test basis. We are doing this to get the exact result so there is should not be any error. We did not connect to LAN network The assigned specs are Computer name : ser Fre