From adcc211feb7827127b2548c791f2de0b6efda3d3 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Tue, 14 Feb 2017 04:10:02 +0100 Subject: Make nan==nan true for GDScript After discussing this with Reduz this seemed like the best way to fix #7354. This will make composite values that contain NaN in the same places as well as the same other values compare as the same. Additionally non-composite values now also compare equal if they are both NaN. This breaks IEEE specifications but this is probably what most users expect. There is a GDScript function check for NaN if the user needs this information. This fixes #7354 and probably also fixes #6947 --- core/math/plane.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core/math/plane.cpp') diff --git a/core/math/plane.cpp b/core/math/plane.cpp index 2a9793204..0d446059c 100644 --- a/core/math/plane.cpp +++ b/core/math/plane.cpp @@ -164,3 +164,8 @@ Plane::operator String() const { return normal.operator String() + ", " + rtos(d); } + +bool Plane::nan_equals(const Plane& p_plane) const { + + return normal.nan_equals(p_plane.normal) && d == p_plane.d; +} -- cgit v1.2.3-70-g09d2