Whew. This is more complicated than I expected, but honestly I don't
see another way around it. It would be nice if Lua would do the right
thing out of the box, but there's nothing we can do about that.
I have some ideas about what fennel.view should do with infinity,
because I don't think the current behavior is correct, but that's a
different concern and doesn't need to block this.
I'll go ahead and apply and push your changes; thanks for your help with
this!
-Phil

From: Andrey Listopadov <andreyorst@gmail.com>
In Lua, numbers bigger than 1e+308 compile to inf. Prior to this
patch, Fennel compiled such numbers to inf too. However, inf is not
a number in Lua, neither it is a reserved symbol, so the expression
(+ 1e+309 1) would compile to (inf + 1) resulting in attempt to add
nil with a number, because Lua treats inf as a regular, unbound,
variable.
This patch also tries to keep the number format of big numbers, bigger
than 1e+13 and less than 1e+309 in the e-notation. Numbers less than
1e+14 are formatted as integers, as done in PUC Lua. Starting from
1e+14 the e-notation is used.
If the number is big enough to be considered inf by Lua, it is
compiled to (1/0), a portable way to express infinity, without relying
on the existence of the math table. -inf is compiled to (-1/0).

fennel/patches/.build.yml: SUCCESS in 31s
[Fix huge numbers NPE, make best effort at keeping original integer format][0] v3 from [][1]
[0]: https://lists.sr.ht/~technomancy/fennel/patches/54452
[1]: mailto:andreyorst@gmail.com
✓ #1302536 SUCCESS fennel/patches/.build.yml https://builds.sr.ht/~technomancy/job/1302536