CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2010
    Posts
    94

    Thumbs up Why not decimal?

    Why do computers handle only bits and bytes ?

  2. #2
    Join Date
    Jul 2010
    Posts
    94

    Re: Why not decimal?

    I read google results , people say it is hard to handle a decimal, flip its sign etc. but I think
    to flip a sign from minus to plus is easy
    e.g +1 and -1 but clearly it takes long time to format a number from input to computer compatible form then to reformat the result for user's review

  3. #3
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Why not decimal?

    Computers are made out of bits. That's the only thing they know. Go read some info on how the architecture of a chip works.

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Why not decimal?

    Computers operate on numbers in base 2 format, because that's all they can know. A transistor can only have two states, on or off.

    Viggy

  5. #5
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Why not decimal?

    Quote Originally Posted by Sharpie View Post
    I read google results , people say it is hard to handle a decimal, flip its sign etc. but I think
    to flip a sign from minus to plus is easy
    e.g +1 and -1 but clearly it takes long time to format a number from input to computer compatible form then to reformat the result for user's review
    For you and me it's easy to flip the sign .. however in PC architecture +1 and -1 are stored very differently ...

    using Int16.. +1 = &H0001 and -1 = &HFFFF

    The thing is this method allows easier method to perform maths on the numbers..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

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

Featured