Adding a BigFloat and a Float64 should automatically promote both to 
BigFloats, avoiding precision loss for you.

julia> BigFloat(2.9) + 0.3
3.199999999999999900079927783735911361873149871826171875000000000000000000000000

Do you have a case where this doesn’t happen?

// T

On Monday, April 18, 2016 at 4:32:52 PM UTC+2, Paweł Biernat wrote:

Hi,
>
> I want to make sure I am not loosing any precision in my code by 
> accidentally mixing BigFloat and Float64 (e.g. adding two numbers of 
> different precision).  I was thinking about replacing the definitions of 
> `+`, `-`, etc. for BigFloat but if you do that for all two argument 
> functions this would be a lot of redefining, so I started to wonder if 
> there is a more clever approach.  Is there any simple hack to get a warning 
> if this happens?
>
> Best,
> Paweł
>
> ​

Reply via email to