Results 1 to 7 of 7

Thread: Negative zero?

  1. #1

    Thread Starter
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Negative zero?

    Apparently some government apps allow it:
    Attachment 75340
    Last edited by JuggaloBrotha; Jun 30th, 2010 at 03:05 PM.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  2. #2

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Negative zero?

    I can think of at least two reasons for this:
    1. Some CPUs handle numbers (either or both integer and real values) as signed magnitudes. So a "-0" can be legit even though equality tests will compare them as equal.
    2. The value may be close to zero but rounded off retaining the sign (-0.2 rounded to -0).

    Actually some CPUs and memory even have "out of band" bits a user-mode program can't see. These often include a parity bit but may even include "tag" bits that determine the type of data stored in the word. Such a processor may not allow "code" with the wrong tag values to be excuted for example. Other tag values may be required for a word to be used as a pointer or memory descriptor. Some tag values get used for things like stack-frame markers.

    Such machines are much harder to write malware exploits for. Buffer overruns aren't a problem because arrays are bracketed by tags saying "can't be written by user-mode code" and trying to write "off the end" results in an interrupt caught by the OS.

    Even x86/x64 CPUs are gaining these sorts of "smarts" to enable things like hardware DEP and memory management enhancements. With RAM so cheap I'm surprised we haven't seen tagged memory come into vogue for microprocessors like these yet. As far as I know there aren't any "Wintel" machines using such things yet though, at least not beyond parity and ECC.

  4. #4
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Negative zero?

    its also possible they were originally working in celsius -18 and their converter uses the absolute value and keeps the sign.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  5. #5
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Negative zero?

    http://www.crh.noaa.gov/ddc/?n=windchill

    But is -0 colder than +0, because we are not having Global Warming in Missouri anytime soon and it feels like it must be -0!
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  6. #6
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Negative zero?

    I thought this thread was going to be about the user on here named Negative0
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  7. #7

    Thread Starter
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Negative zero?

    I typed out the word for 0 for that reason, http://forecast.weather.gov hasn't given me a -0 for the temp since that day either.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width