Masm32 SDK description, downloads and other helpful links

Main Menu

Complex Numbers SmplMath backend

Started by HSE, May 17, 2023, 02:32:50 AM

Previous topic - Next topic


Hi all!

This is a new backend for SmplMath under development.

In essence is an adaptation of Complex Number Zlib Library written by Raymond Filiatreault, previously translated to neutral bitness (Complex Numbers in 64 bits).

Functions conserve capacity to read parameters from FPU and store results to FPU:    fld problemx2.imag
    fld problemx2.real
    fld problemy.imag
    fld problemy.real
    invoke ZPower, SRC12_FPU or DEST_FPU or Z_DBL
    fstp solution.real
    fstp solution.imag

Capacity to read/store in adresses was replaced with and emulation of FPU stack (just like in double doule precision backend):
    push_z problemx2
    push_z problemy
    invoke ZPower, Z_DBL
    pop_z solution

Of course, most interesting thing is an specific solve macro named fSlvZ:
    problemx2   Z_NUM {-2.4 , 0.0}
    problemy    Z_NUM { 3.99, 0.0}
    solution    Z_NUM {          }

    fSlvZ solution = problemx2 ^ problemy

And a little macro-parser allow to read complex numbers with some format (floating point format, parenthesis, sign between real and imaginary part, character i in imaginary part):
fSlvZ solution = (-2.4+0.0i)^(3.99+0.0i)

You can see that example is from Exponentiation topic.

I will preciate some more complicated examples  :thumbsup:

I have to improve procedure that show complex numbers, and adapt example to 32 bits :biggrin:

Regards, HSE

Later: library 64 bits is builded with JWASM 15, and example with ML64.
         (329.61 kB - downloaded 10 times.)

Later: library 32bits is builded with JWASM 15, and example with ML 14.

Equations in Assembly: SmplMath


A little better print:        Complex number functions library
   Written with MASM32 by Raymond Filiatreault
               February 15, 2005

(-2.4000e+000+0.0000e+000i) ^(3.9900e+000+0.0000e+000i)   =  (3.2872e+001-1.0330e+000i)

(-2.4000e+000+0.0000e+000i) ^(3.9900e+000+0.0000e+000i)   =  (3.2872e+001-1.0330e+000i)

(-2.4000e+000+0.0000e+000i) ^(3.9900e+000+0.0000e+000i)   =  (3.2872e+001-1.0330e+000i)

(-2.4+0.0i)^(3.99+0.0i)  =  (3.2872e+001-1.0330e+000i)

  Zneg (3.9900e+000+0.0000e+000i)   =  (-3.9900e+000-0.0000e+000i)

  Zneg (-2.4000e+000+0.0000e+000i)   =  (2.4000e+000-0.0000e+000i)

Press any key to continue...

Equations in Assembly: SmplMath


Now also with 32 bits example (using MASM32 SDK).

Updated in first post.
Equations in Assembly: SmplMath