Siebel eScript Language Reference > Methods Reference > Conversion Methods >

Convert Number to Exponential Notation Method


The Convert Number to Exponential Notation method converts a number to exponential notation. It returns the number that the numberVar variable contains, expressed in exponential notation to the number of decimal places that you specify in the len argument.

Format

numberVar.toExponential(len)

Table 87 describes the arguments for the Convert Number to Exponential Notation method.

Table 87. Arguments for the Convert Number to Exponential Notation Method
Argument
Description

len

The number of decimal places in the significant digits portion of the number.

How the Convert Number to Exponential Notation Method Handles the Len Argument

The Convert Number to Exponential Notation method does one of the following depending on one of the following values that the len argument contains:

  • Less than the number of significant decimal places that the numberVar variable contains. It does one of the following:
    • If the number is five or greater, then it rounds the result up.
    • If the number is less than five, then it rounds the result down.
  • Greater than the number of significant decimal places that the numberVar variable contains. It pads the extra places with zeroes.
  • Negative. It creates an error.
Using a Multivalue List to Avoid Unexpected Rounding

If you must use a value that exceeds 253, then it is recommended that you use a calculated field that uses the sum of a multivalue list instead of using Siebel eScript. If Siebel CRM performs an operation that results in a value that exceeds 253, then it rounds this value to 253.

The largest number that the Siebel eScript engine can hold is 253. This number is equivalent to the following values:

  • 9.00719925 x 1015, with rounding
  • 9,007,199,254,740,992, without rounding
Example

The following example uses the Convert Number to Exponential Notation method:

var num = 1234.567
var num3 = num.toExponential(3) //returns 1.235e+3
var num2 = num.toExponential(0) //returns 1e+3
var num9 = num.toExponential(9) //returns 1.234567000e+3

var smallnum = 0.0001234
var smallnum2 = smallnum.toExponential(2) //returns 1.2e-4
var smallnumerr = smallnum.toExponential(-1) //throws error

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.