New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues while including bernoulli.h #21

Closed
sushant-hiray opened this Issue Jul 31, 2014 · 10 comments

Comments

Projects
None yet
2 participants
@sushant-hiray
Copy link

sushant-hiray commented Jul 31, 2014

I've a following simple code which calls the bernoulli_fmprb_ui_zeta function.

#include "fmprb.h"
#include "bernoulli.h"

int main()
{
    fmprb_t y;
    fmprb_init(y);
    bernoulli_fmprb_ui_zeta(y, 9, 50 * 3.33);
    fmprb_printd(y, 50); printf("\n");
    fmprb_clear(y);
}

However, it raises an error

In file included from /usr/local/include/arb.h:31:0,
                 from /usr/local/include/bernoulli.h:36,
                 from check.cpp:2:
/usr/local/include/arf.h: In function ‘void arf_set(arf_struct*, const arf_struct*)’:
/usr/local/include/arf.h:392:13: error: invalid conversion from ‘void*’ to ‘mp_ptr {aka long unsigned int*}’ [-fpermissive]
             ARF_GET_MPN_WRITE(yptr, n, y);

The error occurs because of including bernoulli.h

I'm compiling it using the command:

g++ -I/usr/local/include/flint check.cpp -o check  -larb -lflint;

@fredrik-johansson can you please look into this issue or correct me if I'm doing anything wrong?

@sushant-hiray sushant-hiray referenced this issue Jul 31, 2014

Merged

Arb fix #3

@fredrik-johansson

This comment has been minimized.

Copy link
Owner

fredrik-johansson commented Jul 31, 2014

I believe the problem is a missing malloc/realloc cast (C does not require casting the result of malloc, but C++ does). Does d53f083 solve the problem?

@fredrik-johansson

This comment has been minimized.

Copy link
Owner

fredrik-johansson commented Jul 31, 2014

By the way, regarding your test program: fmprb.h is being deprecated. Use arb.h instead.

The function you probably want is bernoulli_fmpq_ui (for exact Bernoulli numbers) or arb_bernoulli_ui (for approximate Bernoulli numbers).

@sushant-hiray

This comment has been minimized.

Copy link
Author

sushant-hiray commented Jul 31, 2014

The patch works.
Thanks.
Also I couldn't find any particular documentation for fmpq_t or fmpz_t
Is this similar to mpq or mpz from gmp-lib?

@fredrik-johansson

This comment has been minimized.

Copy link
Owner

fredrik-johansson commented Jul 31, 2014

@sushant-hiray

This comment has been minimized.

Copy link
Author

sushant-hiray commented Jul 31, 2014

Thanks a lot 😄

@sushant-hiray

This comment has been minimized.

Copy link
Author

sushant-hiray commented Aug 1, 2014

@fredrik-johansson can you include this minor patch in 2.1.0 release?
I'm currently using the 2.1.0 release to interface arb with CSymPy in this PR
I'm not sure how far ahead in the timeline is the next release of ARB slated.

@sushant-hiray sushant-hiray referenced this issue Aug 1, 2014

Merged

Interface Arb with CSymPy, Add Zeta Module #265

6 of 6 tasks complete
@fredrik-johansson

This comment has been minimized.

Copy link
Owner

fredrik-johansson commented Aug 1, 2014

I will release 2.2.0 in a moment with this patch included.

@sushant-hiray

This comment has been minimized.

Copy link
Author

sushant-hiray commented Aug 1, 2014

Sure, that would be great. We can use 2.2.0 then.

@fredrik-johansson

This comment has been minimized.

Copy link
Owner

fredrik-johansson commented Aug 1, 2014

Done.

@sushant-hiray

This comment has been minimized.

Copy link
Author

sushant-hiray commented Aug 1, 2014

Thanks a lot 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment