#!/usr/bin/env clisp
;; 파일명: first-sample-2.lsp
(defun lg(x):
(/ (log x) (log 2)) )
(defun log10(x):
(/ (log x) (log 10)) )
(format t "이 소스는 CLisp 를 이용하여 실행됨!~%")
(format t "----------------~%")
(format t "수학식 계산하기:~%")
(format t "----------------~%")
(format t "pi + e = (+ pi (exp 1)) = ~A~%" (+ pi (exp 1)))
(format t "pi * e = (* pi (exp 1)) = ~A~%" (* pi (exp 1)))
(format t "sqrt(pi) + sqrt(e) = (+ (sqrt pi) (sqrt (exp 1))) = ~A~%" (+ (sqrt pi) (sqrt (exp 1))))
(format t "sqrt(pi + e) = (sqrt (+ pi (exp 1))) = ~A~%" (sqrt (+ pi (exp 1))))
(format t "sqrt(pi) - sqrt(e) = (- (sqrt pi) (sqrt (exp 1))) = ~A~%" (- (sqrt pi) (sqrt (exp 1))))
(format t "sqrt(pi - e) = ~A~%" (sqrt (- pi (exp 1))))
(format t "sin(pi) = (sin pi) = ~A~%" (sin pi))
(format t "cos(pi) = (cos pi = ~A~%" (cos pi))
(format t "tan(pi) = (tan pi) = ~A~%" (tan pi))
(format t "ln(e) = (log (exp 1)) = ~A~%" (log (exp 1)))
(format t "(lg 2) = (log2 2) = ~A~%" (lg 2))
(format t "(log10 (/ 1.0 10)) = ~A~%" (log10 (/ 1.0 10)))
(format t "pow(2, 10) = (expt 2 10) = ~A~%" (expt 2 10))
(format t "pow(2, 100) = (expt 2 10) = ~A~%" (expt 2 100))
(format t "pow(2, 1000) = (expt 2 1000) = ~A~%" (expt 2 1000))
(format t "len(str(pow(2, 1000))) = ~A = ~A~%" "(length (format nil \"~A\" (expt 2 100000)))" (length (format nil "~A" (expt 2 100000))))