I am considering the preparation of a library of functions which would cover the arithmetic, trigonometric, hyperbolic, logarithmic, exponential and a few other operations on COMPLEX NUMBERS.

The flag parameter would indicate the size of the operand(s) (and result), allowing either SINGLE, DOUBLE or EXTENDED DOUBLE precision. The flag parameter would also indicate if operand(s) (and result) are in cartesian or polar coordinates. The operand(s) source and the result destination would also be indicated by the flag parameter as from/to the FPU or memory.

A detailed Help file (API style) would also be made available along with the source code of all the modules.

The library would not be intended for beginners in assembly. The user will need to be familiar with the management of the FPU registers to insure that the required number of registers are free before calling any of the functions.

This is a survey to find out if it is worth my time and effort to prepare such a library.

Raymond
Posted on 2005-01-26 21:29:23 by Raymond
If it covers larger types (N-bit binary giants for example) I am interested.
Posted on 2005-01-26 22:36:04 by Homer
The complex number library is completed. You can get it from:

http://www.ray.masmcode.com/index.html#znum

If you don't know what complex numbers are, the above link also includes a brief description of that "complex" subject.

Within the next few weeks, I will also make my fractal program available from the same link. I'm currently reworking its help file to reflect the use of threads in the revised program. (Fractal art makes extensive use of complex numbers.)

Enjoy

Raymond
Posted on 2005-02-13 21:29:03 by Raymond
Hi! Ideas in ZTest.asm are really nice.
Posted on 2006-09-27 16:24:12 by inFinie
Glad you liked it and may have been of some help.

Raymond
Posted on 2006-09-27 21:14:28 by Raymond
hi, nice library.

i am (in very early stage) developing library for FASM, and i think i might be able to use your code (as optional addon) if you permit me to.

since you seem not to be using many MASM-specific features, i will just write few macros that will "emulate" MASM enviroment, and include your sources.

surely not now, i have more important things to do with library, but it would be very nice addition some time. and also interesting FASM macro project. are you interested?
Posted on 2006-09-28 03:49:39 by vid
vid

Would you also intend to rewrite the accompanying Help file to be compatible with FASM or reuse it as is?

Would you include the test program (including source code modified for FASM) and the fractal program in the package?

Raymond
Posted on 2006-09-28 20:45:19 by Raymond
i will have to "wrap" your functions with my common wrapper. because i return error in CF, not with specific value (it's more flexible when you are in assembler). I will also have to parse your errors maybe, or catch those which you don't catch.

i will probably write docs with this my calling standard, and refer to your docs for details.

test program will be surely required, i don't release source without some test script which tries to test every possibility. It just is not possible to write bug-free code without that.

and once more: this won't be in the default package, because of it's MASM nature. defualt package will be "clean". This will be optional add-on.

i just planned it for future, because this seems interesting and one will hardly find asm library for complex numbers. There is one limitation i could have problem to overcome with FASM macros - you access proc arguments using syntax "mov eax, value". But in case you would use second version "mov eax, " too, my macros won't work. This includes accessing low order byte of dword with "mov al, byte ptr ". MASM has just confusion with these syntaxes...
Posted on 2006-09-29 03:17:26 by vid
i return error in CF


I am "assuming" at this time that the functions would be called as procedures with parameters on the stack. If so, would you not be concerned that the CF flag may get modified on exit from a standard proc when the stack is usually corrected for the pushed parameters by "add esp,xx"?

There is one limitation i could have problem to overcome with FASM macros


If you are going to translate from MASM syntax to some other syntax, you must thus be very familiar with the MASM syntax. Therefore you must know that, in MASM, "mov eax, value" and "mov eax, " are interpreted as identical instructions, i.e. move the content of the "value" variable into EAX. I would thus never use the "mov eax, " variant in my source code. If I need to get the address of the variable, I normally use "lea eax,value" because it works with both global and local variables and I don't have to ask myself which type of variable it is ("mov eax,offset value" works only with global variables).

As for an instruction such as "mov al, byte ptr ", I would never use anything similar in my source code. I would always load whatever register size is required for the declared size of the variable.

test program will be surely required


I agree with your philisophy but the test program I was referring to is the small app included with the Zlib package. It's only designed to help the user visualize the type of result which could be obtained from the various operations on complex numbers entered by the user. Its source code is also an example on how the library can be used.

Raymond
Posted on 2006-09-29 11:39:13 by Raymond