I think what BigAl suggested was this
(setq v (* (/ (+ s1 s2 (sqrt (* s1 s2))) (* 3. 1000000)) h))
As you see the 3 was changed to 3. or could be 3.0 so you prevent this number can be considered as an integer instead of a real
I added the undo and also the initget to prevent h to be 0 or negative or just nil (by hitting enter)
;;; Volume of a truncated piramid square based, author Isaac26a, 19.01.2024
;;; https://www.cadtutor.net/forum/topic/79210-the-volume-of-the-foundation-ditch-through-lisp/
(defun C:W2d1( / dw h oe pl1 pl2 s1 s2 v)
(vl-load-com)
(vla-startundomark (setq dw (vla-get-activedocument (vlax-get-acad-object))))
(setq oe (getvar 'cmdecho))
(setvar 'cmdecho 0)
(setq pl1 (car (entsel "\nSpecify the polyline PL1:")))
(setq s1 (vla-get-area (vlax-ename->vla-object pl1)))
(setq pl2 (car (entsel "\nSpecify the polyline PL2:")))
(setq s2 (vla-get-area (vlax-ename->vla-object pl2)))
(initget 7)
(setq h (getreal "\nEnter the height (h) of the excavation: "))
(setq v (* (/ (+ s1 s2 (sqrt (* s1 s2))) (* 3. 1000000)) h))
(princ (strcat "\nThe Volume of the excavation is: " (rtos v 2 2) " m3"))
(if (setq p (getpoint "\nSpecify a point to insert the text: "))
(entmake
(list
'(0 . "TEXT")
'(100 . "AcDbText")
(cons 10 (trans p 1 0))
(cons 40 250)
(cons 1 (rtos v 2 3))
(cons 50 (angle '(0 0) (getvar 'ucsxdir)))
)
)
(princ (strcat "\nThe result is: " (rtos V 2 3) " m3"))
)
(setvar 'cmdecho oe)
(vla-endundomark dw)
(princ)
)
Here when you do "0.333" you are making the number become a string so it will become an error
And as far as I know there is no (recip ) function well at least in autocad