Disparity between Double.NaN() and Double.NaN on macOS and .NET

I have a C# solution with two console projects (macOS Island and Windows .NET) and a shared project. All projects use RTL.

I’m having an issue with this code:

// AsNumber is a double.
if (!Double.TryParse(s, out AsNumber)) {
  AsNumber = Double.NaN;
}

This compiles fine for the .NET project but won’t compile for macOS with the error: Parenthesis required for call. If I add the parenthesis like this:

// AsNumber is a double.
if (!Double.TryParse(s, out AsNumber)) {
  AsNumber = Double.NaN();
}

It compiles for macOS but not for .NET with the error: “const” is used as a method’.

Do I need to wrap this code with OS-specific #if statements? I thought RTL would be able to figure this out but it looks like it can’t pick between NaN and NaN().

yeah, I probably should change this to a property:

    class method NAN: Single;

Done in https://github.com/remobjects/islandrtl

Now that’s service!

Out of interest, when you patch an RTL library - when does it make the preview channel of the IDE? Is it weekly?

1 Like

Yes, we usually merge it right away, so Friday’s build will have it.

1 Like