{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/10040","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/10040/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/10040/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/10040/events","html_url":"https://github.com/JuliaLang/julia/issues/10040","id":56316693,"number":10040,"title":"How to handle the precision of `BigFloat`s","user":{"login":"dpsanders","id":191822,"avatar_url":"https://avatars.githubusercontent.com/u/191822?v=3","gravatar_id":"","url":"https://api.github.com/users/dpsanders","html_url":"https://github.com/dpsanders","followers_url":"https://api.github.com/users/dpsanders/followers","following_url":"https://api.github.com/users/dpsanders/following{/other_user}","gists_url":"https://api.github.com/users/dpsanders/gists{/gist_id}","starred_url":"https://api.github.com/users/dpsanders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpsanders/subscriptions","organizations_url":"https://api.github.com/users/dpsanders/orgs","repos_url":"https://api.github.com/users/dpsanders/repos","events_url":"https://api.github.com/users/dpsanders/events{/privacy}","received_events_url":"https://api.github.com/users/dpsanders/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/maths","name":"maths","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2015-02-03T00:40:04Z","updated_at":"2015-08-02T09:34:53Z","closed_at":null,"body":"Currently, the precision of `BigFloat`s is determined by a global variable stored in an array `DEFAULT_PRECISION`, which is manipulated by `set_bigfloat_precision`.\r\n\r\nThis is not very Julian. I have been thinking about two possibilities:\r\n\r\n1. The precision is given explicitly, e.g. as a second argument to the various `BigFloat` constructors and to the `big` function, e.g. \r\n\r\n    a = BigFloat(3.1, 100)\r\n    b = big(3.1, 200)\r\n\r\nHere, though, the precision is still hidden inside the object.\r\n\r\n2. An arguably more Julian approach, which I would favour, is that the precision be a parameter of the  `BigFloat{prec}` type, so that we could write\r\n\r\n    a = BigFloat{100}(3.1)\r\n    b = BigFloat{200}(3.1)\r\n\r\nThis version would have the advantage that operations on `BigFloat`s could explicitly track the precision of the objects being operated on (which MPFR explicitly states that it does not do). E.g., `a + b` in this example should have only 100 bits. (If I understand correctly, with MPFR there is the possibility to specify any precision for the result, but bits beyond 100 will be incorrect.)\r\n\r\nIf there is a consensus about whether either of these would be useful, or am I missing a reason why this would not be possible?\r\n\r\nc.c. @simonbyrne, @andrioni, @lbenet\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/127006244","html_url":"https://github.com/JuliaLang/julia/issues/10040#issuecomment-127006244","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/10040","id":127006244,"user":{"login":"ViralBShah","id":744411,"avatar_url":"https://avatars.githubusercontent.com/u/744411?v=3","gravatar_id":"","url":"https://api.github.com/users/ViralBShah","html_url":"https://github.com/ViralBShah","followers_url":"https://api.github.com/users/ViralBShah/followers","following_url":"https://api.github.com/users/ViralBShah/following{/other_user}","gists_url":"https://api.github.com/users/ViralBShah/gists{/gist_id}","starred_url":"https://api.github.com/users/ViralBShah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ViralBShah/subscriptions","organizations_url":"https://api.github.com/users/ViralBShah/orgs","repos_url":"https://api.github.com/users/ViralBShah/repos","events_url":"https://api.github.com/users/ViralBShah/events{/privacy}","received_events_url":"https://api.github.com/users/ViralBShah/received_events","type":"User","site_admin":false},"created_at":"2015-08-02T09:34:53Z","updated_at":"2015-08-02T09:34:53Z","body":"I feel that the burden on the type system and compiler is unlikely to be too much for most use cases, where one may have at best, a few different precisions. "}}