cmd/gc: compiler must not accept p-notation floats in regular Go code
griesemer opened this issue · 12 comments
gc accepts the p-notation for floating point numbers: mantissa "p" exponent such as 12p-2, etc. http://play.golang.org/p/xOixorUxUD The spec doesn't mention them. gccgo and go/types don't support them. a) we should either disallow them, or b) we should support them with consistent syntax and document them.
I can go either way but I would be ok supporting them. If we do, I propose one of these productions: pfloat_lit = int_lit ( "p" | "P" ) [ "+" | "-" ] decimals . or pfloat_lit = decimal_lit ( "p" | "P" ) [ "+" | "-" ] decimals . i.e., if we permit non-decimal mantissa, we should permit any integer notation.
There are several related errors:
http://play.golang.org/p/VVK5tF24e2
- p exponent
- hex mantissa and p exponent
- hex mantissa and e exponent interpreted as int
What is this "export data"? I've been trying to figure out the conditions under which 'p' and 'P' etc should not be rejected?
"Export data" is the textual (go-syntax like) representation of the package "objects" that are exported from the package. The export data of a package A is parsed when another package B imports A. The export data can be found in the object/archive file.
The p-format is used to read and write floating-point numbers quickly and accurately without the need to convert to a decimal exponent.
@dr2chase see also the go/internal/gcimporter package and cmd/compile/internal/gc/export.go
CL https://golang.org/cl/10450 mentions this issue.