Float64

From Erights

Jump to: navigation, search

The Float64 type is E's primary floating-point number type. Its members are IEEE 64-bit binary floating-point numbers. (XXX is this appropriate definition language?) Float64 is one of the E literal types.

The universal scope contains float64 (no capital), the guard for this type.

? float64
# value: float64

Contents

Protocol

Number protocol

Float64s implement the number protocol. (XXX figure out if there's benefit in templating to include generic number tests here)

abs/0

Signature: abs() :Float64

As specified in the number protocol. Specific tests:

? 0.0.abs()
# value: 0.0

? 0.5.abs()
# value: 0.5

? (-0.0).abs()
# value: -0.0

? (-0.5).abs()
# value: 0.5

XXX is (-0.0).abs() supposed to be negative?

sin/0

Signature: sin() :Float64

Returns the trigonometric sine of this number as an angle in radians.

? 0.0.sin()
# value: 0.0 

cos/0

Signature: cos() :Float64

Returns the trigonometric cosine of this number as an angle in radians.

? 0.0.cos()
# value: 1.0

tan/0

Signature: tan() :Float64

Returns the trigonometric tangent of this number as an angle in radians.

? 0.0.tan()
# value: 0.0

XXX test nonzero parameters for trig functions

XXX write tests for all other methods (get from eocl and eojava)

XXX Design issue: Is the canonical initial letter case for this type name (and int, boolean) upper or lower?

Personal tools
more tools