Skip to content
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

Bessel and Airy functions should not silently convert BigFloat to Float64 #11512

Closed
MikaelSlevinsky opened this issue May 31, 2015 · 3 comments · Fixed by #15119
Closed

Bessel and Airy functions should not silently convert BigFloat to Float64 #11512

MikaelSlevinsky opened this issue May 31, 2015 · 3 comments · Fixed by #15119
Labels
good first issue Indicates a good issue for first-time contributors to Julia maths Mathematical functions

Comments

@MikaelSlevinsky
Copy link

Hi,

Super huge fan of the Julia language. I'm a developer at ApproxFun.jl and have been implementing some function approximation routines in extended precision. It looks like the Bessel and Airy functions don't have mpfr routines for Complex{BigFloat}, yet Julia gives results from float64ed values. Until an algorithm is implemented/wrapped, maybe an error/warning message is more appropriate?

julia> besselj0(1.0)
0.7651976865579666

julia> besselj0(big(1.0))
7.65197686557966551449717526102663220909274289755325241861547549119278912215269e-01 with 256 bits of precision

julia> besselj0(1.0im)
1.2660658777520082 + 0.0im

julia> besselj0(big(1.0im))
1.2660658777520082 + 0.0im
@stevengj stevengj added the maths Mathematical functions label May 31, 2015
@stevengj
Copy link
Member

Yes, I was planning to file an issue for this myself. I think the current behavior (in base/special/bessel.jl) of silently truncating arbitrary FloatingPoint types to 64-bit precision is a mistake, and we should just throw a no-method-error.

Possibly this code dates from the days when the only fp types were Float32 and Float64? For Float32, of course, it is perfectly appropriate to convert to Float64, compute the special function, and then round back to Float64.

@stevengj stevengj changed the title Complex{BigFloat} Bessel and Airy functions Bessel and Airy functions should not silently convert BigFloat to Float64 May 31, 2015
@stevengj
Copy link
Member

Similarly for some of the other special functions.

@simonbyrne
Copy link
Contributor

+1

@kshyatt kshyatt added the good first issue Indicates a good issue for first-time contributors to Julia label Aug 11, 2015
lvnguyen added a commit to lvnguyen/julia that referenced this issue Feb 7, 2016
…type)

We implement an explicit type checking and disable Complex{BigInt} and Complex{BigFloat}.
Currently only do for Bessel and Airy function.
lvnguyen added a commit to lvnguyen/julia that referenced this issue Feb 7, 2016
…type)

We implement an explicit type checking and disable Complex{BigInt} and Complex{BigFloat}.
Currently only do for Bessel and Airy function.
lvnguyen added a commit to lvnguyen/julia that referenced this issue Feb 7, 2016
…type)

We implement an explicit type checking and disable Complex{BigInt} and Complex{BigFloat}.
Currently only do for Bessel and Airy function.
lvnguyen added a commit to lvnguyen/julia that referenced this issue Feb 8, 2016
…type)

We implement an explicit type checking and disable Complex{BigInt} and Complex{BigFloat}.
Currently only do for Bessel and Airy function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Indicates a good issue for first-time contributors to Julia maths Mathematical functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants