ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Node.js Driver API Reference Modules types BigDecimal
For AI agents: a documentation index is available at https://nodejs-rs-driver.docs.scylladb.com/v0.6.1/llms.txt. A Markdown version of this page is at https://nodejs-rs-driver.docs.scylladb.com/v0.6.1/api/types/BigDecimal.md.

BigDecimal¶

types~BigDecimal(unscaledValue, scale)

The BigDecimal class provides operations for arithmetic, scale manipulation, rounding, comparison and format conversion. The #toString method provides a canonical representation of a BigDecimal.

Constructor¶

new BigDecimal(unscaledValue, scale)

Constructs an immutable arbitrary-precision signed decimal number. A BigDecimal consists of an arbitrary precision integer unscaled value and a 32-bit integer scale. If zero or positive, the scale is the number of digits to the right of the decimal point. If negative, the unscaled value of the number is multiplied by ten to the power of the negation of the scale. The value of the number represented by the BigDecimal is therefore (unscaledValue x 10^(-scale)).

Parameters:
Name Type Description
unscaledValue

The integer part of the decimal.

scale

The scale of the decimal.

Source

types/big-decimal.ts, line 12

Methods¶

add(other)

Returns the sum of this and the given BigDecimal.

Parameters:
Name Type Description
other

The BigDecimal to sum to this.

Source

types/big-decimal.ts, line 167

Returns:

The BigDecimal result.

compare(other)

Compares this BigDecimal with the given one.

Parameters:
Name Type Description
other

Integer to compare against.

Source

types/big-decimal.ts, line 118

Returns:

0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.

equals()

Returns true if the value of the BigDecimal instance and other are the same

Source

types/big-decimal.ts, line 100

greaterThan()

Returns true if the current instance is greater than the other

Source

types/big-decimal.ts, line 198

isNegative()

Whether this value is negative.

Source

types/big-decimal.ts, line 203

isZero()

Whether this value is zero.

Source

types/big-decimal.ts, line 208

subtract(other)

Returns the difference of this and the given BigDecimal.

Parameters:
Name Type Description
other

The BigDecimal to subtract from this.

Source

types/big-decimal.ts, line 134

Returns:

The BigDecimal result.

toJSON()

Returns the string representation. Method used by the native JSON.stringify() to serialize this instance.

Source

types/big-decimal.ts, line 251

toNumber()

Returns a Number representation of this BigDecimal.

Source

types/big-decimal.ts, line 243

toString()

Returns the string representation of this BigDecimal

Source

types/big-decimal.ts, line 215

(static) fromBuffer()

Returns the BigDecimal representation of a buffer composed of the scale (int32BE) and the unsigned value (varint BE)

Source

types/big-decimal.ts, line 46

(static) fromNumber()

Returns a BigDecimal representation of the Number

Source

types/big-decimal.ts, line 85

(static) fromString()

Returns a BigDecimal representation of the string

Source

types/big-decimal.ts, line 68

(static) toBuffer()

Returns a buffer representation composed of the scale as a BE int 32 and the unsigned value as a BE varint

Source

types/big-decimal.ts, line 55

Was this page helpful?

PREVIOUS
types
NEXT
Duration
  • Create an issue
  • Edit this page

On this page

  • BigDecimal
    • Constructor
    • Methods
ScyllaDB Node.js Driver
Search Ask AI
  • v0.6.1
    • main
    • v0.6.1
  • Getting Started
  • Statements
    • Executing CQL Statements - Best Practices
    • Unprepared Statements
    • Batch Statements
    • Parameterized queries
  • Fetching Large Result Sets
  • Logging
  • Policies
    • Load Balancing
    • Retry Policies
  • Authentication
  • Shutdown
  • Migration Guide
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • concurrent
      • datastax
        • graph
        • search
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metadata
        • Aggregate
        • ClientState
        • ColumnMetadata
        • Index
        • KeyspaceMetadata
        • MaterializedView
        • Metadata
        • SchemaFunction
        • Strategy
        • TableMetadata
        • UdtField
        • UserDefinedType
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • speculativeExecution
          • ConstantSpeculativeExecutionPolicy
          • NoSpeculativeExecutionPolicy
          • SpeculativeExecutionPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • BigDecimal
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • Long
        • ResultSet
        • ResultStream
        • Row
        • TimeUuid
        • Tuple
        • Uuid
        • Vector
    • Classes
      • AddressResolver
      • ByteOrderedToken
      • Client
      • ColumnInfo
      • DateRange
      • DateRangeBound
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
      • Edge
      • Element
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • GraphResultSet
      • HashSet
      • Host
      • HostMap
      • LineString
      • Murmur3Token
      • Path
      • Point
      • Polygon
      • Property
      • RandomToken
      • SslOptions
      • Token
      • TokenRange
      • Vertex
      • VertexProperty
    • Interfaces
    • Events
    • Global Functions and Constants
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 10 Aug 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3