BigFloat(pi) is undefined, so that should be `Expr(:call, :big, :pi)`, but hopefully the rest makes sense.
On Fri, Sep 19, 2014 at 9:58 AM, Isaiah Norton <[email protected]> wrote: > To do what you want, very briefly: > > > x.args[3] == :pi && x.args[3] = Expr(:call, :BigFloat, :pi) > > This will make more sense if you look at `xdump` output to see how Exprs > are structured > (and `xdump` is quite handy to know about in general). Try: > > > > xdump(:(big(3) + big(pi))) > ... > > > On Fri, Sep 19, 2014 at 9:42 AM, David P. Sanders <[email protected]> > wrote: > >> >> >> El viernes, 19 de septiembre de 2014 08:34:05 UTC-5, David P. Sanders >> escribió: >>> >>> Hi, for a package I'm writing (or, more precisely, trying to write), I >>> need to do the following: >>> >>> Change `:(3 + pi)` >>> into `:(3 + big(pi))` >>> or `:(BigFloat(3) + BigFloat(pi))` >>> >> >> I forgot to say that I need to do this so that I can perform the >> calculations with different rounding modes. >> >> >>> >>> Basically I need to apply `BigFloat` to every symbol in the expression. >>> (I believe that it would be sufficient to wrap `MathConst`s in `big`, but >>> converting everything to BigFloat is probably a good idea.) >>> >>> This is my first foray into parsing etc. I'm guessing there's a package >>> that allows me to do this easily -- could someone please point it out? >>> Or how should I go about this? >>> >>> In principle the expressions could be more complicated, e.g. `(3 + pi) >>> * (2.5 - e)` >>> >>> Thanks, >>> David. >>> >> >
