[fpc-pascal] What about complex numbers?

Carlos Avila carlos.avila.m at gmail.com
Thu Oct 6 18:03:32 CEST 2011


Thanks! I recently downloaded the rtl source code, and confirmed this

2011/10/5 Jeppe Græsdal Johansen <jjohan07 at student.aau.dk>

>  Den 06-10-2011 00:30, Carlos Avila skrev:
>
> Hello
>  Is complex number arithmetic possible in FPC? Another post recommends use
> unit so named ucomplex, but i can't find any detailed information of this in
> the documentation. But, amazingly, i sucessfully probed this small program:
>
>  PROGRAM DUMMY;
>
> USES UCOMPLEX;
>
> VAR
>
> x,y, z, w: COMPLEX;
>
> BEGIN
> x := 8+i*7;
> y := 4-5*i;
> z := x+y;
> w := x*y
>
> END.
>
>  This program compile and run right, but why? I need to know about
> anything subroutines that works with complex numbers. It is posibble to
> write math operations like FORTRAN?
>
>  Thanks
>
> The unit ucomplex is part of the rtl. It uses simple operator overloading
> to add a pretty useful complex type into your program. You can use it(pretty
> much) as any other type. It's not any special type, it's just a record where
> all the operators got overloaded
>
> Try to open the source code for that unit, and you'll see how beautifully
> simple it is :)
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111006/9a03e293/attachment.html>


More information about the fpc-pascal mailing list