def compile_time_value(self, denv):
return float(self.value)
+
+ def calculate_result_code(self):
+ strval = str(self.value)
+ if strval == 'nan':
+ return "NAN"
+ elif strval == 'inf':
+ return "INFINITY"
+ elif strval == '-inf':
+ return "(-INFINITY)"
+ else:
+ return strval
class StringNode(ConstNode):
666
>>> f()
12.5
+ >>> nan()
+ nan
+ >>> infp()
+ inf
+ >>> infn()
+ -inf
>>> s()
'spam'
>>> two()
DEF INT3 = 042
DEF LONG = 666L
DEF FLOAT = 12.5
+DEF FLOAT_NAN = float('nan')
+DEF FLOAT_INFP = float('+inf')
+DEF FLOAT_INFN = float('-inf')
DEF STR = "spam"
DEF TWO = TUPLE[1]
DEF FIVE = TWO + 3
f = FLOAT
return f
+def nan():
+ cdef float f
+ f = FLOAT_NAN
+ return f
+
+def infp():
+ cdef float f
+ f = FLOAT_INFP
+ return f
+
+def infn():
+ cdef float f
+ f = FLOAT_INFN
+ return f
+
def s():
cdef char *s
s = STR