Chapter 3 DynaScript Predefined Objects


Math properties

The Math object has these properties:

E property

Syntax

Math.E 

Attributes

This property is read-only.

Description

Returns the number value for e, the base of the natural logarithms, which is approximately 2.71828182845905.

Return

Floating point.

Example

To display the value of e:

<!--SCRIPT 
a = Math.E;
document.WriteLn( a );
-->

LN2 property

Syntax

Math.LN2 

Attributes

This property is read-only.

Description

Returns the number value for the natural logarithm of 2, which is approximately 0.693147180559945.

Return

Floating point.

Example

To display the value of LN2:

<!--SCRIPT
a = Math.LN2;
document.WriteLn( a );
-->

LN10 property

Syntax

Math.LN10 

Attributes

This property is read-only.

Description

Returns the value for the natural logarithm of 10, which is approximately 2.30258509299405.

Return

Floating point.

Example

To display the value of LN10:

<!--SCRIPT
a = Math.LN10;
document.WriteLn( a );
-->

LOG2E property

Syntax

Math.LOG2E 

Attributes

This property is read-only.

Description

Returns the number value for the base-2 logarithm of e, Euler's constant. This value is approximately 1.44269504088896.

Return

Floating point.

Example

To display the value of LOG2E:

<!--SCRIPT 
a = Math.LOG2E;
document.WriteLn( a );
-->

LOG10E property

Syntax

Math.LOG10E 

Attributes

This property is read-only.

Description

Returns the number value for the base-10 logarithm of e, Euler's constant. This value is approximately 0.434294481903252.

Return

Floating point.

Example

To display the value of LOG10E:

<!--SCRIPT
a = Math.LOG10E;
document.WriteLn( a );
-->

PI property

Syntax

Math.PI 

Attributes

This property is read-only.

Description

Returns the ratio of the circumference of a circle to its diameter, which is approximately 3.14159265358979.

Return

Floating point.

Example

To display the value of PI:

<!--SCRIPT 
a = Math.PI;
document.WriteLn( a );
-->

SQRT1_2 property

Syntax

Math.SQRT1_2 

Attributes

This property is read-only.

Description

Returns the number value for the square root of 1/2, which is approximately 0.707106781186548.

Return

Floating point.

Example

To display the value of the square root of 1/2:

<!--SCRIPT
a = Math.SQRT1_2;
document.WriteLn( a );
-->

SQRT2 property

Syntax

Math.SQRT2 

Attributes

This property is read-only.

Description

Returns the number value for the square root of 2, which is approximately 1.4142135623731.

Return

Floating point.

Example

To display the value of the square root of 2:

<!--SCRIPT
a = Math.SQRT2;
document.WriteLn( a );
-->

 


Copyright © 1999 Sybase, Inc. All rights reserved.