{"action":"created","issue":{"url":"https://api.github.com/repos/telerik/kendo-ui-core/issues/4005","repository_url":"https://api.github.com/repos/telerik/kendo-ui-core","labels_url":"https://api.github.com/repos/telerik/kendo-ui-core/issues/4005/labels{/name}","comments_url":"https://api.github.com/repos/telerik/kendo-ui-core/issues/4005/comments","events_url":"https://api.github.com/repos/telerik/kendo-ui-core/issues/4005/events","html_url":"https://github.com/telerik/kendo-ui-core/issues/4005","id":298575100,"number":4005,"title":"Cell values formatted as percent are incorrect for certain values","user":{"login":"ivanchev","id":6572982,"avatar_url":"https://avatars2.githubusercontent.com/u/6572982?v=4","gravatar_id":"","url":"https://api.github.com/users/ivanchev","html_url":"https://github.com/ivanchev","followers_url":"https://api.github.com/users/ivanchev/followers","following_url":"https://api.github.com/users/ivanchev/following{/other_user}","gists_url":"https://api.github.com/users/ivanchev/gists{/gist_id}","starred_url":"https://api.github.com/users/ivanchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivanchev/subscriptions","organizations_url":"https://api.github.com/users/ivanchev/orgs","repos_url":"https://api.github.com/users/ivanchev/repos","events_url":"https://api.github.com/users/ivanchev/events{/privacy}","received_events_url":"https://api.github.com/users/ivanchev/received_events","type":"User","site_admin":false},"labels":[{"id":78012786,"url":"https://api.github.com/repos/telerik/kendo-ui-core/labels/Bug","name":"Bug","color":"e10c02","default":false},{"id":377756977,"url":"https://api.github.com/repos/telerik/kendo-ui-core/labels/C:%20Spreadsheet","name":"C: Spreadsheet","color":"444444","default":false},{"id":184893103,"url":"https://api.github.com/repos/telerik/kendo-ui-core/labels/SEV:%20Medium","name":"SEV: Medium","color":"FF9999","default":false}],"state":"open","locked":false,"assignee":{"login":"mishoo","id":334725,"avatar_url":"https://avatars2.githubusercontent.com/u/334725?v=4","gravatar_id":"","url":"https://api.github.com/users/mishoo","html_url":"https://github.com/mishoo","followers_url":"https://api.github.com/users/mishoo/followers","following_url":"https://api.github.com/users/mishoo/following{/other_user}","gists_url":"https://api.github.com/users/mishoo/gists{/gist_id}","starred_url":"https://api.github.com/users/mishoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mishoo/subscriptions","organizations_url":"https://api.github.com/users/mishoo/orgs","repos_url":"https://api.github.com/users/mishoo/repos","events_url":"https://api.github.com/users/mishoo/events{/privacy}","received_events_url":"https://api.github.com/users/mishoo/received_events","type":"User","site_admin":false},"assignees":[{"login":"mishoo","id":334725,"avatar_url":"https://avatars2.githubusercontent.com/u/334725?v=4","gravatar_id":"","url":"https://api.github.com/users/mishoo","html_url":"https://github.com/mishoo","followers_url":"https://api.github.com/users/mishoo/followers","following_url":"https://api.github.com/users/mishoo/following{/other_user}","gists_url":"https://api.github.com/users/mishoo/gists{/gist_id}","starred_url":"https://api.github.com/users/mishoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mishoo/subscriptions","organizations_url":"https://api.github.com/users/mishoo/orgs","repos_url":"https://api.github.com/users/mishoo/repos","events_url":"https://api.github.com/users/mishoo/events{/privacy}","received_events_url":"https://api.github.com/users/mishoo/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-02-20T12:24:32Z","updated_at":"2018-02-21T14:48:16Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"After entering certain values as percent, the value is changed to an incorrect one. \r\n\r\nCan be reproduced on the demo:\r\nhttps://demos.telerik.com/kendo-ui/spreadsheet/index\r\n\r\n1. Pick an empty cell\r\n2. Type in 1.092%\r\n3. Press enter\r\n\r\nExpected result:\r\nCell shows 1.09%, Formula bar shows 1.092%\r\n\r\nActual result:\r\nCell shows 1.92%, Formula bar shows 1.0919999999999999%\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/telerik/kendo-ui-core/issues/comments/367349498","html_url":"https://github.com/telerik/kendo-ui-core/issues/4005#issuecomment-367349498","issue_url":"https://api.github.com/repos/telerik/kendo-ui-core/issues/4005","id":367349498,"user":{"login":"davidbacisin","id":10532538,"avatar_url":"https://avatars3.githubusercontent.com/u/10532538?v=4","gravatar_id":"","url":"https://api.github.com/users/davidbacisin","html_url":"https://github.com/davidbacisin","followers_url":"https://api.github.com/users/davidbacisin/followers","following_url":"https://api.github.com/users/davidbacisin/following{/other_user}","gists_url":"https://api.github.com/users/davidbacisin/gists{/gist_id}","starred_url":"https://api.github.com/users/davidbacisin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidbacisin/subscriptions","organizations_url":"https://api.github.com/users/davidbacisin/orgs","repos_url":"https://api.github.com/users/davidbacisin/repos","events_url":"https://api.github.com/users/davidbacisin/events{/privacy}","received_events_url":"https://api.github.com/users/davidbacisin/received_events","type":"User","site_admin":false},"created_at":"2018-02-21T14:48:16Z","updated_at":"2018-02-21T14:48:16Z","author_association":"NONE","body":"After stepping through with the debugger, it looks like the leading zeros of the decimal part are being dropped within the **runtime.toFixed** function. Because we still would want to round the decimal part, I propose adding the following 3 lines to the **spreadsheet/numformat** module:\r\n```\r\nwhile (decpart.length < 14) {\r\n    decpart = '0' + decpart; // add leading zeros to replace any lost when converting to a number\r\n}\r\n```\r\nAnd shown in context:\r\n```\r\ntoFixed: function toFixed(value, decimals) {\r\n        var str = String(value);\r\n        var pos = str.indexOf('.');\r\n        if (pos >= 0) {\r\n            var intpart = str.substr(0, pos) || 0;\r\n            var decpart = str.substr(pos + 1);\r\n            if (decpart.length > 14) {\r\n                decpart = String(Math.round(decpart / Math.pow(10, decpart.length - 14)));\r\n                while (decpart.length < 14) {\r\n                    decpart = '0' + decpart;\r\n                }\r\n            }\r\n            if (decpart.length < decimals) {\r\n                while (decpart.length < decimals) {\r\n                    decpart += '0';\r\n                }\r\n                return intpart + '.' + decpart;\r\n            }\r\n            value = parseFloat(intpart + '.' + decpart);\r\n        }\r\n        return value.toFixed(decimals);\r\n    }\r\n```"}}
{"actor":{"display_login":"davidbacisin"}}