* Complex Numbers in COBOL * What a curiosity IDENTIFICATIONDIVISION. CLASS-ID. "Complex"Inherits SOMObject. ENVIRONMENTDIVISION. ConfigurationSection. Repository. CLASS SOMObject IS"SOMObject" CLASS UserInterface IS"UserInt" . DATADIVISION. Working-StorageSection.
01 Number.
05 Real pic s9(4)V9(4).
05 Image pic s9(4)V9(4). PROCEDUREDIVISION.
IDENTIFICATIONDIVISION. METHOD-ID. "Add" . DATADIVISION. Working-StorageSection. LinkageSection.
01 Res.
05 Real pic s9(4)V9(4).
05 Image pic s9(4)V9(4).
01 Number1.
05 Real pic s9(4)V9(4).
05 Image pic s9(4)V9(4).
01 Number2.
05 Real pic s9(4)V9(4).
05 Image pic s9(4)V9(4). PROCEDUREDIVISIONUsing Number1, Number2, res. add Real of Number1 Real of Number2 giving real of Res. add Image of Number1 Image of Number2 giving Image of Res. ENDMETHOD"Add" .
IDENTIFICATIONDIVISION. METHOD-ID. "Multiply" . DATADIVISION. LinkageSection.
01 Res.
05 Real pic s9(4)V9(4).
05 Image pic s9(4)V9(4).
01 Number1.
05 Real pic s9(4)V9(4).
05 Image pic s9(4)V9(4).
01 Number2.
05 Real pic s9(4)V9(4).
05 Image pic s9(4)V9(4). PROCEDUREDIVISIONUsing Number1, Number2, Res. compute Real of Res = Real of Number1 * Real of Number2
- Image of Number1 * Image of Number2. compute Image of Res = Real of Number1 * Image of Number2
+ Image of Number1 * Real of Number2. ENDMETHOD"Multiply". ENDCLASS"Complex" .
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.