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. some thing is strang in double type

some thing is strang in double type

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
3 Posts 2 Posters 1 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.
  • A Offline
    A Offline
    Ahmad
    wrote on last edited by
    #1

    HI ALL :) I want make simple calculator so I get some problems like : - try do that : double d1 = 5/3 ; //same (5/3) double d2 = 3/2 ; and you get this result (1) when you do that in Calculator program(by Microsft) the result is (1.6666666666666666666666666666667) and (1.5) the problem here the value after the point didn't appeare I tried by VISUAL C++6 using (CEDIT box) - next problem ,when you try to show larg number in (CEDIT box) the CEDIT box show the number with (e+) like(8.98765431209876e+016) how I can disable or enable this(e+) THANK YOU AHMAD ALWASHALI

    M 1 Reply Last reply
    0
    • A Ahmad

      HI ALL :) I want make simple calculator so I get some problems like : - try do that : double d1 = 5/3 ; //same (5/3) double d2 = 3/2 ; and you get this result (1) when you do that in Calculator program(by Microsft) the result is (1.6666666666666666666666666666667) and (1.5) the problem here the value after the point didn't appeare I tried by VISUAL C++6 using (CEDIT box) - next problem ,when you try to show larg number in (CEDIT box) the CEDIT box show the number with (e+) like(8.98765431209876e+016) how I can disable or enable this(e+) THANK YOU AHMAD ALWASHALI

      M Offline
      M Offline
      markkuk
      wrote on last edited by
      #2

      > double d1 = 5/3 ; The calculation 5/3 is done with integer values, so the result is 1. If you want a double result, convert the operands to double _before_ the calculation: double d1 = 5.0/3.0;

      A 1 Reply Last reply
      0
      • M markkuk

        > double d1 = 5/3 ; The calculation 5/3 is done with integer values, so the result is 1. If you want a double result, convert the operands to double _before_ the calculation: double d1 = 5.0/3.0;

        A Offline
        A Offline
        Ahmad
        wrote on last edited by
        #3

        Thank you very much :) AHMAD ALWASHALI

        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