Yep. The r_num_math calculates the operations as in a flow. I know it's ugly as 
long as its not math compliant. But it works faster than constructing a tree in 
memory and walk over it. And its ok for most situations.. Maybe this should be 
documented somewhere or use a complete ast to do the math.

The code is in libr/util/num.c and there's a test suite for it in t/.

If you want to contribute with a better implementation i'm open to suggestions 
and patches :)

On 22/08/2011, at 0:44, KillBoy PowerHed <[email protected]> wrote:

> Hi list,
> 
> Just a noob question, I was wondering if anyone could tell me why expressions 
> don't support the order of operations? I've been reading the manual but 
> couldn't see anything ... 
> 
> example output:
> [0x00404834]> ? 4*3+3
> 15 0xf
> [0x00404834]> ? 3+4*3
> 21 0x15
> [0x00404834]> ? 3+(4*3)
> 15 0xf
> 
> So it looks like brackets are evaluated first but multiplication/division 
> aren't evaluated before addition/subtraction ... it was a little confusing 
> when basic maths wasn't calculating as expected
> 
> thanks
> _______________________________________________
> radare mailing list
> [email protected]
> http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org

Reply via email to