{"action":"opened","issue":{"url":"https://api.github.com/repos/JuliaMath/FixedPointNumbers.jl/issues/103","repository_url":"https://api.github.com/repos/JuliaMath/FixedPointNumbers.jl","labels_url":"https://api.github.com/repos/JuliaMath/FixedPointNumbers.jl/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/JuliaMath/FixedPointNumbers.jl/issues/103/comments","events_url":"https://api.github.com/repos/JuliaMath/FixedPointNumbers.jl/issues/103/events","html_url":"https://github.com/JuliaMath/FixedPointNumbers.jl/issues/103","id":293398731,"number":103,"title":"very strange and non-deterministic behavior","user":{"login":"ssfrr","id":734386,"avatar_url":"https://avatars1.githubusercontent.com/u/734386?v=4","gravatar_id":"","url":"https://api.github.com/users/ssfrr","html_url":"https://github.com/ssfrr","followers_url":"https://api.github.com/users/ssfrr/followers","following_url":"https://api.github.com/users/ssfrr/following{/other_user}","gists_url":"https://api.github.com/users/ssfrr/gists{/gist_id}","starred_url":"https://api.github.com/users/ssfrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssfrr/subscriptions","organizations_url":"https://api.github.com/users/ssfrr/orgs","repos_url":"https://api.github.com/users/ssfrr/repos","events_url":"https://api.github.com/users/ssfrr/events{/privacy}","received_events_url":"https://api.github.com/users/ssfrr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-01T04:18:29Z","updated_at":"2018-02-01T04:18:29Z","closed_at":null,"author_association":"NONE","body":"I'm troubleshooting some 32-bit failures and seeing some very strange things. I dug down for a while and narrowed it down to floats not getting converted to Fixed-point numbers correctly, e.g. I added this to my test:\r\n\r\n```julia\r\nx = 0.222538\r\n@show x\r\nf = Fixed{Int32, 31}(x)\r\n@show f\r\n```\r\n\r\nand got the following appveyor output on 32-bit:\r\n\r\n```\r\nx = 0.222538\r\nf = -1.777462Q0f31\r\n```\r\n\r\nThen in trying to put together a repro to add to the FixedPointNumbers tests, I saw strange behavior on my local machine (64-bit, running Julia 0.6.2). These were entered as-written here, back-to-back, at the REPL (in Atom):\r\n\r\n```julia\r\njulia> typemax(Fixed{Int8, 7})\r\n0.292Q0f7\r\n\r\njulia> typemax(Fixed{Int8, 7})\r\n0.992Q0f7\r\n```\r\n\r\nSame expression, different results.\r\n\r\nI added some more tests to my code:\r\n\r\n```julia\r\n    @testset \"fractional fixed-point works\" begin\r\n        for T in (Fixed{Int8, 7},\r\n                  Fixed{Int16, 15},\r\n                  Fixed{Int32, 31},\r\n                  Fixed{Int64, 63})\r\n            tol = (typemax(T) + 1.0) / (sizeof(T) * 8)\r\n            for x in linspace(-1, float(typemax(T))-tol, 100)\r\n                @test abs(Fixed{Int16, 15}(x) - x) <= tol\r\n            end\r\n        end\r\n    end\r\n```\r\n\r\nwhich works on my local 64-bit machine but throws an error on the appveyor 32-bit machine:\r\n\r\n```\r\nfractional fixed-point works: Error During Test\r\n  Got an exception of type InexactError outside of a @test\r\n  InexactError()\r\n  Stacktrace:\r\n   [1] trunc at .\\float.jl:651\r\n   [2] _linspace(::Float64, ::Float64, ::Int32) at .\\twiceprecision.jl:349\r\n   [3] linspace(::Float64, ::Float64, ::Int32) at .\\twiceprecision.jl:338\r\n   [4] linspace(::Int32, ::Float64, ::Int32) at .\\range.jl:243\r\n   [5] macro expansion at C:\\Users\\appveyor\\.julia\\v0.6\\SampledSignals\\test\\WAVDisplay.jl:104 [inlined]\r\n   ...\r\n```\r\nwhere WAVDisplay.jl:104 is the `linspace` line in the test above.\r\n\r\nSorry for the big dump here, I'm not sure exactly what I'm looking for, in the sense that the nondeterministic behavior makes me wonder if it's a `Base` thing, not just a `FixedPointNumbers` thing.\r\n\r\nIs there a better way to test 32-bit behavior other than pushing to appveyor? Maybe a docker box?"}}
{"actor":{"display_login":"ssfrr"}}