{"action":"created","issue":{"url":"https://api.github.com/repos/sympy/symengine/issues/478","labels_url":"https://api.github.com/repos/sympy/symengine/issues/478/labels{/name}","comments_url":"https://api.github.com/repos/sympy/symengine/issues/478/comments","events_url":"https://api.github.com/repos/sympy/symengine/issues/478/events","html_url":"https://github.com/sympy/symengine/issues/478","id":89962761,"number":478,"title":"Write our own mpz_class","user":{"login":"certik","id":20568,"avatar_url":"https://avatars.githubusercontent.com/u/20568?v=3","gravatar_id":"","url":"https://api.github.com/users/certik","html_url":"https://github.com/certik","followers_url":"https://api.github.com/users/certik/followers","following_url":"https://api.github.com/users/certik/following{/other_user}","gists_url":"https://api.github.com/users/certik/gists{/gist_id}","starred_url":"https://api.github.com/users/certik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/certik/subscriptions","organizations_url":"https://api.github.com/users/certik/orgs","repos_url":"https://api.github.com/users/certik/repos","events_url":"https://api.github.com/users/certik/events{/privacy}","received_events_url":"https://api.github.com/users/certik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-21T21:21:23Z","updated_at":"2015-06-29T14:53:27Z","closed_at":null,"body":"It will be similar to `mpfr_class` and `mpc_class`, that are already implemented in #467.\r\n\r\n`gmpxx` already has an `mpz_class`, but the problem is that if the `gmp` library is compiled with a different c++ compiler (or a different standard library) than SymEngine, then `gmpxx` fails to link (#367, see also #476). Any C++ dependencies must be compiled with the same compiler and we definitely want to optionally depend on many C++ libraries (like Piranha, Boost, primesieve, ...), so in general, we need to require to use the same C++ compiler anyway, there is no way around it.\r\n\r\nHowever, `gmp` is different, because it is a hard dependency. In other words, if people want to just try SymEngine, they can skip all the other dependencies, but they must have `gmp` installed. And because many people have already hit the gmp linking problem (#367), we need to handle `gmpxx` in a special way. The PR #476 at least fails early if `gmpxx` doesn't work, so that's a step in the right direction, but it doesn't help the user actually install it. Another issue is that sometimes `gmp` is not compiled with C++ wrappers.\r\n\r\nSo the ultimate fix is to not use the `gmp` C++ bindings, and just write our own `mpz_class`. That way, we only depend on the C api, which always works, and so SymEngine is easy to install for anybody, to try it out.\r\n\r\nAnother reason is that we eventually have to use a faster integer implementation anyway (#477), and for example `piranha::integer` is using `mpz_t` directly (i.e. it doesn't use `gmpxx`).\r\n\r\nConclusion: `gmp` is a hard dependency and so we should only use the C api, so that SymEngine is easy to install (in the minimal configuration) on all platforms."},"comment":{"url":"https://api.github.com/repos/sympy/symengine/issues/comments/116715658","html_url":"https://github.com/sympy/symengine/issues/478#issuecomment-116715658","issue_url":"https://api.github.com/repos/sympy/symengine/issues/478","id":116715658,"user":{"login":"certik","id":20568,"avatar_url":"https://avatars.githubusercontent.com/u/20568?v=3","gravatar_id":"","url":"https://api.github.com/users/certik","html_url":"https://github.com/certik","followers_url":"https://api.github.com/users/certik/followers","following_url":"https://api.github.com/users/certik/following{/other_user}","gists_url":"https://api.github.com/users/certik/gists{/gist_id}","starred_url":"https://api.github.com/users/certik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/certik/subscriptions","organizations_url":"https://api.github.com/users/certik/orgs","repos_url":"https://api.github.com/users/certik/repos","events_url":"https://api.github.com/users/certik/events{/privacy}","received_events_url":"https://api.github.com/users/certik/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T14:53:27Z","updated_at":"2015-06-29T14:53:27Z","body":"@isuruf Can you give me an example from our code? I know in theory if you do things like `a=x+y+z` then you have to handle the temporaries properly, but I don't think we do that, it seems we only do things like `a=x+y`, and there it shouldn't matter I think, the move constructor should handle it. I could be wrong, let me know."}}