home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / USCX / TURBO-11.ZIP / POWER.PAS < prev    next >
Pascal/Delphi Source File  |  1985-05-17  |  2KB  |  36 lines

  1. (*--------------------------------------------------------------------------*)
  2. (*                       Power -- raise real to real power                  *)
  3. (*--------------------------------------------------------------------------*)
  4.  
  5. FUNCTION Power( x: REAL; y: REAL ) : REAL;
  6.  
  7. (*--------------------------------------------------------------------------*)
  8. (*                                                                          *)
  9. (*      Function:  Power                                                    *)
  10. (*                                                                          *)
  11. (*      Purpose:   Performs exponentiation of real to real power.           *)
  12. (*                                                                          *)
  13. (*      Calling Sequence:                                                   *)
  14. (*                                                                          *)
  15. (*         Powval := Power( x , y: REAL ) : REAL;                           *)
  16. (*                                                                          *)
  17. (*            x      --- base (must be positive)                            *)
  18. (*            y      --- power to raise base to                             *)
  19. (*                                                                          *)
  20. (*      Calls:     None                                                     *)
  21. (*                                                                          *)
  22. (*      Remarks:                                                            *)
  23. (*                                                                          *)
  24. (*         If x < 0 and y < 0, 0 is returned.  Likewise, Power(0,0) returns *)
  25. (*         zero.                                                            *)
  26. (*                                                                          *)
  27. (*--------------------------------------------------------------------------*)
  28.  
  29. BEGIN (* Power *)
  30.  
  31.    IF x > 0 THEN
  32.       Power := EXP( y * LN( x ) )
  33.    ELSE
  34.       Power := 0.0;
  35.  
  36. END   (* Power *);