-
Notifications
You must be signed in to change notification settings - Fork 224
Open
Labels
Description
VB.Net input code
Imports System
Public Class A
Public Shared Sub Main()
Dim foo = 0.6
Dim bar = CInt(Math.Truncate(foo))
Dim baz = CInt(Math.Ceiling(foo))
Console.WriteLine(bar)
Console.WriteLine(baz)
End Sub
End Class
Erroneous output
using System;
public partial class A
{
public static void Main()
{
double foo = 0.6d;
int bar = (int)Math.Round(Math.Truncate(foo));
int baz = (int)Math.Round(Math.Ceiling(foo));
Console.WriteLine(bar);
Console.WriteLine(baz);
}
}
Extra verbose Math.Round
Expected output
using System;
public partial class A
{
public static void Main()
{
double foo = 0.6d;
int bar = (int)foo;
int baz = (int)Math.Ceiling(foo);
Console.WriteLine(bar);
Console.WriteLine(baz);
}
}
Decimal
is not optimized by the latest VB compiler but I think it can be.
CInt(Decimal)
→ System.Convert.ToInt32
(similar as (int)Math.Round
)
Details
- Product in use: online
- Version in use: e.g. 5.6.3 or a commit hash (if it's a 3rd party tool using this library, try one of the above)
- Did you see it working in a previous version, which? No
- Any other relevant information to the issue, or your interest in contributing a fix.