{"action":"closed","issue":{"url":"https://api.github.com/repos/yakra/tmtools/issues/28","repository_url":"https://api.github.com/repos/yakra/tmtools","labels_url":"https://api.github.com/repos/yakra/tmtools/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/yakra/tmtools/issues/28/comments","events_url":"https://api.github.com/repos/yakra/tmtools/issues/28/events","html_url":"https://github.com/yakra/tmtools/issues/28","id":306129262,"number":28,"title":"DBFtrim: MinEx0, MaxIntD, DecCount & pals, and differing sig figs","user":{"login":"yakra","id":13720877,"avatar_url":"https://avatars2.githubusercontent.com/u/13720877?v=4","gravatar_id":"","url":"https://api.github.com/users/yakra","html_url":"https://github.com/yakra","followers_url":"https://api.github.com/users/yakra/followers","following_url":"https://api.github.com/users/yakra/following{/other_user}","gists_url":"https://api.github.com/users/yakra/gists{/gist_id}","starred_url":"https://api.github.com/users/yakra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yakra/subscriptions","organizations_url":"https://api.github.com/users/yakra/orgs","repos_url":"https://api.github.com/users/yakra/repos","events_url":"https://api.github.com/users/yakra/events{/privacy}","received_events_url":"https://api.github.com/users/yakra/received_events","type":"User","site_admin":false},"labels":[{"id":734134066,"url":"https://api.github.com/repos/yakra/tmtools/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-17T05:15:00Z","updated_at":"2018-03-20T07:02:35Z","closed_at":"2018-03-20T07:02:35Z","author_association":"OWNER","body":"Relevant to how things got this way:\r\nhttps://github.com/yakra/tmtools/issues/6#issuecomment-370327880 https://github.com/yakra/tmtools/issues/23#issuecomment-372090341\r\n\r\nfield::GetMax cannot cope with input values with differing sig figs.\r\n\r\nSuppose DecCount = 2, and\r\nInput values are `  0.0` ` 0.00` `  1.0` ` 1.00` ` 10.0` `10.00` ` 12.0` `12.00`\r\n**if the 1st value is** `0.0`,\r\n*MinEx0* gets set to 1.\r\nThis is still < *DecCount*, so *MinEx0* is not increased to account for the '.' itself.\r\n**if the 2nd value is** `0.00`,\r\n*MinEx0* is already 1, so nothing more happens.\r\nOutput values are `  0.` ` 0.0` `  1.` ` 1.0` ` 10.` `10.0` ` 12.` `12.0`\r\n\r\nSimply detecting the '.' when trimming, rather than comparing *MinEx0* against *DecCount*, will not work, come file writing time:\r\n`outDBF.write(fVal, tDBF.fArr[fNum].len-fI+vlen-oDBF.fArr[fNum].MinEx0);`\r\nresolves to \r\n`outDBF.write(fVal, 2-2+3-3);` or `outDBF.write(fVal, 3-3+3-3);` or `outDBF.write(fVal, 2*(3-3));`...\r\nYou get the idea.\r\n\r\n### Goals:\r\n* Preserve max number of decimal places before the minimum extraneous zeros; don't go reducing the number of output sig figs willy-nilly if there were uniform sig figs in original file.\r\n* Cope with differing sig fig amounts in input.\r\n* Trim as much as possible within these constraints. Never increase field size.\r\n* Make sure *DecCount* stays sane.\r\n\r\nnew size = MaxIntD+1+MaxDecP or old size, whichever is smaller..."}}
{"actor":{"display_login":"yakra"}}