BigFloat type

big.(MyVar), maybe?

In general, if you want to use BigFloat, then you should change the inputs to your function, e.g. pass a BigFloat for the input when you call ForwardDiff.jl (which is what I presume you are using). If you don’t use BigFloat all the way through, you will generally be limited by the accuracy of the least-precise step of the computation.

The ideal is to write your functions so that they always compute in the precision of their inputs, so that you can pass in whatever precision you want (Float64, Float32, BigFloat) later and they will do the right thing. This takes a little practice to do properly, with the help of Julia’s type-promotion and introspection machinery, but if you post a specific example of a short function people can give you some tips on how to make it precision-generic.

PS. Don’t post screenshots of code. Post quoted code, and post minimal runnable snippets to make it easier for other people to help you. Read Please read: make it easier to help you

3 Likes