CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    May 2006
    Location
    Norway
    Posts
    1,709

    Convert from unsigned short to double and back again

    When you try to convert a number from double to unsigned short there is a possible loss of data, as this warning tell:

    conversion from 'double' to 'unsigned short', possible loss of data.

    But is this a danger in this case, when I first convert it from unsigned short to double?

    Like this example:

    Code:
    unsigned short x = 10;
    
    double y = x;
    
    unsigned short z = y;
    What I mean, is there any chance that z will hold anything else than 10 here?


    Thanks!
    Last edited by laitinen; August 4th, 2006 at 03:29 AM.

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