home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 8067 < prev    next >
Encoding:
Internet Message Format  |  1993-01-12  |  1.2 KB

  1. Path: sparky!uunet!paladin.american.edu!gatech!news.ans.net!cmcl2!adm!news
  2. From: ISAACSON@husc3.harvard.edu
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: complex numbers
  5. Message-ID: <34963@adm.brl.mil>
  6. Date: 12 Jan 93 10:37:22 GMT
  7. Sender: news@adm.brl.mil
  8. Lines: 28
  9.  
  10. Well, I'm new to this mail program I'm using, so I can't quote
  11. you, and I'm new to this list (your message was in my first group
  12. received) so I probably couldn't quote you accurately anyway.
  13. However, I remember you saying that you want some kind of
  14. "exponentiation operator" for Pascal. Well, the only operator of
  15. this type that I know of is referenced mathematically as the caret
  16. "^" -- raising something to a power, or exponent? I wrote a very
  17. simple function in Pascal to do this, although because the subject
  18. line is "complex numbers" I doubt it will help too much. Here it
  19. is anyway:
  20.  
  21. function power(base, exp : word) : word;
  22.   var
  23.     count, temp : word;
  24.   begin
  25.     temp := 1;
  26.     if exp > 0 then
  27.       for count := 1 to exp do
  28.         temp := temp * base;
  29.     power := temp;
  30.   end;
  31.  
  32. This one is implemented using words, just because that's what the
  33. program I used it in called for. I do have a fair amount of
  34. experience with things like this, so let me know if I can help
  35. more...
  36.  
  37.  - Ron Isaacson
  38.