String encodeNumber(num n) { if (n.isNaN) return "'nan'"; if (n == double.infinity) return "'infinity'"; if (n == double.negativeInfinity) return "'-infinity'"; return n.toString(); }