[m-rev.] for review: encode invariants in types when creating constant structures

Julien Fischer jfischer at opturion.com
Thu Mar 29 12:51:48 AEDT 2018



On Thu, 29 Mar 2018, Zoltan Somogyi wrote:

> BTW, I have an unrelated observation about the above code:
> the .m file says "3.3", while the .c file says "3.2999999999999998".
> This shows that float constants get to go through decimal to binary
> conversion *twice*, when once should be enough, and would yield
> more accurate results. Maybe we should consider a lossless
> representation, such as strings, for floats in the lexer.

IMO, there's no consideration necessary it should be a loseless
representation, although probably with more structure than a string.
(At some point we need to support hexadecimal float constants too.)

Currently the we violate the first law of compiling floating
point code (i.e. leave it alone) far too much.

Julien.


More information about the reviews mailing list