rxmath.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.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 library"
 
#define PROG_VERS   "1.2"
 
#define PROG_COPY   "Copyright (c) 2005-2021 Rexx Language Association."
 
#define PROG_ALRR   "All rights reserved."
 
#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 101 of file rxmath.cpp.

◆ ARCSINE

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

Definition at line 100 of file rxmath.cpp.

◆ ARCTANGENT

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

Definition at line 102 of file rxmath.cpp.

◆ COSINE

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

Definition at line 96 of file rxmath.cpp.

◆ COTANGENT

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

Definition at line 98 of file rxmath.cpp.

◆ MAX_PRECISION

#define MAX_PRECISION   16 /* maximum available precision*/

Definition at line 106 of file rxmath.cpp.

◆ MAXTRIG

#define MAXTRIG   3 /* value */

Definition at line 99 of file rxmath.cpp.

◆ MIN_PRECISION

#define MIN_PRECISION   1 /* minimum available precision*/

Definition at line 107 of file rxmath.cpp.

◆ pi

#define pi   3.14159265358979323846l /* pi value */

Definition at line 104 of file rxmath.cpp.

◆ PROG_ALRR

#define PROG_ALRR   "All rights reserved."

Definition at line 75 of file rxmath.cpp.

◆ PROG_COPY

#define PROG_COPY   "Copyright (c) 2005-2021 Rexx Language Association."

Definition at line 74 of file rxmath.cpp.

◆ PROG_DESC

#define PROG_DESC   "REXX mathematical function library"

Definition at line 72 of file rxmath.cpp.

◆ PROG_VERS

#define PROG_VERS   "1.2"

Definition at line 73 of file rxmath.cpp.

◆ SINE

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

Definition at line 95 of file rxmath.cpp.

◆ TANGENT

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

Definition at line 97 of file rxmath.cpp.

Function Documentation

◆ OOREXX_GET_PACKAGE()

OOREXX_GET_PACKAGE ( rxmath  )

◆ RexxRoutine0()

RexxRoutine0 ( CSTRING  ,
MathDropFuncs   
)

Definition at line 395 of file rxmath.cpp.

◆ RexxRoutine1() [1/2]

RexxRoutine1 ( CSTRING  ,
MathLoadFuncs  ,
OPTIONAL_CSTRING  ,
version   
)

Definition at line 373 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 570 of file rxmath.cpp.

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

◆ RexxRoutine2() [1/7]

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

Definition at line 475 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [2/7]

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

Definition at line 427 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [3/7]

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

Definition at line 436 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [4/7]

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

Definition at line 450 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [5/7]

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

Definition at line 466 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [6/7]

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

Definition at line 418 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine2() [7/7]

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

Definition at line 484 of file rxmath.cpp.

References argumentExists, and NumericFormatter::format().

◆ RexxRoutine3() [1/8]

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

◆ RexxRoutine3() [2/8]

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

◆ RexxRoutine3() [3/8]

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

Definition at line 621 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 536 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 552 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 506 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 528 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 544 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 629 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:629

Definition at line 652 of file rxmath.cpp.