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

Caution

You're viewing documentation for an unstable version of ScyllaDB Node.js Driver. Switch to the latest stable version.

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.js, line 11

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.js, line 147

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.js, line 105

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.js, line 90

greaterThan()

Returns true if the current instance is greater than the other

Source

types/big-decimal.js, line 172

isNegative()

Whether this value is negative.

Source

types/big-decimal.js, line 176

isZero()

Whether this value is zero.

Source

types/big-decimal.js, line 180

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.js, line 120

Returns:

The BigDecimal result.

toJSON()

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

Source

types/big-decimal.js, line 218

toNumber()

Returns a Number representation of this BigDecimal.

Source

types/big-decimal.js, line 211

toString()

Returns the string representation of this BigDecimal

Source

types/big-decimal.js, line 186

(static) fromBuffer()

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

Source

types/big-decimal.js, line 43

(static) fromNumber()

Returns a BigDecimal representation of the Number

Source

types/big-decimal.js, line 76

(static) fromString()

Returns a BigDecimal representation of the string

Source

types/big-decimal.js, line 60

(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.js, line 51

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
  • main
    • 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 20 Jun 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.2