Correct Way to Obtain The Most Negative Double

Is this the correct way to obtain the most negative double in Java?
double v = -Double.MAX_VALUE;As Max positive byte is 127, but Max negative byte is -128, not -127
        byte c = 127;
        byte nc = (byte)(c + 1);
        if (nc > c) {
            System.out.println("+ve");
        else {
            // Come here.
            System.out.println("-ve");
        }However, how about double
double v =Double.MAX_VALUE + 1;
Is this makes sense? As, 1 is not the smallest increment unit for double.

yccheok wrote:
Is this the correct way to obtain the most negative double in Java?
double v = -Double.MAX_VALUE;
Double.MIN_VALUE;
However, how about double
double v =Double.MAX_VALUE + 1;
Is this makes sense? As, 1 is not the smallest increment unit for double.No, 1 is not the smallest unit to increment a double with, the smallest unit of course would be negative infinity. Remember double has a fixed precision, so even if negative infinity existed, it would not be accurately represented by a double.
Mel

Similar Messages

  • Is there a way to obtain the text item's value when the mouse pointer at?

    Hi,
    Is there a way to obtain the text item's value when the mouse pointer at? Mouse pointer may be located somewhere out of current record and even out of current block.

    There is a when-mouse-over trigger and that works fine in client-server mode for Forms 5/6/6i, but that is less indicated when deployed using Application Server.
    In that trigger you may write whatever code is necessary, restricted package procedures.
    Still, I think, for your case, if you do not have to deal with a multi-record block, you should use the HINT property for that item and set_item_property with the HINT argument for that item in order to set the hint to the item's value - this should set_item_property should be called on the when-new-record-instance .

  • Correct way to call the character "&"

    I'm just full of questions today...
    I have a logo image called
    B&JBicycleBox_Resized_203x70.jpg  (Note the "&" character - that's where my question is coming from...)
    DW puts this as the HTML to reach it:
    <a target="_blank" href="
    http://bandjbicycle.com/ "><img alt="" width="190" height="70" src="images/sponsors/B&amp;JBicycleBox_Resized_203x70.jpg" /></a>
    (Yes, I realize the forward slashes are facing the wrong direction in the file name string...)
    And, DW also calls this a "Broken Link" ostensibly because the file ref is calling it:
    B&amp;JBicycleBox_Resized_203x70.jpg      I believe the &amp; is making it miss.
    Is it complaining because of the forward slashes and it can't find it?  Not surprisingly, it does play correctly in the browser.
    Or is there a correct way to layout the character of "&" that I'm just not finding.
    Hoibie.

    Absolutely!!!
    Perfect, Hans.  I owe you a Warsteiner....
    H

  • Correct way to obtain AppModule from ManagedBean?

    hi,
    There are many posts on this forum and others in the net with examples on how to obtain an AppModule from a ManagedBean (some of them uses depecrated methods, like using ValueBinding). But what's the correct way to do so?
    Is this the correct one ?
    HttpServletRequest request =
         (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
    HttpSession session = request.getSession(true);
    BindingContext ctx = (BindingContext)session.getAttribute("data");
    DataControl control = ctx.findDataControl("InstelAMDataControl");
    ApplicationModule appModule = (ApplicationModule)control.getDataProvider();
    Thanks!
    Roger

    Roger,
    this is one possible way to get the ApplicationModule inside a bean.
    you can do this via an EL too
                FacesContext facesContext = FacesContext.getCurrentInstance();
                Application app = facesContext.getApplication();
                ExpressionFactory elFactory = app.getExpressionFactory();
                ELContext elContext = facesContext.getELContext();
                ValueExpression valueExp =  elFactory.createValueExpression(elContext, expression, Object.class);
                ApplicationModule am = (ApplicationModule)  valueExp.getValue("#{data." + YourApplicationModuleName + ".dataProvider}");This is essential the same, but uses an EL to get the data provider.
    It's more a philosophical question if there is aright way to do it.
    Timo

  • Some questions about the correct way to recharge the zen micro batt

    Ok..i don't think this is convered in the FAQs.
    I copied this from the FAQ----At the present moment, the only possible way to avoid the standby loss is removing the battery after you finish listening to music. Gi'ven the wear and tear resulting, this is not really an option. It will help, though, if you prime your battery correctly, recharge it often (topping it up, not only resorting to full recharges),
    Ok...my question--
    ) to preserve battery life span, shouldn't we wait for the player to die off complete, for example when it starts to display "low battery" before we recharge it's Does this post mean that we shouldn't actually wait for the battery to be complete;y drained off before a recharge? Does it mean we should always recharge, say when there's one bar left?
    2) Before doing any music transfer using the computer, should we always make sure the zen micro was fully charged first before the transfer since USB port also serves as a charger. I tried using a completely drained player before music transfer and the player stops charging after 3 hours, which shouldn't be the case because USB always take a longer time to charge (i was told twice as much) and true enough, after deplugging from the USB port, the player starts charging again. Note that this always happen, meaning i can never get a complete 5 hours charge using the USB. What is wrong? And after such charge from USB, i noticed that the battery life the next day is like one third of what it usually last when i charged it through a charger...
    I know this is a long post but can someone tell me the correct way of charging?
    Thanxs!

    immunophilic wrote:
    Ok..i don't think this is convered in the FAQs.
    I copied this from the FAQ----At the present moment, the only possible way to avoid the standby loss is removing the battery after you finish listening to music. Gi'ven the wear and tear resulting, this is not really an option. It will help, though, if you prime your battery correctly, recharge it often (topping it up, not only resorting to full recharges),
    This is from JazzMC's FAQ right? (I added a link to this a day or two ago from the main FAQ post) I hadn't spotted this before and I don't agree with most of this. The wear and tear is minimal, but it's more a case of practicality that removing the battery is a pain. Also priming is not really that important with Lithium Ion, and topping up won't make any difference to the battery drain.
    ) to preserve battery life span, shouldn't we wait for the player to die off complete, for example when it starts to display "low battery" before we recharge it's Does this post mean that we shouldn't actually wait for the battery to be complete;y drained off before a recharge? Does it mean we should always recharge, say when there's one bar left?
    Look in my Nomad Primer, which is essentially a distilled version of the information from BatteryUni'versity.com. Top-up charges prolong the life of a Lithium Ion battery. These are all reference in the FAQ.
    2) Before doing any music transfer using the computer, should we always make sure the zen micro was fully charged first before the transfer since USB port also serves as a charger. I tried using a completely drained player before music transfer and the player stops charging after 3 hours, which shouldn't be the case because USB always take a longer time to charge (i was told twice as much) and true enough, after deplugging from the USB port, the player starts charging again. Note that this always happen, meaning i can never get a complete 5 hours charge using the USB. What is wrong? And after such charge from USB, i noticed that the battery life the next day is like one third of what it usually last when i charged it through a charger...
    Because of the Micro's design there will always be a difference in the amount of power it can pull via USB vs. the drain when copying files to it. USB is slower to charge than the mains adapter, but it should charge fully given time (which could be twice as much as using the mains adapter).
    There is a known issue with the battery draining on the Micro, but you should know this having read JazzMC's page. This is the reason the battery is so low the next day.

  • What's the correct way to do the update of AddOn

    Hi,
    Let's say I install the Add-On on server and pushed to each client, if I have to change something in AddOn, do I need to unstall this Add-ON and wait till all clients uninstall current AddOn and then i deploy new version to server and each client has to install the new AddOn again? Is this usual way to do the update of AddOn ?
    Thanks!
    Lan

    Hi Gordon,
    Ok, Thanks!
    P.S. But why SAP B1 doesn't check each Add-On ver # in server side when each time it is launched on client side, If the AddOn has new version, then download it and reinstall it. That's more smart!
    Lan

  • What is the correct way to determine the width and height of a captivate movie at runtime in AS3?

    I have an entire layout framework built and one of the controls is a GUIControlWrapper with every conceivable option for wrapping and aligning (uniform scale, stretch, stretchwidthonly_aligntop/middle/bottom, stretchheightonly_alignleft/center/right, etc.) non-framework controls (i.e. controls that are display objects, but do not inherit from my layout framework's base GUIControl display class).
    Generally this wrapper obtains the object size by calling wrapped_control.getRect( wrapped_control ), to obtain the object's rectangle in its own coordinate system (i.e. its unscaled or original size), and it clips this rectangle to the origin by setting the left and top properties to zero.
    The problem I'm encountering only affects captivate movies.  When I used my framework's uniform scale option, there ends up being a gap at the bottom exactly the size of the captivate movie's playbar (which is visible), which indicates to me that the captivate movie's getRect and height properties are overreporting the height.
    If I use the captivate movie's "cpMovieWidth" and "cpMovieHeight" properties instead, then the uniform scale results in perfect alignment.  The captivate movies "contentHeight" variable is 38px smaller than "cpMovieHeight", and the playbar height is 40, which is about that 38px difference.
    So my question is, why do captivate movies' getRect and height methods report the wrong height for the movie, such that if you actually scaled the clip based on that height to fit the stage size, there is a gap about the size of the playbar?

    I'm sure it's because the movie controls are a seperate swf. CP supplies you with the variable that works as you've found.

  • Stolen iPod touch, never sync, no original package... Any other way to obtain the serial num ? Please help... Thanks !!!

    Stolen my daughter iPod touch, never sync in a computer, no original package... Any other way to get the serial number ?
    Help please... Thanks !!!

    No, I'm looking for the receipt... But in the middle time I'm trying to get it to be able to make the report to the police... Wondering if there's a way to see the devices under the Apple ID?

  • Elegant way of obtaining the domain a computer is in.

    Im not worried about portability, im just looking for a preferably elegant solution to obtain the domain an XP computer is part of. The program will only be run on xp machines within one of two domains. The idea being the active directory program i've written will only connect to the domain the computer is part of. The only method that comes to mind immediately is messing around with system environment variable 'userdnsdomain' but this involves untidy and (unnecessary?) batch commands. Any ideas? Thanks.

    That'll do very nicely, thanks a lot :/

  • Correct way to handle the updated object

    Hi,
    I have a thread, test2.java, that periodically update a object that pass from test.java. In test.java, the "data" object need to be most updated coz this object is used in other thread also. I can ensure that only test2.java do the write, others threads are read only.
    My question is: I can write some dirty code to do what I want. But for a programmer, I want to know the formal, oo way to handle this situation.
    Thanks.
    Tommy
    public class test{
    data d;
    test2 t2;
    public test(){
    d = new data(1, getClass().toString());
    t2 = new test2(d);
    t2.start();
    public void runServices(){
    while(true){
    //If i don't do anything, the following code only print out
    //the instance that i init. here.. Not the updated one
    System.out.println(d.toString());
    try{
    Thread.sleep(5000);
    }catch(InterruptedException ex){}
    public static void main(String[] args){
    test t = new test();
    t.runServices();
    * This class will periodically update the "data" object that
    * passed from test.java
    public class test2 extends Thread{
    int count = 1;
    data d;
    public test2(data a){
    this.d = a;
    public void run(){
    while(true){
    d = new data(count++, getClass().toString());
    System.out.println(d.toString());
    try{
    sleep(5000);
    }catch(InterruptedException ex){}
    public class data{
    int count;
    String s = "";
    public data(int a, String b){
    count = a;
    s = b;
    public String toString(){
    return s + " count:" + count;

    Sorry nearly missed that :(
    You should try to modify the instance of data you have been given in the constructor for test2 instead of creating a new object:
    * This class will periodically update the "data" object that
    * passed from test.java
    public class test2 extends Thread {
      int count = 1;
      data d;
      public test2(data a) {
        this.d = a;
      public void run() {
        while(true) {
          d.refreshWith(count++, getClass().toString());
          System.out.println(d.toString());
         try {
           sleep(5000);
         } catch(InterruptedException ex){}
    }

  • Is there a way to read the system DoubleClickTime double-click%3F

    Hi,
    I'm doing some customized actions on a tree if a user "slow-double-clicks" on a valid tag in the tree. My current solution works, but I would like to set the "limit" or interpretation of what constitutes a "slow" double-click based on the system DoubleClickTime setting of the system that the program is running on.. Anyone knows how to read this piece of information on a) windows system or b) any system?
    Please note that due to what I'm trying to accomplish, I cannot use the "double-click" event to make this determination.  (Double-clicks are left alone to do whatever they would normally do.)
    Microsoft MSDN on Double-clicks
    --I guess a more general form of the question would be "how to read out windows system settings in LabVIEW".
    For the specially interested, my program is an event driven queue machine. When I get a mouse up on the tree-control, I pass the ms timer to an action engine (get, set, re-set) which tracks delta time between two clicks and passes out an enum of "click type" (as defined by me) as either n/a, single, double, slow double.
    In my queue handler loop, I take the click message (from event loop), do some basic checks (is tag of the tree coordinate location empty string?) and pass it all along to another state that determines what to do based on click type, parent(s) (or indent level) and column.  The need for this "slow-click" feature came about when I needed to let the user re-name a parent level tag-item.. If you double-click normally on a parent, it will expand or collapse its children list. . In some applications, (windows explorer for example), the default double-click action (open the file) can be "changed" to a "rename" function by clicking a little slower. Clicking too slow will be interpreted as a "single" click (e.g. select).
    QFang
    CLD LabVIEW 7.1 to 2013

    How about now?
    The clue is in tst's post above, its under .net, windows.forms http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.doubleclicktime.aspx
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • Is there a way to disable the ability to double-tap to create a straight line in Photoshop?

    Hi,
    I have a problem in Photoshop CS6 where whenever my pen double taps the tablet, windows will do the "loading" circle where my cursor is, and I can drag the brush anywhere, and will still have control over the opacity and size, but once I let go, a hard line of 100% thickness and 100% opacity is created between the starting and ending points. Here is an image of what I am talking about:
    http://i.imgur.com/2yO1yIW.jpg
    This is a very annoying problem when I am trying to draw, because often times I will finish one short stroke and begin another immediately, only for a blob of 100% opacity to appear. It happens to me almost every 2 minutes.
    Now, I don't know if this is a problem with Photoshop, my tablet, or my computer. Does anyone know if this is a feature that can be turned off? Or has experienced this problem and has a solution? Thanks.
    Specs:
    Windows 8.1 Pro
    Photoshop CS6
    Wacom Intuos Pro
    AMD FX 8320 / nVidia 650 Ti Boost / 16GB RAM

    Found a fix. It's not a photoshop problem, but a Wacom option. Go into the Tablet control panel > pen > set "double click distance" to Off. Hope this helps anyone who needs it!

  • What is the correct way to inform the controller of an exception in MVC?

    Hi this question has been on my mind for a while.
    Imagine you have a an application based on MVC (mode, view controller) design pattern.
    If a non-fatel exception is thrown in the model (e.g. a number format exception) what is the standard way to of informing the controller so that it can do something useful like display an error pop-up or 'gracefully' shut-down the application.
    The two ideas I came up with are:
    -Return -1 or some other variable in the 'catch' of the try/catch.
    Could be messy, every time you called a risky method you would have to wrap it in an if statement.
    -Declare the model as throwing the exception - that way the controller can 'catch' it and do something useful.
    Possibly makes the controller less cohesive.
    -Handle the error directly from the model by having it display a pop-up error message or forward to an error page etc.
    This would make the model less cohesive.
    The controller should still be informed for the exception so it can decide what to do next - if the exception occurred during form validation shouldnt the controller e responsible for redisplaying the form with an error message?
    Is there a 'best practice' of handling exceptions?
    Thanks
    Edited by: vijizzle on May 12, 2010 8:25 PM

    Just have it throw an Exception and let the Controller deal with it.
    Using a pop-up in the Model makes no sense to me. User interface is the View's job. Ultimately, an error pop-up may be presented, but the problem will be passed back to the View before that happens.

  • What is the correct way to determine the install location of Acrobat/Reader to install plugins?

    We were previously using the following registry key to determine where we need to install our Acrobat/Reader plugin.
    HKEY_LOCAL_MACHINE\Software\Adobe\Adobe Acrobat\%d\InstallPath  
    HKEY_LOCAL_MACHINE\Software\Adobe\Acrobat Reader\%d\InstallPath  
    (and append \plugin_ins to that result)
    With Acrobat DC, I no longer see that registry key.
    I was planning on changing our code to instead look here to determine the install paths:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe\Path
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe\Path
    Is this the recommended way of determining where to install plugins? I would rather not have our installation break when they update Acrobat/Reader the next time (for example maybe in the future they decide to change the executable name...)

    Enterprise Guide can be found at http://www.adobe.com/devnet-docs/acrobatetk/tools/AdminGuide/index.html   (came right up on a web search for me).  You want the information about product tracks and installer bit locations.
    SDK releases are usually within 30 days of the product release.

  • What is the correct way to restore the catalog after a disk failure?

    I am running the latest Itunes on Vista. The disk failed on my old computer and I have a backup of the catalog file. The music files are on external storage (NAS). I've been searching for instructions on how to restore Itunes.
    The catalog is about 1 week out of sync with the music files because I added some music in between backups of the catalog file and the disk failure.
    In a perfect world, I'd like to restore the catalog with playlists and the album art.
    Are there instructions to accomplish this or do I need to rebuild the catalog from the music files and recode my playlists?

    Firstly I don’t have a NAS drive so what I say applies to and external HD, but it should be similar.
    When you say catalogue file, I guess you mean the iTunes database files – iTunes Library.itl and iTunes Music Library.xml. The xml file is just used to allow other programs access to the library but can be useful because you can rebuild the itl file from it.
    If you want your art work, you need a folder in the iTunes folder called Album Artwork.
    So ideally you would like to be able to recover your old iTunes folder from backup.
    If I understand you correctly, you had all your music on a NAS drive and the library files on your internal drive. Were all the music files/folders located the iTunes Music folder on the NAS drive? I will assume you have, it is much harder to get things working if they were not.
    I guess you now have your NAS drive mapped into your new computer so you can see it as a drive letter.
    So I hope this will work for you…
    With iTunes closed, drag the iTunes folder from it’s current location to your desktop. I think the iTunes folder is in Music in Vista.
    Now copy your backup iTunes folder into Music.
    Now start iTunes and got to Edit>Preferences>Advanced>General and set the location of your iTunes Music folder to your folder on the NAS drive.
    If you can see your music as it was when you did the backup, you can use Add Folder to Library to add the folder containing your music. Don’t worry, this shouldn’t create duplicates but it will add any tracks not currently in your library.
    If you don’t have the iTunes folder, the procedure is similar except that instead of dragging the whole iTunes folder out to the desk top, just drag iTunes Library.itl and replace it with the backup. You won’t get your artwork if you just do this.

Maybe you are looking for

  • The Thunderbolt to Firewire 800 cable?

    I have a JVC digital video camera, and have lost some of the cables. Will a Thunderbolt to Firewire 800 cable connected with a Firewire 800 - Firewire 400 cable (same as ieee1394?) transfer the videos to my MacBook Air?

  • IPhoto/eMac upgrade

    I have an eMac that I am going to use to display photos only. It runs on OS 10.3.9 and operates quite nicely. I use iPhoto all the time on several of my other macs and like it just fine. The original software that came with the eMac has iPhoto 4. I w

  • Crossdomain.xml and Reporting Services

    Hi, I'm trying to get my Flex application to call a webservice on a remote Reporting Services instance, but am running up against insummountable problems with the Flash Player's cross-site scripting security. Due to the way that Reporting Services wo

  • Commercial Invoice number mandatory in MIGO

    Dear All, Is there a way to make the commercial Invoice number to be a mandatory entry field for Import MIGO. Is there any field settings or any EXITS available? Please advice. Regards

  • Exchange - moving messages in Mail - dates corrupted

    Hi, Am using Mail.app with Exchange 2007 - all works great, but when I try to move some archived messages stored locally to the Exchange server using drag and drop, most of the messages are timestamped "Today", and are not showing the actual message