home *** CD-ROM | disk | FTP | other *** search
- longreal.m: A module for 64bit floats in E.
-
-
- The module introduces a type 'longreal' to the E language.
- All functions in the module are prefixed by a 'd' (for 'double')
- Before you use this module, first call:
-
- dInit()
-
- and upon exit _always_ call:
-
- dCleanup()
-
- dInit() may raise an "DLIB" exception if
- it fails to open one of the IEEE double libraries. If you don't
- need any transcendental functions, dInit(FALSE) will cause only the
- mathieeedoubbas.library to be opened.
-
-
- Using longreals as a type.
- There are various ways to create a longreal variable. simplest is:
-
- DEF f:longreal
-
- or:
-
- DEF f:PTR TO longreal
-
- and then later:
-
- NEW f
-
- also, you can make arrays of longreals, or use them in objects:
-
- OBJECT bla
- x:INT, y:longreal
- ENDOBJECT
-
- DEF a[100]:ARRAY OF longreal, b:bla
-
- As you see they work just like the builtin types.
- In the above examples
-
- f, a[1], a[10], b.y
-
- all denote longreal variables. these can be used whereever a
- longreal is expected in the functions decribed below. Note however
- that, being objects, longreals are passed by reference.
-
-
- i:=dFix(f) dFloat(i,f)
-
- convert a longreal to a LONG and a LONG to a longreal respectively.
- dFloat() returns f
-
- dAdd(x,y) dAdd(x,y,to)
- dSub(x,y) dSub(x,y,to)
- dMul(x,y) dMul(x,y,to)
- dDiv(x,y) dDiv(x,y,to)
-
- perform these common operations on their arguments. 'x' and 'y' are in the
- same order as their operator-counterparts. The result is stored in 'to',
- or in 'x' if only two arguments are passed. (all functions return 'to' or
- 'x', resp.).
-
- r:=dCompare(x,y) r:=dTest(x)
-
- Compare longreals. dTest compares x with 0 as second arg. result 'r' is
- positive if x>y, negative for x<y, and 0 for x=y.
-
- dRound(x) dRoundUp(x)
-
- make x a round number, where dRound takes the lower, and dRoundUp
- the upper choice. Both also return x
-
- dAbs(x) dNeg(x)
-
- take absolute value of x or negate x, respectively. Both also return x.
-
- dCopy(x,y)
-
- copies y to x, and returns x also.
-
- dFormat(s:STRING,x,num)
-
- produces an ascii representation of 'x' in 's' with 'num' decimals after
- the '.'. num must be >0. Returns s.
- Not great and somewhat slow, but it works :-)
-
- dSqrt(x)
-
-
- ----------------
- NOTE: Erwin has added a large bunch of useful functions, and documentation
- on these can be found in the module source, and longdemo.e.
- Because the module got rather big, I also included the original longreal
- module (now longrealtiny.m) for those who don't need all the bells and
- whistles...
-
-