Repository: hylang/hy

Issue:
1e1000 should not be a symbol
Hy counts `1e308` as a floating-point number, but `2e308` as a symbol. 
```Python
=> (type 1e308)
type(1e+308)

<class 'float'>
=> (type 2e308)
type(2e308)

Traceback (most recent call last):
  File "c:\users\me\documents\github\hy\hy\importer.py", line 201, in hy_eval
    return eval(ast_compile(expr, "<eval>", "eval"), namespace)
  File "<eval>", line 1, in <module>
NameError: name '2e308' is not defined
```

This is inconsistent. Float literals that are too large should be `inf`, because that's how Python does it.
```Python
>>> 1.7e308
1.7e+308
>>> 1.8e308
inf
```

Discussion:

Patch:
diff --git a/hy/models.py b/hy/models.py
index 3a769e86..fda7789f 100644
--- a/hy/models.py
+++ b/hy/models.py
@@ -179,7 +179,7 @@ if not PY3:  # do not add long on python3
 
 def check_inf_nan_cap(arg, value):
     if isinstance(arg, string_types):
-        if isinf(value) and "Inf" not in arg:
+        if isinf(value) and "i" in arg.lower() and "Inf" not in arg:
             raise ValueError('Inf must be capitalized as "Inf"')
         if isnan(value) and "NaN" not in arg:
             raise ValueError('NaN must be capitalized as "NaN"')


Test patch:
diff --git a/tests/test_lex.py b/tests/test_lex.py
index bdb412a1..6efeb605 100644
--- a/tests/test_lex.py
+++ b/tests/test_lex.py
@@ -103,6 +103,12 @@ def test_lex_expression_float():
     assert objs == [HyExpression([HySymbol("foo"), HyFloat(1.e7)])]
 
 
+def test_lex_big_float():
+    # https://github.com/hylang/hy/issues/1448
+    assert tokenize("1e900") == [HyFloat(1e900)]
+    assert tokenize("1e900-1e900j") == [HyComplex(1e900, -1e900)]
+
+
 def test_lex_nan_and_inf():
 
     assert isnan(tokenize("NaN")[0])