Page MenuHomeFeedback Tracker

NaN float assignment results in 0 value
Closed, ResolvedPublic

Description

The following code should produce "nan" but on assignment of a const nan float it defaults to "0".

class TAG_Const
{
	const float FloatNan = "nan".ToFloat();
}
float test = TAG_Const.FloatNan;

SCRIPT : float test = 0

Using the right-hand side assignment with the instructions to build nan directly however works.

float test = "nan".ToFloat();

SCRIPT : float test = nan

It also works when using a non const variant.

class TAG_Static
{
	static float FloatNan = "nan".ToFloat();
}
float test = TAG_Static.FloatNan;

SCRIPT : float test = nan

However even when only using static, it fails as a default function parameter

void testfnc(float test = TAG_Static.FloatNan)
{
	Print(test);
}

SCRIPT : float test = 0

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

Arkensor updated the task description. (Show Details)Mar 31 2023, 12:59 PM
Geez changed the task status from New to Assigned.Apr 4 2023, 11:46 AM
Geez closed this task as Resolved.Apr 12 2023, 12:12 PM
Geez claimed this task.
Geez added a subscriber: Geez.

Fixed for 0.9.8