You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any constant or literal Double should be convertible to Long at compile time if its value is within the range of the Long data type (approximately ±9.223E+18). However, if the value is a large positive number between &H7000000000000400L and &H7FFFFFFFFFFFFC00L, then the error "BC30439: Constant expression not representable in type 'Long'." occurs:
Console.WriteLine(CType(9.0E+18,Long))' ~~~~~~~Console.WriteLine(CType(CDbl(&H7000000000000400L),Long))' ~~~~~~~~~~~~~~~~~~~~~~~~~Console.WriteLine(CType(CDbl(&H7FFFFFFFFFFFFC00L),Long))' ~~~~~~~~~~~~~~~~~~~~~~~~~' Expected behavior: No errors.' Actual behavior: Error BC30439 is reported on each line as indicated.
This bug does not affect Double values in the range &H8000000000000000L (Long.MinValue) through &H7000000000000000L:
Console.WriteLine(CType(-9.0E+18,Long))' -9000000000000000000Console.WriteLine(CType(CDbl(&H8000000000000000L),Long))' -9223372036854775808Console.WriteLine(CType(CDbl(&H8000000000000400L),Long))' -9223372036854774784Console.WriteLine(CType(CDbl(&H8FFFFFFFFFFFFC00L),Long))' -8070450532247929856Console.WriteLine(CType(CDbl(&H9000000000000000L),Long))' -8070450532247928832Console.WriteLine(CType(CDbl(&H7000000000000000L),Long))' 8070450532247928832' Expected and actual behavior: No errors.
This bug also does not affect run-time conversions:
Dima=9.0E+18Dimb=CDbl(&H7000000000000400L)Dimc=CDbl(&H7FFFFFFFFFFFFC00L)Console.WriteLine(CType(a,Long))' 9000000000000000000Console.WriteLine(CType(b,Long))' 8070450532247929856Console.WriteLine(CType(c,Long))' 9223372036854774784' Expected and actual behavior: No errors.
It looks like this bug affects all versions of the VB.NET compiler, including pre-Roslyn versions like C:\Windows\Microsoft.NET\Framework\v2.0.50727\vbc.exe.
This bug does not affect the C# compiler.
The text was updated successfully, but these errors were encountered:
Any constant or literal
Double
should be convertible toLong
at compile time if its value is within the range of theLong
data type (approximately ±9.223E+18). However, if the value is a large positive number between&H7000000000000400L
and&H7FFFFFFFFFFFFC00L
, then the error"BC30439: Constant expression not representable in type 'Long'."
occurs:This bug does not affect
Double
values in the range&H8000000000000000L
(Long.MinValue
) through&H7000000000000000L
:This bug also does not affect run-time conversions:
It looks like this bug affects all versions of the VB.NET compiler, including pre-Roslyn versions like C:\Windows\Microsoft.NET\Framework\v2.0.50727\vbc.exe.
This bug does not affect the C# compiler.
The text was updated successfully, but these errors were encountered: