diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index 80a08c4..f941135 100644
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -1319,7 +1319,7 @@ class FloatNode(ConstNode):
         assert isinstance(strval, basestring)
         cmpval = repr(float(strval))
         if cmpval == 'nan':
-            return "(Py_HUGE_VAL * 0)"
+            return "Py_NAN"
         elif cmpval == 'inf':
             return "Py_HUGE_VAL"
         elif cmpval == '-inf':
