I need help creating a macro that makes Julia evaluate my floating point expressions as BigFloat

Thank you, it worked

julia> using MacroTools: postwalk

julia> macro big_float_precision(expr)
               return postwalk(x -> x isa Float64 ? Expr(:call, :BigFloat, string(x)) : x, expr)
       end
@big_float_precision (macro with 1 method)

julia> @big_float_precision function f()
               sum = 0.0
               x = 902.4
               y = -47.1
               for i in 1:20
                       sum += x^2 + 4.3*y
               end
               return sum
       end
f (generic function with 1 method)

julia> typeof(f())
BigFloat
2 Likes