(50G) Y^X for any large (real) Y or (real) X #, but with Y or X being not complex #

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (https://www.hpmuseum.org/forum/forum-10.html)
+--- Forum: General Software Library (https://www.hpmuseum.org/forum/forum-13.html)
+--- Thread: (50G) Y^X for any large (real) Y or (real) X #, but with Y or X being not complex # (/thread-23565.html)



(50G) Y^X for any large (real) Y or (real) X #, but with Y or X being not complex # - Gil - 2025-05-16 17:46

Y^X : Y elevated to the power X. 

Y can be positive or negative, an integer or a real number, but not a complex number. 
The same applies to X. 

Code

\<< \-> Y X
  \<< Y TYPE 1 == X TYPE 1 == OR
    IF
    THEN "Y or X cannot
be Complex #" DOERR
    END STD Y ABS DUP LOG IP X FP * FP SWAP MANT LOG DUP X IP * FP SWAP X FP * + + ALOG \->NUM
    IF Y 0 <
    THEN
      CASE X 2 MOD 1 ==
        THEN -1 *
        END X FP 0 \=/
        THEN X FP X IP 2 MOD 1 ==
          IF
          THEN 1 +
          END \pi * i * EXP \->NUM *
        END
      END
    END "
E" Y ABS LOG X * IP \->NUM R\->I + + "," ",
" SREPL DROP
  \>>
\>>