Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C++ MAKEDOUBLE ??

C++ MAKEDOUBLE ??

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LX 0
    wrote on last edited by
    #1

    Do you know if it is possible to create an 64-bit value (double) by concatenating two specified 32-bit values (long)?? The macro MAKELONG exists but MAKEDOUBLE, no...Apparently, it is not possible to make a << on a double?? Do you know a way to do it? Thanks, LX

    T M 2 Replies Last reply
    0
    • L LX 0

      Do you know if it is possible to create an 64-bit value (double) by concatenating two specified 32-bit values (long)?? The macro MAKELONG exists but MAKEDOUBLE, no...Apparently, it is not possible to make a << on a double?? Do you know a way to do it? Thanks, LX

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      What exactly do you want to do? You know that long and double are two different animals, don't you? One is integer type and another is floating point. This means that glueing together two longs doesn't produce one double. Tomasz Sowinski -- http://www.shooltz.com

      L 1 Reply Last reply
      0
      • T Tomasz Sowinski

        What exactly do you want to do? You know that long and double are two different animals, don't you? One is integer type and another is floating point. This means that glueing together two longs doesn't produce one double. Tomasz Sowinski -- http://www.shooltz.com

        L Offline
        L Offline
        LX 0
        wrote on last edited by
        #3

        Yes, it's right !!:-O What I want to do is based on STL : ------------------------------------------ typedef struct _MYSTRUCTURE { long lType; long lSubType; }MYSTRUCTURE; typedef std::vector lID; typedef std::map myMap; ------------------------------------------- But when I do a 'find.' on myMap, STL can't find my vector in searching on MYSTRUCTURE 'cause it can't compare : ... ---- MYSTRUCTURE myStructure; myStructure.lType = 10; myStructure.lSubType = 11; myMap::iterator it; it = m_mymap.find(myStructure); ---- So, I wanted to concatenated the 2 longs and using typedef std::map myMap; but, you're right : double and long are two differents animals... Do you see a solution ? LX

        T 1 Reply Last reply
        0
        • L LX 0

          Yes, it's right !!:-O What I want to do is based on STL : ------------------------------------------ typedef struct _MYSTRUCTURE { long lType; long lSubType; }MYSTRUCTURE; typedef std::vector lID; typedef std::map myMap; ------------------------------------------- But when I do a 'find.' on myMap, STL can't find my vector in searching on MYSTRUCTURE 'cause it can't compare : ... ---- MYSTRUCTURE myStructure; myStructure.lType = 10; myStructure.lSubType = 11; myMap::iterator it; it = m_mymap.find(myStructure); ---- So, I wanted to concatenated the 2 longs and using typedef std::map myMap; but, you're right : double and long are two differents animals... Do you see a solution ? LX

          T Offline
          T Offline
          Tomasz Sowinski
          wrote on last edited by
          #4

          Your code got scrambled - you didn't replace < and > with < and > Anyway, using std::pair to keep type and subtype together may be solution for your problem. Tomasz Sowinski -- http://www.shooltz.com

          L 1 Reply Last reply
          0
          • T Tomasz Sowinski

            Your code got scrambled - you didn't replace < and > with < and > Anyway, using std::pair to keep type and subtype together may be solution for your problem. Tomasz Sowinski -- http://www.shooltz.com

            L Offline
            L Offline
            LX 0
            wrote on last edited by
            #5

            oh, sorry for the forgotten < My code was not very aesy to read... Anyway, you're response is very helpful for me :-D !! I think that std::pair will works... Thanks you very much, Tomasz!! LX

            1 Reply Last reply
            0
            • L LX 0

              Do you know if it is possible to create an 64-bit value (double) by concatenating two specified 32-bit values (long)?? The macro MAKELONG exists but MAKEDOUBLE, no...Apparently, it is not possible to make a << on a double?? Do you know a way to do it? Thanks, LX

              M Offline
              M Offline
              Mukkie
              wrote on last edited by
              #6

              try __int64 datatype.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups