Skip to content

Mono incorrectly handles nuint to floating-point conversions #69794

@tannergooding

Description

@tannergooding

#69756 has several failures that occur across Mono:

Assert.Equal(unchecked((nuint)0xFFFF_FFFF_FFFF_F800), NumberBaseHelper<nuint>.CreateChecked<double>(+18446744073709549568.0));

Assert.Equal(unchecked((nuint)0xFFFF_FF00_0000_0000), NumberBaseHelper<nuint>.CreateChecked<float>(+18446742974197923840.0f));

In both cases the double and float used is the smallest representable double that is less than ulong.MaxValue and therefore it should always succeed.

However, Mono incorrectly throws System.OverflowException instead. The same tests exist for ulong where things are passing as expected.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions