home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / kzr_0899.zip / ARCOSH.CMD < prev    next >
OS/2 REXX Batch file  |  1998-07-11  |  3KB  |  71 lines

  1. /* REXX-Programm arcosh.CMD  */
  2.    Signal on syntax name arcoshMsg
  3.  
  4. /* Diese Variablen müssen für jede Prozedur definiert werden, damit die  */
  5. /* Prozedur die Variable bufND kennt und die Variable ND übernehmen kann.*/
  6.    Pfd=SysSearchPath("PATH", "kzr.cmd")
  7.    lp=LastPos("\", Pfd)
  8.    Pfd=DelStr(Pfd, 1+lp)
  9.    NDAarcosh=Pfd||"NDAarcosh.DAT"
  10.    bufND  =Pfd||"NDZahl.DAT"
  11.    bufMsg =Pfd||"Meldung.DAT"
  12.    ND = LineIn(bufND, 1)
  13.  
  14.    if ND > 400 then
  15.    do
  16.      ND=400
  17.      call charout(NDAarcosh) ; Call SysFileDelete NDAarcosh
  18.      ret=LineOut(NDAarcosh, 400)
  19.      Call Charout,"   Achtung, nur 400 Dezimalstellen bei der Berechnung von  arcosh(...)"
  20.      say
  21.      Beep(444, 200); Beep(628,300)  /* Hier kein EXIT ! */
  22.    end
  23.  
  24.    /* Wenn ND <= 400 ist, wird ND = ND  weitergegeben */
  25.    call charout(NDAarcosh) ; Call SysFileDelete NDAarcosh
  26.    ret=LineOut(NDAarcosh, ND)
  27.  
  28.    arg x,y  /* y soll "illegale" Komma's im Funktions-Argument aufspüren */
  29.    p0p=x*x  /* Diese Anweisung prvoziert eine Syntax-Fehlermeldung       */
  30.  
  31.    if length(y) > 0 then
  32.    do
  33.      call charout(NDAarcosh); Call SysFileDelete NDAarcosh
  34.      ret=LineOut(bufMsg, "Im Argument von  arcosh(...)  ist mindestens  1  nicht zulässiges Komma !")
  35.      /* "bufMsg" und  "bufND" werden immer beim Beenden von kzr.cmd gelöscht, */
  36.      /*  damit in den diesbezüglichen temporären Dateien                      */
  37.      /*  Meldungen und ND-Werte nicht aneinandergehängt werden.               */
  38.      EXIT
  39.    end
  40.  
  41.    Numeric Digits ND+7
  42.  
  43.    if x < 1 then
  44.    do
  45.      call charout(NDAarcosh); Call SysFileDelete NDAarcosh
  46.      ret=LineOut(bufMsg, "Die Funktion  arcosh(...)  hat für Werte  x < 1  keine reelles Ergebnis.")
  47.      /* "bufMsg" und  "bufND" werden immer beim Beenden von kzr.cmd gelöscht, */
  48.      /*  damit in den diesbezüglichen temporären Dateien                      */
  49.      /*  Meldungen und ND-Werte nicht aneinandergehängt werden.               */
  50.      EXIT
  51.    end
  52.  
  53.    y=ln(x+sqrt(x*x-1))
  54.  
  55.    /* Ausgabe */
  56. W: numeric digits ND
  57.    return(Format(y))
  58.  
  59. arcoshMsg:
  60.    sf=ErrorText(RC)
  61.    if  Pos("Bad arithmetic conversion", sf) > 0 then
  62.    do
  63.      call charout(NDAarcosh); Call SysFileDelete NDAarcosh
  64.      ret=LineOut(bufMsg, "Sie haben in  arcosh(...)  kein gültiges Argument eingegeben !")
  65.   /* "bufMsg" und  "bufND" werden immer beim Beenden von kzr.cmd gelöscht, */
  66.   /*  damit in den diesbezüglichen temporären Dateien                      */
  67.   /*  Meldungen und ND-Werte nicht aneinandergehängt werden.               */
  68.      EXIT
  69.    end
  70.  
  71.