Path: utzoo!attcan!uunet!cbmvax!daveh From: daveh@cbmvax.UUCP (Dave Haynie) Newsgroups: comp.sys.amiga Subject: Re: Complex Numbers in C Message-ID: <5685@cbmvax.UUCP> Date: 12 Jan 89 20:44:00 GMT References: <759@myrias.UUCP> Organization: Commodore Technology, West Chester, PA Lines: 39 in article <759@myrias.UUCP>, cg@myrias.UUCP (Chris Gray) says: > Summary: Draco has them > In order to test out the "operator type" facility in Draco V1.2, I implemented > a complex number type. A friend here, Don Reble, did some of the complex > trancendental functions for me. With it, you can do things like > complex a, b; > readln(a, b); > a := a * b; > writeln("a = ", a, "b * 3 = ", b * complex(3.0, 0.0)); > etc. > Chris Gray Myrias Research, Edmonton +1 403 428 1616 Hey, pretty cool. Are you fully supporting object definitons, or just an expanded type definition. In either case, that's certainly one over what you can do in C or Modula2 (one of the reasons my language of choice for any high level programming is currently C++). Do you allow overloading of functions as well as operators. One of the more foolish parts of C, if you're using standard libraries, is all the different function names you need to do the same basic operation on different data types. You could end up have abs(int), fabs(float), dabs(double float), etc. for what's basically a very simple function. Add in complex numbers, and you'd have now cabs(complex), or whatever. C++ would let you build a function called "abs()", or actually several functions, one for each data type. The compiler could tell you if you try calling abs() on a type without such a function (really, an object without such a function, but it looks pretty similar). After several months of C++, I can't imagine using a language full time that doesn't support such features. Sounds to me that Draco is at least a significant part of the way there. -Dave Haynie -- Dave Haynie "The 32 Bit Guy" Commodore-Amiga "The Crew That Never Rests" {uunet|pyramid|rutgers}!cbmvax!daveh PLINK: D-DAVE H BIX: hazy Amiga -- It's not just a job, it's an obsession