{"action":"created","comment":{"url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/comments/232238177","pull_request_review_id":173391240,"id":232238177,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjIzODE3Nw==","diff_hunk":"@@ -2142,6 +2303,11 @@ private static void execTypeConversionOpcodes(WorkerExecutionContext ctx, Worker\n                 j = operands[1];\n                 sf.intRegs[j] = sf.doubleRegs[i] != 0.0 ? 1 : 0;\n                 break;\n+            case InstructionCodes.F2D:\n+                i = operands[0];\n+                j = operands[1];\n+                sf.refRegs[j] = new BDecimal(new BFloat(sf.doubleRegs[i]).decimalValue());","path":"bvm/ballerina-core/src/main/java/org/ballerinalang/bre/bvm/CPU.java","position":null,"original_position":404,"commit_id":"ce04700e201f126a7a8feb55974d61a42b727a05","original_commit_id":"90edf10b1294b97f3352cc4ac7c807627c9df1da","user":{"login":"pranavan15","id":15685415,"node_id":"MDQ6VXNlcjE1Njg1NDE1","avatar_url":"https://avatars0.githubusercontent.com/u/15685415?v=4","gravatar_id":"","url":"https://api.github.com/users/pranavan15","html_url":"https://github.com/pranavan15","followers_url":"https://api.github.com/users/pranavan15/followers","following_url":"https://api.github.com/users/pranavan15/following{/other_user}","gists_url":"https://api.github.com/users/pranavan15/gists{/gist_id}","starred_url":"https://api.github.com/users/pranavan15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pranavan15/subscriptions","organizations_url":"https://api.github.com/users/pranavan15/orgs","repos_url":"https://api.github.com/users/pranavan15/repos","events_url":"https://api.github.com/users/pranavan15/events{/privacy}","received_events_url":"https://api.github.com/users/pranavan15/received_events","type":"User","site_admin":false},"body":"Addressed with commit ce04700.","created_at":"2018-11-09T12:35:35Z","updated_at":"2018-11-09T12:35:35Z","html_url":"https://github.com/ballerina-platform/ballerina-lang/pull/11034#discussion_r232238177","pull_request_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/11034","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/comments/232238177"},"html":{"href":"https://github.com/ballerina-platform/ballerina-lang/pull/11034#discussion_r232238177"},"pull_request":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/11034"}},"in_reply_to_id":232223744},"pull_request":{"url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/11034","id":226108796,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2MTA4Nzk2","html_url":"https://github.com/ballerina-platform/ballerina-lang/pull/11034","diff_url":"https://github.com/ballerina-platform/ballerina-lang/pull/11034.diff","patch_url":"https://github.com/ballerina-platform/ballerina-lang/pull/11034.patch","issue_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/11034","number":11034,"state":"open","locked":false,"title":"Add decimal type support","user":{"login":"pranavan15","id":15685415,"node_id":"MDQ6VXNlcjE1Njg1NDE1","avatar_url":"https://avatars0.githubusercontent.com/u/15685415?v=4","gravatar_id":"","url":"https://api.github.com/users/pranavan15","html_url":"https://github.com/pranavan15","followers_url":"https://api.github.com/users/pranavan15/followers","following_url":"https://api.github.com/users/pranavan15/following{/other_user}","gists_url":"https://api.github.com/users/pranavan15/gists{/gist_id}","starred_url":"https://api.github.com/users/pranavan15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pranavan15/subscriptions","organizations_url":"https://api.github.com/users/pranavan15/orgs","repos_url":"https://api.github.com/users/pranavan15/repos","events_url":"https://api.github.com/users/pranavan15/events{/privacy}","received_events_url":"https://api.github.com/users/pranavan15/received_events","type":"User","site_admin":false},"body":"## Purpose\r\nThis PR adds `decimal` type support in Ballerina. Decimal type is a basic, simple type in Ballerina. The decimal type corresponds to IEEE 754-2008 128-bit decimal (radix 10) floating point numbers [1]. \r\n \r\n### Defining a decimal variable in Ballerina\r\nWe define a decimal variable in Ballerina as below,\r\n```\r\ndecimal d = 243.345;\r\n```\r\nAs shown above, defining a decimal variable is very similar to defining a float variable in Ballerina. By default, all the floating point literals will be treated as float numbers unless we explicitly mention it as a decimal value. \r\n\r\n### Supported operations\r\nDecimal type supports the below basic operations.\r\n* Addition\r\n* Subtraction\r\n* Multiplication \r\n* Division\r\n* Modulus\r\n* Negation\r\n* Type conversions (float → decimal, decimal → float, int → decimal, decimal → int...)\r\n* Comparisons (==, !=, >, <, >=, <=)\r\n\r\n### Requirements\r\n* We already have type `float` to represent floating point numbers. Then why we need another type for the same purpose?\r\n Unlike `float`, which is a 64-bit representation, `decimal` type is a 128-bit representation. This allows us to deal with very large numbers. Type 'decimal' supports 34 decimal digits of significand and an exponent range of −6143 to +6144. Therefore, it allows us to represent higher precision and high scale numbers. It is very much useful in financial and commercial use cases, and currency representations.\r\n   \r\n* How `decimal` type resolves the floating point error problem?\r\nFloating-point numbers cannot precisely represent all real numbers. Hence, it leads to many erroneous results when performing arithmetic operations.\r\nFor example, the below boolean expression would result `false` when the numbers are represented using `float` type.\r\n```ballerina\r\n0.1 + 0.2 == 0.3 \r\n// Would result `false` if the numbers are represented using `float` \r\n// Would result `true` if the numbers are represented using `decimal` \r\n```\r\nThis is because of the non-representability of 0.1 (0.0001100110011..) and 0.2 (0.001100110011..) in binary. IEEE 754R Decimal128 format solves this problem by treating the radix 10 when representing the above values. Hence, the above values will be represented as they are, which will resolve the floating point error problem.\r\n\r\n[1] [https://en.wikipedia.org/wiki/Decimal128_floating-point_format](https://en.wikipedia.org/wiki/Decimal128_floating-point_format)","created_at":"2018-10-26T13:59:54Z","updated_at":"2018-11-09T12:35:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6610912a0cab1e8cbc0cf41e85b11dd10ce46f40","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/11034/commits","review_comments_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/11034/comments","review_comment_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/11034/comments","statuses_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/statuses/ce04700e201f126a7a8feb55974d61a42b727a05","head":{"label":"pranavan15:type-decimal","ref":"type-decimal","sha":"ce04700e201f126a7a8feb55974d61a42b727a05","user":{"login":"pranavan15","id":15685415,"node_id":"MDQ6VXNlcjE1Njg1NDE1","avatar_url":"https://avatars0.githubusercontent.com/u/15685415?v=4","gravatar_id":"","url":"https://api.github.com/users/pranavan15","html_url":"https://github.com/pranavan15","followers_url":"https://api.github.com/users/pranavan15/followers","following_url":"https://api.github.com/users/pranavan15/following{/other_user}","gists_url":"https://api.github.com/users/pranavan15/gists{/gist_id}","starred_url":"https://api.github.com/users/pranavan15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pranavan15/subscriptions","organizations_url":"https://api.github.com/users/pranavan15/orgs","repos_url":"https://api.github.com/users/pranavan15/repos","events_url":"https://api.github.com/users/pranavan15/events{/privacy}","received_events_url":"https://api.github.com/users/pranavan15/received_events","type":"User","site_admin":false},"repo":{"id":140685117,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA2ODUxMTc=","name":"ballerina-lang","full_name":"pranavan15/ballerina-lang","private":false,"owner":{"login":"pranavan15","id":15685415,"node_id":"MDQ6VXNlcjE1Njg1NDE1","avatar_url":"https://avatars0.githubusercontent.com/u/15685415?v=4","gravatar_id":"","url":"https://api.github.com/users/pranavan15","html_url":"https://github.com/pranavan15","followers_url":"https://api.github.com/users/pranavan15/followers","following_url":"https://api.github.com/users/pranavan15/following{/other_user}","gists_url":"https://api.github.com/users/pranavan15/gists{/gist_id}","starred_url":"https://api.github.com/users/pranavan15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pranavan15/subscriptions","organizations_url":"https://api.github.com/users/pranavan15/orgs","repos_url":"https://api.github.com/users/pranavan15/repos","events_url":"https://api.github.com/users/pranavan15/events{/privacy}","received_events_url":"https://api.github.com/users/pranavan15/received_events","type":"User","site_admin":false},"html_url":"https://github.com/pranavan15/ballerina-lang","description":"Ballerina is a compiled, transactional, statically and strongly typed programming language with textual and graphical syntaxes.","fork":true,"url":"https://api.github.com/repos/pranavan15/ballerina-lang","forks_url":"https://api.github.com/repos/pranavan15/ballerina-lang/forks","keys_url":"https://api.github.com/repos/pranavan15/ballerina-lang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pranavan15/ballerina-lang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pranavan15/ballerina-lang/teams","hooks_url":"https://api.github.com/repos/pranavan15/ballerina-lang/hooks","issue_events_url":"https://api.github.com/repos/pranavan15/ballerina-lang/issues/events{/number}","events_url":"https://api.github.com/repos/pranavan15/ballerina-lang/events","assignees_url":"https://api.github.com/repos/pranavan15/ballerina-lang/assignees{/user}","branches_url":"https://api.github.com/repos/pranavan15/ballerina-lang/branches{/branch}","tags_url":"https://api.github.com/repos/pranavan15/ballerina-lang/tags","blobs_url":"https://api.github.com/repos/pranavan15/ballerina-lang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pranavan15/ballerina-lang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pranavan15/ballerina-lang/git/refs{/sha}","trees_url":"https://api.github.com/repos/pranavan15/ballerina-lang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pranavan15/ballerina-lang/statuses/{sha}","languages_url":"https://api.github.com/repos/pranavan15/ballerina-lang/languages","stargazers_url":"https://api.github.com/repos/pranavan15/ballerina-lang/stargazers","contributors_url":"https://api.github.com/repos/pranavan15/ballerina-lang/contributors","subscribers_url":"https://api.github.com/repos/pranavan15/ballerina-lang/subscribers","subscription_url":"https://api.github.com/repos/pranavan15/ballerina-lang/subscription","commits_url":"https://api.github.com/repos/pranavan15/ballerina-lang/commits{/sha}","git_commits_url":"https://api.github.com/repos/pranavan15/ballerina-lang/git/commits{/sha}","comments_url":"https://api.github.com/repos/pranavan15/ballerina-lang/comments{/number}","issue_comment_url":"https://api.github.com/repos/pranavan15/ballerina-lang/issues/comments{/number}","contents_url":"https://api.github.com/repos/pranavan15/ballerina-lang/contents/{+path}","compare_url":"https://api.github.com/repos/pranavan15/ballerina-lang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pranavan15/ballerina-lang/merges","archive_url":"https://api.github.com/repos/pranavan15/ballerina-lang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pranavan15/ballerina-lang/downloads","issues_url":"https://api.github.com/repos/pranavan15/ballerina-lang/issues{/number}","pulls_url":"https://api.github.com/repos/pranavan15/ballerina-lang/pulls{/number}","milestones_url":"https://api.github.com/repos/pranavan15/ballerina-lang/milestones{/number}","notifications_url":"https://api.github.com/repos/pranavan15/ballerina-lang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pranavan15/ballerina-lang/labels{/name}","releases_url":"https://api.github.com/repos/pranavan15/ballerina-lang/releases{/id}","deployments_url":"https://api.github.com/repos/pranavan15/ballerina-lang/deployments","created_at":"2018-07-12T08:33:31Z","updated_at":"2018-10-26T14:07:32Z","pushed_at":"2018-11-09T12:33:35Z","git_url":"git://github.com/pranavan15/ballerina-lang.git","ssh_url":"git@github.com:pranavan15/ballerina-lang.git","clone_url":"https://github.com/pranavan15/ballerina-lang.git","svn_url":"https://github.com/pranavan15/ballerina-lang","homepage":"","size":271739,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ballerina-platform:error_refactor","ref":"error_refactor","sha":"f18783bbb28524fc629847ff0c84be9e02d8379a","user":{"login":"ballerina-platform","id":34733518,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NzMzNTE4","avatar_url":"https://avatars2.githubusercontent.com/u/34733518?v=4","gravatar_id":"","url":"https://api.github.com/users/ballerina-platform","html_url":"https://github.com/ballerina-platform","followers_url":"https://api.github.com/users/ballerina-platform/followers","following_url":"https://api.github.com/users/ballerina-platform/following{/other_user}","gists_url":"https://api.github.com/users/ballerina-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/ballerina-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ballerina-platform/subscriptions","organizations_url":"https://api.github.com/users/ballerina-platform/orgs","repos_url":"https://api.github.com/users/ballerina-platform/repos","events_url":"https://api.github.com/users/ballerina-platform/events{/privacy}","received_events_url":"https://api.github.com/users/ballerina-platform/received_events","type":"Organization","site_admin":false},"repo":{"id":73930305,"node_id":"MDEwOlJlcG9zaXRvcnk3MzkzMDMwNQ==","name":"ballerina-lang","full_name":"ballerina-platform/ballerina-lang","private":false,"owner":{"login":"ballerina-platform","id":34733518,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NzMzNTE4","avatar_url":"https://avatars2.githubusercontent.com/u/34733518?v=4","gravatar_id":"","url":"https://api.github.com/users/ballerina-platform","html_url":"https://github.com/ballerina-platform","followers_url":"https://api.github.com/users/ballerina-platform/followers","following_url":"https://api.github.com/users/ballerina-platform/following{/other_user}","gists_url":"https://api.github.com/users/ballerina-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/ballerina-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ballerina-platform/subscriptions","organizations_url":"https://api.github.com/users/ballerina-platform/orgs","repos_url":"https://api.github.com/users/ballerina-platform/repos","events_url":"https://api.github.com/users/ballerina-platform/events{/privacy}","received_events_url":"https://api.github.com/users/ballerina-platform/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ballerina-platform/ballerina-lang","description":"Ballerina is a compiled, transactional, statically and strongly typed programming language with textual and graphical syntaxes.","fork":false,"url":"https://api.github.com/repos/ballerina-platform/ballerina-lang","forks_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/forks","keys_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/teams","hooks_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/hooks","issue_events_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/events{/number}","events_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/events","assignees_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/assignees{/user}","branches_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/branches{/branch}","tags_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/tags","blobs_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/git/refs{/sha}","trees_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/statuses/{sha}","languages_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/languages","stargazers_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/stargazers","contributors_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/contributors","subscribers_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/subscribers","subscription_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/subscription","commits_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/commits{/sha}","git_commits_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/git/commits{/sha}","comments_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/comments{/number}","issue_comment_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/comments{/number}","contents_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/contents/{+path}","compare_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/merges","archive_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/downloads","issues_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues{/number}","pulls_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls{/number}","milestones_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/milestones{/number}","notifications_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/labels{/name}","releases_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/releases{/id}","deployments_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/deployments","created_at":"2016-11-16T14:58:44Z","updated_at":"2018-11-09T12:08:20Z","pushed_at":"2018-11-09T12:33:37Z","git_url":"git://github.com/ballerina-platform/ballerina-lang.git","ssh_url":"git@github.com:ballerina-platform/ballerina-lang.git","clone_url":"https://github.com/ballerina-platform/ballerina-lang.git","svn_url":"https://github.com/ballerina-platform/ballerina-lang","homepage":"","size":272722,"stargazers_count":1472,"watchers_count":1472,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":407,"mirror_url":null,"archived":false,"open_issues_count":593,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":407,"open_issues":593,"watchers":1472,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/11034"},"html":{"href":"https://github.com/ballerina-platform/ballerina-lang/pull/11034"},"issue":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/11034"},"comments":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/11034/comments"},"review_comments":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/11034/comments"},"review_comment":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/11034/commits"},"statuses":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/statuses/ce04700e201f126a7a8feb55974d61a42b727a05"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pranavan15"}}