{"action":"created","comment":{"url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/comments/41943270","id":41943270,"diff_hunk":"@@ -174,24 +170,62 @@ function /{T<:Real}(a::Interval{T}, b::Interval{T})\n \n         end\n     end\n-    # a * inv(b)\n-    # @round(S, min( a.lo/b.lo, a.lo/b.hi, a.hi/b.lo, a.hi/b.hi ),\n-    #           max( a.lo/b.lo, a.lo/b.hi, a.hi/b.lo, a.hi/b.hi ) )\n end\n \n //(a::Interval, b::Interval) = a / b    # to deal with rationals\n \n \n+## fma: fused multiply-add\n+function fma(a::Interval, b::Interval, c::Interval)\n+    T = promote_type(eltype(a), eltype(b), eltype(c))\n+\n+    (isempty(a) || isempty(b) || isempty(c)) && return emptyinterval(T)\n+\n+    if isentire(a)\n+        b == zero(b) && return c\n+        return entireinterval(T)\n+    elseif isentire(b)\n+        a == zero(a) && return c\n+        return entireinterval(T)\n+    end\n+\n+    lo = with_rounding(T, RoundDown) do\n+        lo1 = fma(a.lo, b.lo, c.lo)\n+        lo2 = fma(a.lo, b.hi, c.lo)\n+        lo3 = fma(a.hi, b.lo, c.lo)\n+        lo4 = fma(a.hi, b.hi, c.lo)\n+        min(lo1, lo2, lo3, lo4)\n+    end\n+    hi = with_rounding(T, RoundUp) do\n+        hi1 = fma(a.lo, b.lo, c.hi)\n+        hi2 = fma(a.lo, b.hi, c.hi)\n+        hi3 = fma(a.hi, b.lo, c.hi)\n+        hi4 = fma(a.hi, b.hi, c.hi)\n+        max(hi1, hi2, hi3, hi4)\n+    end\n+    Interval(lo, hi)\n+end\n+\n+\n ## Scalar functions on intervals (no directed rounding used)\n \n function mag(a::Interval)\n     isempty(a) && return convert(eltype(a), NaN)\n-    max( abs(a.lo), abs(a.hi) )\n+    T = eltype(a)\n+    r1, r2 = with_rounding(T, RoundUp) do\n+        abs(a.lo), abs(a.hi)\n+    end\n+    max( r1, r2 )\n end\n+\n function mig(a::Interval)\n     isempty(a) && return convert(eltype(a), NaN)\n     zero(a.lo) ∈ a && return zero(a.lo)\n-    min(abs(a.lo), abs(a.hi))\n+    T = eltype(a)","path":"src/intervals/arithmetic.jl","position":102,"original_position":102,"commit_id":"9a07de42394fb06b1513a64798efae561c9cda7f","original_commit_id":"9a07de42394fb06b1513a64798efae561c9cda7f","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},"body":"Parametrize the function.","created_at":"2015-10-14T00:18:52Z","updated_at":"2015-10-14T00:18:52Z","html_url":"https://github.com/dpsanders/ValidatedNumerics.jl/pull/56#discussion_r41943270","pull_request_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/56","_links":{"self":{"href":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/comments/41943270"},"html":{"href":"https://github.com/dpsanders/ValidatedNumerics.jl/pull/56#discussion_r41943270"},"pull_request":{"href":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/56","id":45489122,"html_url":"https://github.com/dpsanders/ValidatedNumerics.jl/pull/56","diff_url":"https://github.com/dpsanders/ValidatedNumerics.jl/pull/56.diff","patch_url":"https://github.com/dpsanders/ValidatedNumerics.jl/pull/56.patch","issue_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/issues/56","number":56,"state":"open","locked":false,"title":"Control rounding for many functions","user":{"login":"lbenet","id":5237744,"avatar_url":"https://avatars.githubusercontent.com/u/5237744?v=3","gravatar_id":"","url":"https://api.github.com/users/lbenet","html_url":"https://github.com/lbenet","followers_url":"https://api.github.com/users/lbenet/followers","following_url":"https://api.github.com/users/lbenet/following{/other_user}","gists_url":"https://api.github.com/users/lbenet/gists{/gist_id}","starred_url":"https://api.github.com/users/lbenet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbenet/subscriptions","organizations_url":"https://api.github.com/users/lbenet/orgs","repos_url":"https://api.github.com/users/lbenet/repos","events_url":"https://api.github.com/users/lbenet/events{/privacy}","received_events_url":"https://api.github.com/users/lbenet/received_events","type":"User","site_admin":false},"body":"This is some work to get tighter control of `Interval{Float64}`. It involves work in `make_interval`, in order to get as tight as possible intervals when `@interval(a)` is used. It also includes some handling of `@round`, and work to get the correct behavior of the arithmetic operations and the elementary function.","created_at":"2015-09-20T03:37:48Z","updated_at":"2015-10-14T00:18:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ccd18f4558daeac99c7e4d4a2e02ba38c64dd4e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/56/commits","review_comments_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/56/comments","review_comment_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/issues/56/comments","statuses_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/statuses/9a07de42394fb06b1513a64798efae561c9cda7f","head":{"label":"dpsanders:control_rounding","ref":"control_rounding","sha":"9a07de42394fb06b1513a64798efae561c9cda7f","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},"repo":{"id":24173597,"name":"ValidatedNumerics.jl","full_name":"dpsanders/ValidatedNumerics.jl","owner":{"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},"private":false,"html_url":"https://github.com/dpsanders/ValidatedNumerics.jl","description":"Rigorous floating-point calculations with interval arithmetic in Julia","fork":false,"url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl","forks_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/forks","keys_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/teams","hooks_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/hooks","issue_events_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/issues/events{/number}","events_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/events","assignees_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/assignees{/user}","branches_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/branches{/branch}","tags_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/tags","blobs_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/languages","stargazers_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/stargazers","contributors_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/contributors","subscribers_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/subscribers","subscription_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/subscription","commits_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/contents/{+path}","compare_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/merges","archive_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/downloads","issues_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/issues{/number}","pulls_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/labels{/name}","releases_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/releases{/id}","created_at":"2014-09-18T04:11:59Z","updated_at":"2015-09-10T05:25:04Z","pushed_at":"2015-10-13T15:46:30Z","git_url":"git://github.com/dpsanders/ValidatedNumerics.jl.git","ssh_url":"git@github.com:dpsanders/ValidatedNumerics.jl.git","clone_url":"https://github.com/dpsanders/ValidatedNumerics.jl.git","svn_url":"https://github.com/dpsanders/ValidatedNumerics.jl","homepage":"http://dpsanders.github.io/ValidatedNumerics.jl","size":2244,"stargazers_count":13,"watchers_count":13,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":13,"default_branch":"master"}},"base":{"label":"dpsanders:master","ref":"master","sha":"01eb85e5dd477dec93b50ee892c1dbaee272b997","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},"repo":{"id":24173597,"name":"ValidatedNumerics.jl","full_name":"dpsanders/ValidatedNumerics.jl","owner":{"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},"private":false,"html_url":"https://github.com/dpsanders/ValidatedNumerics.jl","description":"Rigorous floating-point calculations with interval arithmetic in Julia","fork":false,"url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl","forks_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/forks","keys_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/teams","hooks_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/hooks","issue_events_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/issues/events{/number}","events_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/events","assignees_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/assignees{/user}","branches_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/branches{/branch}","tags_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/tags","blobs_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/languages","stargazers_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/stargazers","contributors_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/contributors","subscribers_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/subscribers","subscription_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/subscription","commits_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/contents/{+path}","compare_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/merges","archive_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/downloads","issues_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/issues{/number}","pulls_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/labels{/name}","releases_url":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/releases{/id}","created_at":"2014-09-18T04:11:59Z","updated_at":"2015-09-10T05:25:04Z","pushed_at":"2015-10-13T15:46:30Z","git_url":"git://github.com/dpsanders/ValidatedNumerics.jl.git","ssh_url":"git@github.com:dpsanders/ValidatedNumerics.jl.git","clone_url":"https://github.com/dpsanders/ValidatedNumerics.jl.git","svn_url":"https://github.com/dpsanders/ValidatedNumerics.jl","homepage":"http://dpsanders.github.io/ValidatedNumerics.jl","size":2244,"stargazers_count":13,"watchers_count":13,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/56"},"html":{"href":"https://github.com/dpsanders/ValidatedNumerics.jl/pull/56"},"issue":{"href":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/issues/56"},"comments":{"href":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/dpsanders/ValidatedNumerics.jl/statuses/9a07de42394fb06b1513a64798efae561c9cda7f"}}}}