Skip to content

Mono incorrectly handles floating-point conversions on 64-bit #69795

@tannergooding

Description

@tannergooding

#69756 has several failures that occur across Mono:

Assert.Throws<OverflowException>(() => NumberBaseHelper<long>.CreateChecked<float>(+9223372036854775808.0f));

Assert.Throws<OverflowException>(() => NumberBaseHelper<ulong>.CreateChecked<double>(+18446744073709551616.0));

In both cases the double and float used is the smallest representable double that is greater than long.MaxValue or ulong.MaxValue, respectively, and therefore it should always overflow.

However, Mono doesn't throw System.OverflowException instead. The same tests exist for x86/x64 where things are passing as expected.


#70087 likewise shows issues with conversion of float/double to nuint (System.UIntPtr) where it appears to always be treating the target type as 32-bits, even on 64-bit systems.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions