Friday, November 6, 2009

Lightning fast math expression evaluator

A few days ago I found a very fast and very well structured math expression evaluator which is actually a compiler, it is called Pegtop Delphi Math Component Library and can be found http://www.pegtop.net/delphi/components/math/download.htm.
Output of expression sin(sqrt(sqr x + sqr y)*7) /7
fldcw word ptr [esi+10]
fld qword ptr [esi+00]
fmul st(0), st(0)
fstp qword ptr [esi+20]
fld qword ptr [esi+08]
fmul st(0), st(0)
fadd qword ptr [esi+20]
fsqrt
fstp qword ptr [esi+28]
fld qword ptr [esi+30]
fmul qword ptr [esi+28]
fsin
fstp qword ptr [esi+38]
fld qword ptr [esi+40]
fdivr qword ptr [esi+38]
ret
(42 bytes)
Nice huh?

1 comment:

  1. Have you used this in D2009, D2010?

    ReplyDelete

Blogroll(General programming and Delphi feeds)