rxmath.cpp File Reference
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <fcntl.h>
#include "oorexxapi.h"
#include <sys/types.h>
Include dependency graph for rxmath.cpp:

Go to the source code of this file.

Classes

class  NumericFormatter
 
class  TrigFormatter
 

Macros

#define PROG_DESC   "REXX mathematical function package"
 
#define PROG_VERS   "1.1"
 
#define PROG_SECU   " "
 
#define PROG_COPY   "(c) Copyright RexxLanguage Association 2005."
 
#define PROG_ALRR   "All Rights Reserved."
 
#define MAX_DIGITS   9
 
#define SINE   0 /* trig function defines... */
 
#define COSINE   3 /* the ordering is important, */
 
#define TANGENT   1 /* as these get transformed */
 
#define COTANGENT   2 /* depending on the angle */
 
#define MAXTRIG   3 /* value */
 
#define ARCSINE   0 /* defines for arc trig */
 
#define ARCCOSINE   1 /* functions. Ordering is */
 
#define ARCTANGENT   2 /* not as important here */
 
#define pi   3.14159265358979323846l /* pi value */
 
#define MAX_PRECISION   16 /* maximum available precision*/
 
#define MIN_PRECISION   1 /* minimum available precision*/
 

Functions

 RexxRoutine1 (CSTRING, MathLoadFuncs, OPTIONAL_CSTRING, version)
 
 RexxRoutine0 (CSTRING, MathDropFuncs)
 
 RexxRoutine2 (RexxObjectPtr, RxCalcSqrt, double, x, OPTIONAL_uint32_t, precision)
 
 RexxRoutine2 (RexxObjectPtr, RxCalcExp, double, x, OPTIONAL_uint32_t, precision)
 
 RexxRoutine2 (RexxObjectPtr, RxCalcLog, double, x, OPTIONAL_uint32_t, precision)
 
 RexxRoutine2 (RexxObjectPtr, RxCalcLog10, double, x, OPTIONAL_uint32_t, precision)
 
 RexxRoutine2 (RexxObjectPtr, RxCalcSinH, double, x, OPTIONAL_uint32_t, precision)
 
 RexxRoutine2 (RexxObjectPtr, RxCalcCosH, double, x, OPTIONAL_uint32_t, precision)
 
 RexxRoutine2 (RexxObjectPtr, RxCalcTanH, double, x, OPTIONAL_uint32_t, precision)
 
 RexxRoutine3 (RexxObjectPtr, RxCalcPower, double, x, double, y, OPTIONAL_uint32_t, precision)
 
 RexxRoutine3 (RexxObjectPtr, RxCalcSin, double, angle, OPTIONAL_uint32_t, precision, OPTIONAL_CSTRING, units)
 
 RexxRoutine3 (RexxObjectPtr, RxCalcCos, double, angle, OPTIONAL_uint32_t, precision, OPTIONAL_CSTRING, units)
 
 RexxRoutine3 (RexxObjectPtr, RxCalcTan, double, angle, OPTIONAL_uint32_t, precision, OPTIONAL_CSTRING, units)
 
 RexxRoutine3 (RexxObjectPtr, RxCalcCotan, double, angle, OPTIONAL_uint32_t, precision, OPTIONAL_CSTRING, units)
 
 RexxRoutine1 (RexxObjectPtr, RxCalcPi, OPTIONAL_uint32_t, precision)
 
 RexxRoutine3 (RexxObjectPtr, RxCalcArcSin, double, x, OPTIONAL_uint32_t, precision, OPTIONAL_CSTRING, units)
 
 RexxRoutine3 (RexxObjectPtr, RxCalcArcCos, double, x, OPTIONAL_uint32_t, precision, OPTIONAL_CSTRING, units)
 
 RexxRoutine3 (RexxObjectPtr, RxCalcArcTan, double, x, OPTIONAL_uint32_t, precision, OPTIONAL_CSTRING, units)
 
 OOREXX_GET_PACKAGE (rxmath)
 

Variables

RexxRoutineEntry rxmath_functions []
 
RexxPackageEntry rxmath_package_entry
 

Macro Definition Documentation

◆ ARCCOSINE

#define ARCCOSINE   1 /* functions. Ordering is */

Definition at line 112 of file rxmath.cpp.

◆ ARCSINE

#define ARCSINE   0 /* defines for arc trig */

Definition at line 111 of file rxmath.cpp.

◆ ARCTANGENT

#define ARCTANGENT   2 /* not as important here */

Definition at line 113 of file rxmath.cpp.

◆ COSINE

#define COSINE   3 /* the ordering is important, */

Definition at line 107 of file rxmath.cpp.

◆ COTANGENT

#define COTANGENT   2 /* depending on the angle */

Definition at line 109 of file rxmath.cpp.

◆ MAX_DIGITS

#define MAX_DIGITS   9

Definition at line 101 of file rxmath.cpp.

◆ MAX_PRECISION

#define MAX_PRECISION   16 /* maximum available precision*/

Definition at line 117 of file rxmath.cpp.

◆ MAXTRIG

#define MAXTRIG   3 /* value */

Definition at line 110 of file rxmath.cpp.

◆ MIN_PRECISION

#define MIN_PRECISION   1 /* minimum available precision*/

Definition at line 118 of file rxmath.cpp.

◆ pi

#define pi   3.14159265358979323846l /* pi value */

Definition at line 115 of file rxmath.cpp.

◆ PROG_ALRR

#define PROG_ALRR   "All Rights Reserved."

Definition at line 81 of file rxmath.cpp.

◆ PROG_COPY

#define PROG_COPY   "(c) Copyright RexxLanguage Association 2005."

Definition at line 80 of file rxmath.cpp.

◆ PROG_DESC

#define PROG_DESC   "REXX mathematical function package"

Definition at line 77 of file rxmath.cpp.

◆ PROG_SECU

#define PROG_SECU   " "

Definition at line 79 of file rxmath.cpp.

◆ PROG_VERS

#define PROG_VERS   "1.1"

Definition at line 78 of file rxmath.cpp.

◆ SINE

#define SINE   0 /* trig function defines... */

Definition at line 106 of file rxmath.cpp.

◆ TANGENT

#define TANGENT   1 /* as these get transformed */

Definition at line 108 of file rxmath.cpp.

Function Documentation

◆ OOREXX_GET_PACKAGE()

OOREXX_GET_PACKAGE ( rxmath  )

◆ RexxRoutine0()

RexxRoutine0 ( CSTRING  ,
MathDropFuncs   
)

Definition at line 429 of file rxmath.cpp.

◆ RexxRoutine1() [1/2]

RexxRoutine1 ( CSTRING  ,
MathLoadFuncs  ,
OPTIONAL_CSTRING  ,
version   
)

Definition at line 407 of file rxmath.cpp.

References PROG_ALRR, PROG_COPY, PROG_DESC, and PROG_VERS.

◆ RexxRoutine1() [2/2]

RexxRoutine1 ( RexxObjectPtr  ,
RxCalcPi  ,
OPTIONAL_uint32_t  ,
precision   
)

Definition at line 592 of file rxmath.cpp.

References argumentExists, NumericFormatter::format(), and pi.

◆ RexxRoutine2() [1/7]

RexxRoutine2 ( RexxObjectPtr  ,
RxCalcCosH  ,
double  ,
,
OPTIONAL_uint32_t  ,
precision   
)

Definition at line 497 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [2/7]

RexxRoutine2 ( RexxObjectPtr  ,
RxCalcExp  ,
double  ,
,
OPTIONAL_uint32_t  ,
precision   
)

Definition at line 461 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [3/7]

RexxRoutine2 ( RexxObjectPtr  ,
RxCalcLog  ,
double  ,
,
OPTIONAL_uint32_t  ,
precision   
)

Definition at line 470 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [4/7]

RexxRoutine2 ( RexxObjectPtr  ,
RxCalcLog10  ,
double  ,
,
OPTIONAL_uint32_t  ,
precision   
)

Definition at line 478 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [5/7]

RexxRoutine2 ( RexxObjectPtr  ,
RxCalcSinH  ,
double  ,
,
OPTIONAL_uint32_t  ,
precision   
)

Definition at line 488 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [6/7]

RexxRoutine2 ( RexxObjectPtr  ,
RxCalcSqrt  ,
double  ,
,
OPTIONAL_uint32_t  ,
precision   
)

Definition at line 452 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [7/7]

RexxRoutine2 ( RexxObjectPtr  ,
RxCalcTanH  ,
double  ,
,
OPTIONAL_uint32_t  ,
precision   
)

Definition at line 506 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine3() [1/8]

RexxRoutine3 ( RexxObjectPtr  ,
RxCalcArcCos  ,
double  ,
,
OPTIONAL_uint32_t  ,
precision  ,
OPTIONAL_CSTRING  ,
units   
)

Definition at line 619 of file rxmath.cpp.

References ARCCOSINE, argumentExists, and TrigFormatter::evaluateArc().

◆ RexxRoutine3() [2/8]

RexxRoutine3 ( RexxObjectPtr  ,
RxCalcArcSin  ,
double  ,
,
OPTIONAL_uint32_t  ,
precision  ,
OPTIONAL_CSTRING  ,
units   
)

Definition at line 611 of file rxmath.cpp.

References ARCSINE, argumentExists, and TrigFormatter::evaluateArc().

◆ RexxRoutine3() [3/8]

RexxRoutine3 ( RexxObjectPtr  ,
RxCalcArcTan  ,
double  ,
,
OPTIONAL_uint32_t  ,
precision  ,
OPTIONAL_CSTRING  ,
units   
)

Definition at line 627 of file rxmath.cpp.

References ARCTANGENT, argumentExists, and TrigFormatter::evaluateArc().

◆ RexxRoutine3() [4/8]

RexxRoutine3 ( RexxObjectPtr  ,
RxCalcCos  ,
double  ,
angle  ,
OPTIONAL_uint32_t  ,
precision  ,
OPTIONAL_CSTRING  ,
units   
)

Definition at line 558 of file rxmath.cpp.

References argumentExists, COSINE, and TrigFormatter::evaluate().

◆ RexxRoutine3() [5/8]

RexxRoutine3 ( RexxObjectPtr  ,
RxCalcCotan  ,
double  ,
angle  ,
OPTIONAL_uint32_t  ,
precision  ,
OPTIONAL_CSTRING  ,
units   
)

Definition at line 574 of file rxmath.cpp.

References argumentExists, COTANGENT, and TrigFormatter::evaluate().

◆ RexxRoutine3() [6/8]

RexxRoutine3 ( RexxObjectPtr  ,
RxCalcPower  ,
double  ,
,
double  ,
,
OPTIONAL_uint32_t  ,
precision   
)

Definition at line 528 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine3() [7/8]

RexxRoutine3 ( RexxObjectPtr  ,
RxCalcSin  ,
double  ,
angle  ,
OPTIONAL_uint32_t  ,
precision  ,
OPTIONAL_CSTRING  ,
units   
)

Definition at line 550 of file rxmath.cpp.

References argumentExists, TrigFormatter::evaluate(), and SINE.

◆ RexxRoutine3() [8/8]

RexxRoutine3 ( RexxObjectPtr  ,
RxCalcTan  ,
double  ,
angle  ,
OPTIONAL_uint32_t  ,
precision  ,
OPTIONAL_CSTRING  ,
units   
)

Definition at line 566 of file rxmath.cpp.

References argumentExists, TrigFormatter::evaluate(), and TANGENT.

Variable Documentation

◆ rxmath_functions

RexxRoutineEntry rxmath_functions[]
Initial value:
=
{
REXX_TYPED_ROUTINE(MathLoadFuncs, MathLoadFuncs),
REXX_TYPED_ROUTINE(MathDropFuncs, MathDropFuncs),
REXX_TYPED_ROUTINE(RxCalcPi, RxCalcPi),
REXX_TYPED_ROUTINE(RxCalcSqrt, RxCalcSqrt),
REXX_TYPED_ROUTINE(RxCalcExp, RxCalcExp),
REXX_TYPED_ROUTINE(RxCalcLog, RxCalcLog),
REXX_TYPED_ROUTINE(RxCalcLog10, RxCalcLog10),
REXX_TYPED_ROUTINE(RxCalcSinH, RxCalcSinH),
REXX_TYPED_ROUTINE(RxCalcCosH, RxCalcCosH),
REXX_TYPED_ROUTINE(RxCalcTanH, RxCalcTanH),
REXX_TYPED_ROUTINE(RxCalcPower, RxCalcPower),
REXX_TYPED_ROUTINE(RxCalcSin, RxCalcSin),
REXX_TYPED_ROUTINE(RxCalcCos, RxCalcCos),
REXX_TYPED_ROUTINE(RxCalcTan, RxCalcTan),
REXX_TYPED_ROUTINE(RxCalcCotan, RxCalcCotan),
REXX_TYPED_ROUTINE(RxCalcArcSin, RxCalcArcSin),
REXX_TYPED_ROUTINE(RxCalcArcCos, RxCalcArcCos),
REXX_TYPED_ROUTINE(RxCalcArcTan, RxCalcArcTan),
}
#define REXX_TYPED_ROUTINE(n, e)
Definition: oorexxapi.h:191

Definition at line 635 of file rxmath.cpp.

◆ rxmath_package_entry

RexxPackageEntry rxmath_package_entry
Initial value:
=
{
"RXMATH",
"4.0",
NULL,
NULL,
NULL
}
#define REXX_INTERPRETER_4_0_0
Definition: oorexxapi.h:216
#define STANDARD_PACKAGE_HEADER
Definition: oorexxapi.h:230
RexxRoutineEntry rxmath_functions[]
Definition: rxmath.cpp:635

Definition at line 658 of file rxmath.cpp.