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. Visual Basic
  4. vb.net 2003 Editor typing problem

vb.net 2003 Editor typing problem

Scheduled Pinned Locked Moved Visual Basic
csharphelptutorialquestion
9 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.
  • V Offline
    V Offline
    Vinicius Pontes
    wrote on last edited by
    #1

    Hi, In my vb.net editor, when I type a double number like 6.35, it automatically is converted to 6.3499999999999996 when I leave the line I am typing. Can anyone tell me why it happens and how to avoid it?:confused: Thanks in advance, Vinicius

    D 1 Reply Last reply
    0
    • V Vinicius Pontes

      Hi, In my vb.net editor, when I type a double number like 6.35, it automatically is converted to 6.3499999999999996 when I leave the line I am typing. Can anyone tell me why it happens and how to avoid it?:confused: Thanks in advance, Vinicius

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      This is because of how numbers are stored internally by the system. There's no way to avoid it. Although, I'm not seeing the problem you're describing using Single or Double types. Can we see the code this is happening in?

      Dave Kreskowiak Microsoft MVP - Visual Basic

      V 2 Replies Last reply
      0
      • D Dave Kreskowiak

        This is because of how numbers are stored internally by the system. There's no way to avoid it. Although, I'm not seeing the problem you're describing using Single or Double types. Can we see the code this is happening in?

        Dave Kreskowiak Microsoft MVP - Visual Basic

        V Offline
        V Offline
        Vinicius Pontes
        wrote on last edited by
        #3

        The code is simple: Dim myVar as double myVar = 6.35 after typing 6.35, the editor changes it to Dim myVar as double myVar = 6.3499999999999996 I understand it can be stored like that internally. What I don't understand is why in some projects it doesn't happen. Another problem I see is that if I try to use the "Text Find" resource in my project, to find a string like 6.35 I will never locate it, so why couldn't the editor leave my numbers exactlly as they are typed? The program I'm writing is working perfect, although these editor's changes, but it doesn't make me happy.:sigh: Vinicius

        1 Reply Last reply
        0
        • D Dave Kreskowiak

          This is because of how numbers are stored internally by the system. There's no way to avoid it. Although, I'm not seeing the problem you're describing using Single or Double types. Can we see the code this is happening in?

          Dave Kreskowiak Microsoft MVP - Visual Basic

          V Offline
          V Offline
          Vinicius Pontes
          wrote on last edited by
          #4

          I found out that if the number has only one dacimal value, nothing changes: Dim myVar as double myVar = 6.3 So, again, why? :confused::confused::confused:

          G D 2 Replies Last reply
          0
          • V Vinicius Pontes

            I found out that if the number has only one dacimal value, nothing changes: Dim myVar as double myVar = 6.3 So, again, why? :confused::confused::confused:

            G Offline
            G Offline
            Guerven
            wrote on last edited by
            #5

            do you save the values as strings:confused:? just a Q.

            U Xux

            V 1 Reply Last reply
            0
            • V Vinicius Pontes

              I found out that if the number has only one dacimal value, nothing changes: Dim myVar as double myVar = 6.3 So, again, why? :confused::confused::confused:

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              I coudln't tell you what's causing it or how to "fix" it because I've never run into the problem. There's no mention of it in the MS Knowledge Base, that I could find anyway. Have you installed SP1[^] for .NET 1.1?

              Dave Kreskowiak Microsoft MVP - Visual Basic

              V 1 Reply Last reply
              0
              • G Guerven

                do you save the values as strings:confused:? just a Q.

                U Xux

                V Offline
                V Offline
                Vinicius Pontes
                wrote on last edited by
                #7

                No, they are all double

                1 Reply Last reply
                0
                • D Dave Kreskowiak

                  I coudln't tell you what's causing it or how to "fix" it because I've never run into the problem. There's no mention of it in the MS Knowledge Base, that I could find anyway. Have you installed SP1[^] for .NET 1.1?

                  Dave Kreskowiak Microsoft MVP - Visual Basic

                  V Offline
                  V Offline
                  Vinicius Pontes
                  wrote on last edited by
                  #8

                  I'll try SP1 Thanks

                  V 1 Reply Last reply
                  0
                  • V Vinicius Pontes

                    I'll try SP1 Thanks

                    V Offline
                    V Offline
                    Vinicius Pontes
                    wrote on last edited by
                    #9

                    I was already using SP1.

                    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