News for hackers. Stuff that matters.
Re:Go 1.13 Release Notes by mseepgood on Tuesday September 03, 2019 @04:31PM (#20870856)
> From 10000000 to 10_000_000 is such a readability improvement and should be no-cost.

1e7

Re:Go 1.13 Release Notes by masklinn on Wednesday September 04, 2019 @02:08AM (#20874453)
> 1e7

Is a float literal.

Re:Go 1.13 Release Notes by majewsky on Wednesday September 04, 2019 @04:43AM (#20875208)
Not in Go. Number literals don't have a type until they're assigned to a variable or used in a place that implies a type (e.g. a function argument). For example, the following is valid:

  var u uint32 = 10000000000.0 / 100000
even though 10000000000 overflows uint32 and it's also written like a floating-point literal.
Re:Go 1.13 Release Notes by masklinn on Wednesday September 04, 2019 @05:18AM (#20875382)
> Not in Go.

Yes in go. `var u = 1e7` gives a float. That means 1e7 is a float literal. You can coerce it to an integer by explicitly typing the target, but it's still a float literal.

Re:Go 1.13 Release Notes by yencabulator on Thursday September 12, 2019 @02:11PM (#20954505)
`1e7` is an untyped numeric constant with a default type of float64.

https://blog.golang.org/constants

https://golang.org/ref/spec#Constants

Re:Go 1.13 Release Notes by lacampbell on Tuesday September 03, 2019 @07:34PM (#20872480)
Mysterious hacker news downvoting! This my preferred way of writing numbers with lots of 0s as well.
Re:Go 1.13 Release Notes by rbonvall on Tuesday September 03, 2019 @09:15PM (#20873083)
But underscores also work for numbers that don't have lot of zeros. Compare:

    12_345_678
    1.2345678e7
Re:Go 1.13 Release Notes by lacampbell on Tuesday September 03, 2019 @11:43PM (#20873816)
good point.

Kind of realising how much of my daily work could use bytes as the main numeric type