128-bit and 256-bit decimal classes

128-bit and 256-bit decimal classes

Functions

GArrowDecimal128 * garrow_decimal128_new_string ()
GArrowDecimal128 * garrow_decimal128_new_integer ()
GArrowDecimal128 * garrow_decimal128_copy ()
gboolean garrow_decimal128_equal ()
gboolean garrow_decimal128_not_equal ()
gboolean garrow_decimal128_less_than ()
gboolean garrow_decimal128_less_than_or_equal ()
gboolean garrow_decimal128_greater_than ()
gboolean garrow_decimal128_greater_than_or_equal ()
gchar * garrow_decimal128_to_string_scale ()
gchar * garrow_decimal128_to_string ()
GBytes * garrow_decimal128_to_bytes ()
void garrow_decimal128_abs ()
void garrow_decimal128_negate ()
gint64 garrow_decimal128_to_integer ()
GArrowDecimal128 * garrow_decimal128_plus ()
GArrowDecimal128 * garrow_decimal128_minus ()
GArrowDecimal128 * garrow_decimal128_multiply ()
GArrowDecimal128 * garrow_decimal128_divide ()
GArrowDecimal128 * garrow_decimal128_rescale ()
GArrowDecimal256 * garrow_decimal256_new_string ()
GArrowDecimal256 * garrow_decimal256_new_integer ()
GArrowDecimal256 * garrow_decimal256_copy ()
gboolean garrow_decimal256_equal ()
gboolean garrow_decimal256_not_equal ()
gboolean garrow_decimal256_less_than ()
gboolean garrow_decimal256_less_than_or_equal ()
gboolean garrow_decimal256_greater_than ()
gboolean garrow_decimal256_greater_than_or_equal ()
gchar * garrow_decimal256_to_string_scale ()
gchar * garrow_decimal256_to_string ()
GBytes * garrow_decimal256_to_bytes ()
void garrow_decimal256_abs ()
void garrow_decimal256_negate ()
GArrowDecimal256 * garrow_decimal256_plus ()
GArrowDecimal256 * garrow_decimal256_multiply ()
GArrowDecimal256 * garrow_decimal256_divide ()
GArrowDecimal256 * garrow_decimal256_rescale ()

Properties

gpointer decimal128 Write / Construct Only
gpointer decimal256 Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ├── GArrowDecimal128
    ╰── GArrowDecimal256

Includes

#include <arrow-glib/arrow-glib.h>

Description

GArrowDecimal128 is a 128-bit decimal class.

GArrowDecimal256 is a 256-bit decimal class.

Functions

garrow_decimal128_new_string ()

GArrowDecimal128 *
garrow_decimal128_new_string (const gchar *data,
                              GError **error);

Parameters

data

The data of the decimal.

 

error

Return location for a GError or NULL.

[nullable]

Returns

A newly created GArrowDecimal128 on success, NULL on error.

[nullable]

Since: 0.10.0


garrow_decimal128_new_integer ()

GArrowDecimal128 *
garrow_decimal128_new_integer (const gint64 data);

Parameters

data

The data of the decimal.

 

Returns

A newly created GArrowDecimal128.

Since: 0.10.0


garrow_decimal128_copy ()

GArrowDecimal128 *
garrow_decimal128_copy (GArrowDecimal128 *decimal);

Parameters

decimal

The decimal to be copied.

 

Returns

A copied GArrowDecimal128.

[transfer full]

Since: 3.0.0


garrow_decimal128_equal ()

gboolean
garrow_decimal128_equal (GArrowDecimal128 *decimal,
                         GArrowDecimal128 *other_decimal);

Parameters

decimal

A GArrowDecimal128.

 

other_decimal

A GArrowDecimal128 to be compared.

 

Returns

TRUE if the decimal is equal to the other decimal, FALSE otherwise.

Since: 0.12.0


garrow_decimal128_not_equal ()

gboolean
garrow_decimal128_not_equal (GArrowDecimal128 *decimal,
                             GArrowDecimal128 *other_decimal);

Parameters

decimal

A GArrowDecimal128.

 

other_decimal

A GArrowDecimal128 to be compared.

 

Returns

TRUE if the decimal isn't equal to the other decimal, FALSE otherwise.

Since: 0.12.0


garrow_decimal128_less_than ()

gboolean
garrow_decimal128_less_than (GArrowDecimal128 *decimal,
                             GArrowDecimal128 *other_decimal);

Parameters

decimal

A GArrowDecimal128.

 

other_decimal

A GArrowDecimal128 to be compared.

 

Returns

TRUE if the decimal is less than the other decimal, FALSE otherwise.

Since: 0.12.0


garrow_decimal128_less_than_or_equal ()

gboolean
garrow_decimal128_less_than_or_equal (GArrowDecimal128 *decimal,
                                      GArrowDecimal128 *other_decimal);

Parameters

decimal

A GArrowDecimal128.

 

other_decimal

A GArrowDecimal128 to be compared.

 

Returns

TRUE if the decimal is less than the other decimal or equal to the other decimal, FALSE otherwise.

Since: 0.12.0


garrow_decimal128_greater_than ()

gboolean
garrow_decimal128_greater_than (GArrowDecimal128 *decimal,
                                GArrowDecimal128 *other_decimal);

Parameters

decimal

A GArrowDecimal128.

 

other_decimal

A GArrowDecimal128 to be compared.

 

Returns

TRUE if the decimal is greater than the other decimal, FALSE otherwise.

Since: 0.12.0


garrow_decimal128_greater_than_or_equal ()

gboolean
garrow_decimal128_greater_than_or_equal
                               (GArrowDecimal128 *decimal,
                                GArrowDecimal128 *other_decimal);

Parameters

decimal

A GArrowDecimal128.

 

other_decimal

A GArrowDecimal128 to be compared.

 

Returns

TRUE if the decimal is greater than the other decimal or equal to the other decimal, FALSE otherwise.

Since: 0.12.0


garrow_decimal128_to_string_scale ()

gchar *
garrow_decimal128_to_string_scale (GArrowDecimal128 *decimal,
                                   gint32 scale);

Parameters

decimal

A GArrowDecimal128.

 

scale

The scale of the decimal.

 

Returns

The string representation of the decimal.

It should be freed with g_free() when no longer needed.

Since: 0.10.0


garrow_decimal128_to_string ()

gchar *
garrow_decimal128_to_string (GArrowDecimal128 *decimal);

Parameters

decimal

A GArrowDecimal128.

 

Returns

The string representation of the decimal.

It should be freed with g_free() when no longer needed.

Since: 0.10.0


garrow_decimal128_to_bytes ()

GBytes *
garrow_decimal128_to_bytes (GArrowDecimal128 *decimal);

Parameters

decimal

A GArrowDecimal128.

 

Returns

The binary representation of the decimal.

[transfer full]

Since: 3.0.0


garrow_decimal128_abs ()

void
garrow_decimal128_abs (GArrowDecimal128 *decimal);

Computes the absolute value of the decimal destructively.

Parameters

decimal

A GArrowDecimal128.

 

Since: 0.10.0


garrow_decimal128_negate ()

void
garrow_decimal128_negate (GArrowDecimal128 *decimal);

Negate the current value of the decimal destructively.

Parameters

decimal

A GArrowDecimal128.

 

Since: 0.10.0


garrow_decimal128_to_integer ()

gint64
garrow_decimal128_to_integer (GArrowDecimal128 *decimal);

Parameters

decimal

A GArrowDecimal128.

 

Returns

The 64-bit integer representation of the decimal.

Since: 0.10.0


garrow_decimal128_plus ()

GArrowDecimal128 *
garrow_decimal128_plus (GArrowDecimal128 *left,
                        GArrowDecimal128 *right);

Parameters

left

A GArrowDecimal128.

 

right

A GArrowDecimal128.

 

Returns

The added value of these decimals.

[transfer full]

Since: 0.11.0


garrow_decimal128_minus ()

GArrowDecimal128 *
garrow_decimal128_minus (GArrowDecimal128 *left,
                         GArrowDecimal128 *right);

Parameters

left

A GArrowDecimal128.

 

right

A GArrowDecimal128.

 

Returns

The subtracted value of these decimals.

[transfer full]

Since: 0.11.0


garrow_decimal128_multiply ()

GArrowDecimal128 *
garrow_decimal128_multiply (GArrowDecimal128 *left,
                            GArrowDecimal128 *right);

Parameters

left

A GArrowDecimal128.

 

right

A GArrowDecimal128.

 

Returns

The multiplied value of these decimals.

[transfer full]

Since: 0.11.0


garrow_decimal128_divide ()

GArrowDecimal128 *
garrow_decimal128_divide (GArrowDecimal128 *left,
                          GArrowDecimal128 *right,
                          GArrowDecimal128 **remainder,
                          GError **error);

Parameters

left

A GArrowDecimal128.

 

right

A GArrowDecimal128.

 

remainder

A return location for the remainder value of these decimals. The returned GArrowDecimal128 be unreferred with g_object_unref() when no longer needed.

[out][nullable]

error

Return location for a GError or NULL.

[nullable]

Returns

The divided value of these decimals or NULL on error.

[nullable][transfer full]

Since: 0.11.0


garrow_decimal128_rescale ()

GArrowDecimal128 *
garrow_decimal128_rescale (GArrowDecimal128 *decimal,
                           gint32 original_scale,
                           gint32 new_scale,
                           GError **error);

Parameters

decimal

A GArrowDecimal128.

 

original_scale

A scale to be converted from.

 

new_scale

A scale to be converted to.

 

error

Return location for a GError or NULL.

[nullable]

Returns

The rescaled decimal or NULL on error.

[nullable][transfer full]

Since: 0.15.0


garrow_decimal256_new_string ()

GArrowDecimal256 *
garrow_decimal256_new_string (const gchar *data,
                              GError **error);

Parameters

data

The data of the decimal.

 

error

Return location for a GError or NULL.

[nullable]

Returns

A newly created GArrowDecimal256 on success, NULL on error.

[nullable]

Since: 3.0.0


garrow_decimal256_new_integer ()

GArrowDecimal256 *
garrow_decimal256_new_integer (const gint64 data);

Parameters

data

The data of the decimal.

 

Returns

A newly created GArrowDecimal256.

Since: 3.0.0


garrow_decimal256_copy ()

GArrowDecimal256 *
garrow_decimal256_copy (GArrowDecimal256 *decimal);

Parameters

decimal

The decimal to be copied.

 

Returns

A copied GArrowDecimal256.

[transfer full]

Since: 3.0.0


garrow_decimal256_equal ()

gboolean
garrow_decimal256_equal (GArrowDecimal256 *decimal,
                         GArrowDecimal256 *other_decimal);

Parameters

decimal

A GArrowDecimal256.

 

other_decimal

A GArrowDecimal256 to be compared.

 

Returns

TRUE if the decimal is equal to the other decimal, FALSE otherwise.

Since: 3.0.0


garrow_decimal256_not_equal ()

gboolean
garrow_decimal256_not_equal (GArrowDecimal256 *decimal,
                             GArrowDecimal256 *other_decimal);

Parameters

decimal

A GArrowDecimal256.

 

other_decimal

A GArrowDecimal256 to be compared.

 

Returns

TRUE if the decimal isn't equal to the other decimal, FALSE otherwise.

Since: 3.0.0


garrow_decimal256_less_than ()

gboolean
garrow_decimal256_less_than (GArrowDecimal256 *decimal,
                             GArrowDecimal256 *other_decimal);

Parameters

decimal

A GArrowDecimal256.

 

other_decimal

A GArrowDecimal256 to be compared.

 

Returns

TRUE if the decimal is less than the other decimal, FALSE otherwise.

Since: 3.0.0


garrow_decimal256_less_than_or_equal ()

gboolean
garrow_decimal256_less_than_or_equal (GArrowDecimal256 *decimal,
                                      GArrowDecimal256 *other_decimal);

Parameters

decimal

A GArrowDecimal256.

 

other_decimal

A GArrowDecimal256 to be compared.

 

Returns

TRUE if the decimal is less than the other decimal or equal to the other decimal, FALSE otherwise.

Since: 3.0.0


garrow_decimal256_greater_than ()

gboolean
garrow_decimal256_greater_than (GArrowDecimal256 *decimal,
                                GArrowDecimal256 *other_decimal);

Parameters

decimal

A GArrowDecimal256.

 

other_decimal

A GArrowDecimal256 to be compared.

 

Returns

TRUE if the decimal is greater than the other decimal, FALSE otherwise.

Since: 3.0.0


garrow_decimal256_greater_than_or_equal ()

gboolean
garrow_decimal256_greater_than_or_equal
                               (GArrowDecimal256 *decimal,
                                GArrowDecimal256 *other_decimal);

Parameters

decimal

A GArrowDecimal256.

 

other_decimal

A GArrowDecimal256 to be compared.

 

Returns

TRUE if the decimal is greater than the other decimal or equal to the other decimal, FALSE otherwise.

Since: 3.0.0


garrow_decimal256_to_string_scale ()

gchar *
garrow_decimal256_to_string_scale (GArrowDecimal256 *decimal,
                                   gint32 scale);

Parameters

decimal

A GArrowDecimal256.

 

scale

The scale of the decimal.

 

Returns

The string representation of the decimal.

It should be freed with g_free() when no longer needed.

Since: 3.0.0


garrow_decimal256_to_string ()

gchar *
garrow_decimal256_to_string (GArrowDecimal256 *decimal);

Parameters

decimal

A GArrowDecimal256.

 

Returns

The string representation of the decimal.

It should be freed with g_free() when no longer needed.

Since: 3.0.0


garrow_decimal256_to_bytes ()

GBytes *
garrow_decimal256_to_bytes (GArrowDecimal256 *decimal);

Parameters

decimal

A GArrowDecimal256.

 

Returns

The binary representation of the decimal.

[transfer full]

Since: 3.0.0


garrow_decimal256_abs ()

void
garrow_decimal256_abs (GArrowDecimal256 *decimal);

Computes the absolute value of the decimal destructively.

Parameters

decimal

A GArrowDecimal256.

 

Since: 3.0.0


garrow_decimal256_negate ()

void
garrow_decimal256_negate (GArrowDecimal256 *decimal);

Negate the current value of the decimal destructively.

Parameters

decimal

A GArrowDecimal256.

 

Since: 3.0.0


garrow_decimal256_plus ()

GArrowDecimal256 *
garrow_decimal256_plus (GArrowDecimal256 *left,
                        GArrowDecimal256 *right);

Parameters

left

A GArrowDecimal256.

 

right

A GArrowDecimal256.

 

Returns

The added value of these decimals.

[transfer full]

Since: 3.0.0


garrow_decimal256_multiply ()

GArrowDecimal256 *
garrow_decimal256_multiply (GArrowDecimal256 *left,
                            GArrowDecimal256 *right);

Parameters

left

A GArrowDecimal256.

 

right

A GArrowDecimal256.

 

Returns

The multiplied value of these decimals.

[transfer full]

Since: 3.0.0


garrow_decimal256_divide ()

GArrowDecimal256 *
garrow_decimal256_divide (GArrowDecimal256 *left,
                          GArrowDecimal256 *right,
                          GArrowDecimal256 **remainder,
                          GError **error);

Parameters

left

A GArrowDecimal256.

 

right

A GArrowDecimal256.

 

remainder

A return location for the remainder value of these decimals. The returned GArrowDecimal256 be unreferred with g_object_unref() when no longer needed.

[out][nullable]

error

Return location for a GError or NULL.

[nullable]

Returns

The divided value of these decimals or NULL on error.

[nullable][transfer full]

Since: 3.0.0


garrow_decimal256_rescale ()

GArrowDecimal256 *
garrow_decimal256_rescale (GArrowDecimal256 *decimal,
                           gint32 original_scale,
                           gint32 new_scale,
                           GError **error);

Parameters

decimal

A GArrowDecimal256.

 

original_scale

A scale to be converted from.

 

new_scale

A scale to be converted to.

 

error

Return location for a GError or NULL.

[nullable]

Returns

The rescaled decimal or NULL on error.

[nullable][transfer full]

Since: 3.0.0

Types and Values

struct GArrowDecimal128Class

struct GArrowDecimal128Class {
  GObjectClass parent_class;
};

struct GArrowDecimal256Class

struct GArrowDecimal256Class {
  GObjectClass parent_class;
};

GArrowDecimal128

typedef struct _GArrowDecimal128 GArrowDecimal128;

GArrowDecimal256

typedef struct _GArrowDecimal256 GArrowDecimal256;

Property Details

The “decimal128” property

  “decimal128”               gpointer

The raw std::shared<arrow::Decimal128> *.

Owner: GArrowDecimal128

Flags: Write / Construct Only


The “decimal256” property

  “decimal256”               gpointer

The raw std::shared<arrow::Decimal256> *.

Owner: GArrowDecimal256

Flags: Write / Construct Only