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. what is the difference between definition numeric value 0.0, .0, 0.?

what is the difference between definition numeric value 0.0, .0, 0.?

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 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.
  • U Offline
    U Offline
    User 12492263
    wrote on last edited by
    #1

    Can anyone explain me what is the difference in determination value? double a = 0.0; double a = .0; double a = 0.;

    L 1 Reply Last reply
    0
    • U User 12492263

      Can anyone explain me what is the difference in determination value? double a = 0.0; double a = .0; double a = 0.;

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      No difference, they all represent the value 0.00, they are just different ways of writing it in source code. You could easily have found this out by writing a small program and stepping through it with your debugger.

      U 1 Reply Last reply
      0
      • L Lost User

        No difference, they all represent the value 0.00, they are just different ways of writing it in source code. You could easily have found this out by writing a small program and stepping through it with your debugger.

        U Offline
        U Offline
        User 12492263
        wrote on last edited by
        #3

        Does exist any document or standard how correct use it forms?

        J L 2 Replies Last reply
        0
        • U User 12492263

          Does exist any document or standard how correct use it forms?

          J Offline
          J Offline
          Jochen Arndt
          wrote on last edited by
          #4

          It is defined in the C++ standard available at https://isocpp.org/std/the-standard[^] (the current draft can be downloaded as PDF; see there 2.13.4 Floating literals). Instead of reading the standard it is often sufficient to read a C++ online reference like floating point literal - cppreference.com[^] because those are not so hard to read as the standard and contain examples.

          1 Reply Last reply
          0
          • U User 12492263

            Does exist any document or standard how correct use it forms?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Sorry, what do you mean by 'correct'? All the examples are correct, in that they declare the value as zero.

            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