{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/15543","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/15543/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/15543/comments","events_url":"https://api.github.com/repos/golang/go/issues/15543/events","html_url":"https://github.com/golang/go/issues/15543","id":153096255,"number":15543,"title":"cmd/compile: precalculate constant square roots","user":{"login":"josharian","id":67496,"avatar_url":"https://avatars.githubusercontent.com/u/67496?v=3","gravatar_id":"","url":"https://api.github.com/users/josharian","html_url":"https://github.com/josharian","followers_url":"https://api.github.com/users/josharian/followers","following_url":"https://api.github.com/users/josharian/following{/other_user}","gists_url":"https://api.github.com/users/josharian/gists{/gist_id}","starred_url":"https://api.github.com/users/josharian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josharian/subscriptions","organizations_url":"https://api.github.com/users/josharian/orgs","repos_url":"https://api.github.com/users/josharian/repos","events_url":"https://api.github.com/users/josharian/events{/privacy}","received_events_url":"https://api.github.com/users/josharian/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/golang/go/labels/Performance","name":"Performance","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/38","html_url":"https://github.com/golang/go/milestones/Go1.8","labels_url":"https://api.github.com/repos/golang/go/milestones/38/labels","id":1709363,"number":38,"title":"Go1.8","description":"","creator":{"login":"griesemer","id":8528975,"avatar_url":"https://avatars.githubusercontent.com/u/8528975?v=3","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"open_issues":468,"closed_issues":91,"state":"open","created_at":"2016-04-15T16:30:23Z","updated_at":"2016-08-21T18:33:18Z","due_on":"2017-02-01T08:00:00Z","closed_at":null},"comments":17,"created_at":"2016-05-04T19:34:36Z","updated_at":"2016-08-22T15:34:32Z","closed_at":null,"body":"Low priority, but probably also an easy ssa rule.\r\n\r\n```go\r\npackage x\r\n\r\nimport \"math\"\r\n\r\nfunc root2() float64 {\r\n\treturn math.Sqrt(2)\r\n}\r\n```\r\n\r\nyields (amd64):\r\n\r\n```\r\n\"\".root2 t=1 size=32 args=0x8 locals=0x0\r\n\t0x0000 00000 (/Volumes/Data/src/go.tip/src/sqrt.go:5)\tTEXT\t\"\".root2(SB), $0-8\r\n\t0x0000 00000 (/Volumes/Data/src/go.tip/src/sqrt.go:5)\tNOP\r\n\t0x0000 00000 (/Volumes/Data/src/go.tip/src/sqrt.go:5)\tNOP\r\n\t0x0000 00000 (/Volumes/Data/src/go.tip/src/sqrt.go:5)\tFUNCDATA\t$0, gclocals·5184031d3a32a42d85027f073f873668(SB)\r\n\t0x0000 00000 (/Volumes/Data/src/go.tip/src/sqrt.go:5)\tFUNCDATA\t$1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)\r\n\t0x0000 00000 (/Volumes/Data/src/go.tip/src/sqrt.go:6)\tMOVSD\t$f64.4000000000000000(SB), X0\r\n\t0x0008 00008 (/Volumes/Data/src/go.tip/src/sqrt.go:6)\tSQRTSD\tX0, X0\r\n\t0x000c 00012 (/Volumes/Data/src/go.tip/src/sqrt.go:6)\tMOVSD\tX0, \"\".~r0+8(FP)\r\n\t0x0012 00018 (/Volumes/Data/src/go.tip/src/sqrt.go:6)\tRET\r\n```\r\n\r\nBut sqrt(2) is a constant.\r\n\r\ncc @randall77 @brtzsnr \r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/241452517","html_url":"https://github.com/golang/go/issues/15543#issuecomment-241452517","issue_url":"https://api.github.com/repos/golang/go/issues/15543","id":241452517,"user":{"login":"griesemer","id":8528975,"avatar_url":"https://avatars.githubusercontent.com/u/8528975?v=3","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"created_at":"2016-08-22T15:34:32Z","updated_at":"2016-08-22T15:34:32Z","body":"@minux I may not recall this correctly, but I believe we deliberately didn't specify it.\r\n\r\nI suspect this is mostly for historical reasons (in the distant past, not every architecture had IEEE floating-point support, say the Cray machines) - and languages wouldn't want to exclude themselves from being \"correctly\" implementable. Now any relevant hardware supports IEEE floats, so perhaps it's ok to request it (we already refer to the standard in the spec. But I doubt it makes a difference in practice, so why risk it?\r\n\r\nRelated, Java took a big floating-point performance hit in the 90's because it specified floating-point details such as rounding in very much detail: on x87 hardware, intermediate results not stored to memory where held in 80bit registers which lead to different results because rounding was not done to 64bits. As a result, a -strict interpretation of Java floating-point operations required that each intermediate result be stored to memory to achieve correct rounding. Intel was not happy about that (it made their chips look slower than others) - hence it was a JVM option.\r\n"}}
{"actor":{"display_login":"griesemer"}}