Numeric.toBigInteger - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : Java Application Programming Interface : Numeric Class : OpenMaple/Java/Numeric/toBigInteger

Numeric.toBigInteger

return the value of the Numeric object as a Java BigInteger

 

Calling Sequence

Description

Examples

Compatibility

Calling Sequence

java.math.BigInteger toBigInteger() throws MapleException

Description

• 

The toBigInteger function returns the value represented in the Numeric as a Java BigInteger.

• 

The java.math.BigInteger format can represent arbitrary-precision integers. If the value is not an integer, an error is raised.

• 

To determine if the value is an integer, use the isInteger function.

Examples

import java.math.BigInteger;

import com.maplesoft.openmaple.*;

import com.maplesoft.externalcall.MapleException;

class Example

{

    public static void main( String notused[] ) throws MapleException

    {

        String[] mapleArgs = { "java" };

        Engine engine = new Engine( mapleArgs, new EngineCallBacksDefault(), null, null );

        Numeric n = (Numeric)engine.evaluate( "2^66:" );

        System.out.println( n );

        System.out.println( n.isLong() );

        BigInteger bd = n.toBigInteger();

        System.out.println( bd );

    }

}

Executing this code produces the following output.

302231454903657293676544

false

302231454903657293676544

Compatibility

• 

The Numeric.toBigInteger command was introduced in Maple 2018.

• 

For more information on Maple 2018 changes, see Updates in Maple 2018.

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/API

OpenMaple/Java/Numeric

OpenMaple/Java/Numeric/byteValue

OpenMaple/Java/Numeric/doubleValue

OpenMaple/Java/Numeric/floatValue

OpenMaple/Java/Numeric/intValue

OpenMaple/Java/Numeric/isLong

OpenMaple/Java/Numeric/longValue

OpenMaple/Java/Numeric/shortValue

OpenMaple/Java/Numeric/toBigDecimal