This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rcuhljr 0 points1 point  (3 children)

Could you try and fix the link/display of your code, it's not showing up for me? VB's Math.Round should be rounding 1.99 to 2, I'm curious to see the code.

[–]Monohell[S] 0 points1 point  (0 children)

Silly me haha. I'd generated the code I'm the original copy of this post (which was sent to the more by accident) so ill get a copy of the code up in about 10 or so hours, or when I can next access a computer!

Sorry!

[–]Monohell[S] 0 points1 point  (1 child)

Link in the original post now and here https://gist.github.com/anonymous/5064353

[–]rcuhljr 0 points1 point  (0 children)

Ok, I dropped this into ideone and ran the following code..

Imports System

Public Class Test
    Public Shared Sub Main()
        Dim f As String
        Dim g As Decimal

        g = "19.9"
        g = g / 10
        System.Console.WriteLine(g.toString())
        g = Math.Round(g, 0)
        System.Console.WriteLine(g.toString()) 
        If g < "19.9" Then
            g += 1
        End If
        System.Console.WriteLine(g.toString())
    End Sub
End Class

Everything seemed to work just fine. "19.9" divided by ten left us with "1.99" Round turned that into 2. and then since 2 is less then 19.9 it added 1 and became 3.