mn8 Language Reference | Index    

Real

SUMMARY: NO ATTRIBUTES  NO ELEMENTS  CONSTRUCTORS SUMMARY  OPERATORS SUMMARY  METHODS SUMMARYDETAIL: NO ATTRIBUTES  NO ELEMENTS  CONSTRUCTOR DETAILS  OPERATOR DETAILS  METHOD DETAILS

Description

A lexical real constant evaluates to a value of type real. The internal representation of reals is 64-bit IEEE 754 floating-point. No exceptions are thrown in real math.

Usage

        Real Expressions
            Expression   Value    Value Type
             ----------   -----    ----------
             1.2          1.2      Real
             2/2          1.0      Real

Version: 0.1
Authors:Remus Pereni (http://neuro.nolimits.ro)
Location:
Inherited by: Integer

Constructor List

create (String $value)
top

Operator List

Real+ (Real $value)
Logical<= (Real $value)
Logical< (Real $value)
Logical>= (Real $value)
Real/ (Real $value)
Real--
Real- (Real $value)
Real++
Real* (Real $value)
Logical> (Real $value)
Logical== (Real $value)
top

Method List

Realsqrt
LogicaltoLogicalConcept
StringtoStringConcept
Conceptabs
Conceptmax (Real $value)
Conceptmin (Real $value)
Realacos
Realasin
Realatan
Realceil
Realcos
Realexp
Realfloor
Reallog
Realpow (Real $value)
Realsin
Realtan
RealtoDegrees
RealtoRadians
top

Detailed Constructor Info

create (String $value)
Parameters:
$value :A string concept.

Constructs an integer concept inicialized with the value represented by the string given as parameter.

top

Detailed Operator Info

+ (Real $value)
Parameters:
$value :Concept that will be added to this concept.

Adds the concept value given as parameter to this concept value and returns the result.

top
<= (Real $value)
Parameters:
$value :To this will be compared this concept.

Returns true if this concept value is smaller or equals with the parameters value, false otherwise.

top
< (Real $value)
Parameters:
$value :To this will be compared this concept.

Returns true if this concept value is smaller then the parameters value, false otherwise.

top
>= (Real $value)
Parameters:
$value :To this will be compared this concept.

Returns true if this concept value is greater or equals with the parameters value, false otherwise.

top
/ (Real $value)
Parameters:
$value :Concept with which value will be divided this concept.

Divide this concept value with the concept value given as parameter and returns the result.

top
--

Decrease this concept value with 1.

top
- (Real $value)
Parameters:
$value : Concept which value will be substracted from this concept.

Substracts the concept value given as parameter from this concept value and returns the result.

top
++

Increase this concept value with 1.

top
* (Real $value)
Parameters:
$value :Concept with which value will be multiplied this concept.

Multipy with the parameter value this concept value and returns the result.

top
> (Real $value)
Parameters:
$value :To this will be compared this concept.

Returns true if this concept value is greater then the parameters value, false otherwise.

top
== (Real $value)
Parameters:
$value :To this will be compared this concept.

Returns true if this concept value equals with the parameters value, false otherwise.

top

Detailed Method Info

sqrt
Returns: Real

Extracts the root of this concept value and returns the result.

                $r = 2
                print $r.sqrt
                -- the result is --
                1.4142135
                

top
toLogicalConcept
Returns: Logical

Returns a logical concept representing this concept's value. (ex. 1 = true)

            $r = 0
            print $r.toLogicalConcept
            $r = 1
            print $r.toLogicalConcept
            -- the result is --
            false
            true
            

top
toStringConcept
Returns: String

Returns a string concept representing this concept's value.

                $r = 2.23523
                print $r.toStringConcept
                -- the result is --
                2.23523
                

top
abs
Returns: Concept

Returns the absolute value of an real concept. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

            $r = -15.837
            print $r.abs
            -- the result is --
            15.837
            

top
max (Real $value)
Parameters:
$value :The real concept to be compared to the current value
Returns: Concept

Returns the greater of two real concepts. If the arguments have the same value, the result is that same value.

            $r = 12.576
            $s = 12.578
            print $r.max($s)
            -- the result is --
            12.578
            

top
min (Real $value)
Parameters:
$value :The real concept to be compared to the current value
Returns: Concept

Returns the smaller of two real concepts. If the arguments have the same value, the result is that same value.

            $r = 12.576
            $s = 12.578
            print $r.min($s)
            -- the result is --
            12.576
            

top
acos
Returns: Real

Returns the arc cosine of an angle, in the range of 0.0 through pi.
Special case :

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.

            $r = 0.274
            print $r.acos
            -- the result is --
            1.2932466
            

top
asin
Returns: Real

Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
Special cases :

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.

            $r = 0.274
            print $r.asin
            -- the result is --
            0.27754974
            

top
atan
Returns: Real

Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
Special cases :

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.

            $r = 0.274
            print $r.atan
            -- the result is --
            0.26743627
            

top
ceil
Returns: Real

Returns the smallest (closest to negative infinity) real concept that is not less than the argument and is equal to a mathematical integer.
Special cases :

Note that the value of ceil(x) is exactly the value of -floor(-x).

            $r = 34.1568
            print $r.ceil
            -- the result is --
            35.0
            

top
cos
Returns: Real

Returns the trigonometric cosine of an angle.
Special case:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.

            $r = 0.274
            print $r.cos
            -- the result is --
            0.96269625
            

top
exp
Returns: Real

Returns the exponential number e (i.e., 2.718...) raised to the power of a real concept.
Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.

            $r = 4.183
            print $r.exp
            -- the result is --
            65.56225
            

top
floor
Returns: Real

Returns the largest (closest to positive infinity) real concept that is not greater than the argument and is equal to a mathematical integer.
Special cases:

            $r = 34.6458
            print $r.floor
            -- the result is --
            34.0
            

top
log
Returns: Real

Returns the natural logarithm (base e) of a double value.
Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.

            $r = 4.183
            print $r.log
            -- the result is --
            1.4310287
            

top
pow (Real $value)
Parameters:
$value : This argument will be the value to which the current value will be raised.
Returns: Real

Returns of value of the current valur raised to the power of the argument.
Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.

            $r = 2
            print $r.pow(3)
            -- the result is --
            8.0
            

top
sin
Returns: Real

Returns the trigonometric sine of an angle.
Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.

            $r = 0.274
            print $r.sin
            -- the result is --
            0.27058437
            

top
tan
Returns: Real

Returns the trigonometric tangent of an angle.
Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.

            $r = 0.274
            print $r.tan
            -- the result is --
            0.2810693
            

top
toDegrees
Returns: Real

Converts an angle measured in radians to the equivalent angle measured in degrees.

            $r = 0.274
            print $r.toDegrees
            -- the result is --
            15.699043
            

top
toRadians
Returns: Real

Converts an angle measured in degrees to the equivalent angle measured in radians.

            $r = 0.274
            print $r.toRadians
            -- the result is --
            0.004782202
            

top