cg-Cad

Lisp »Tips 'n Tricks »(^ a b)

;|
   POW Copyright (C) 2005 by Claudio Piccini.
   All rights reserved
   www.cg-cad.com

|;

(defun ^ ( a1 n / i b1 q1 )
 (setq i 1)
 (setq b1 a1)
 (while (< i n)
  (setq q1 (* a1 b1))
  (setq b1 q1)
  (setq i (1+ i))
 )
 (setq a1 q1)
)

(defun c:pow ( / a b )
 (textscr)
 (princ "\n a^b, a=reale b=intero")
 (initget (+ 1 2 4))   
 (setq a (getreal "\n a? "))
 (initget (+ 1 2 4))   
 (setq b (getint "\n b? "))
 (princ (rtos (^ a b) 2 6))
 (princ)
)
;;;eof

Test del Lisp

Command: pow
a^b, a=reale b=intero
a? 7.89
b? 99
6.465816E+88

Lisp »Tips 'n Tricks

Ultimo Aggiornamento_Last Update: 5 Agosto 2005