-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
decimal.h
182 lines (171 loc) · 6.24 KB
/
decimal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#pragma once
#include <glib-object.h>
#include <arrow-glib/version.h>
G_BEGIN_DECLS
/* Disabled because it conflicts with GARROW_TYPE_DECIMAL128 in GArrowType. */
/* #define GARROW_TYPE_DECIMAL128 (garrow_decimal128_get_type()) */
GARROW_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE(GArrowDecimal128, garrow_decimal128, GARROW, DECIMAL128, GObject)
struct _GArrowDecimal128Class
{
GObjectClass parent_class;
};
GARROW_AVAILABLE_IN_ALL
GArrowDecimal128 *
garrow_decimal128_new_string(const gchar *data, GError **error);
GARROW_AVAILABLE_IN_ALL
GArrowDecimal128 *
garrow_decimal128_new_integer(const gint64 data);
GARROW_AVAILABLE_IN_3_0
GArrowDecimal128 *
garrow_decimal128_copy(GArrowDecimal128 *decimal);
GARROW_AVAILABLE_IN_0_12
gboolean
garrow_decimal128_equal(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal);
GARROW_AVAILABLE_IN_0_12
gboolean
garrow_decimal128_not_equal(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal);
GARROW_AVAILABLE_IN_0_12
gboolean
garrow_decimal128_less_than(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal);
GARROW_AVAILABLE_IN_0_12
gboolean
garrow_decimal128_less_than_or_equal(GArrowDecimal128 *decimal,
GArrowDecimal128 *other_decimal);
GARROW_AVAILABLE_IN_0_12
gboolean
garrow_decimal128_greater_than(GArrowDecimal128 *decimal,
GArrowDecimal128 *other_decimal);
GARROW_AVAILABLE_IN_0_12
gboolean
garrow_decimal128_greater_than_or_equal(GArrowDecimal128 *decimal,
GArrowDecimal128 *other_decimal);
GARROW_AVAILABLE_IN_ALL
gchar *
garrow_decimal128_to_string_scale(GArrowDecimal128 *decimal, gint32 scale);
GARROW_AVAILABLE_IN_ALL
gchar *
garrow_decimal128_to_string(GArrowDecimal128 *decimal);
GARROW_AVAILABLE_IN_3_0
GBytes *
garrow_decimal128_to_bytes(GArrowDecimal128 *decimal);
GARROW_AVAILABLE_IN_ALL
void
garrow_decimal128_abs(GArrowDecimal128 *decimal);
GARROW_AVAILABLE_IN_ALL
void
garrow_decimal128_negate(GArrowDecimal128 *decimal);
GARROW_AVAILABLE_IN_ALL
gint64
garrow_decimal128_to_integer(GArrowDecimal128 *decimal);
GARROW_AVAILABLE_IN_ALL
GArrowDecimal128 *
garrow_decimal128_plus(GArrowDecimal128 *left, GArrowDecimal128 *right);
GARROW_AVAILABLE_IN_ALL
GArrowDecimal128 *
garrow_decimal128_minus(GArrowDecimal128 *left, GArrowDecimal128 *right);
GARROW_AVAILABLE_IN_ALL
GArrowDecimal128 *
garrow_decimal128_multiply(GArrowDecimal128 *left, GArrowDecimal128 *right);
GARROW_AVAILABLE_IN_ALL
GArrowDecimal128 *
garrow_decimal128_divide(GArrowDecimal128 *left,
GArrowDecimal128 *right,
GArrowDecimal128 **remainder,
GError **error);
GARROW_AVAILABLE_IN_0_15
GArrowDecimal128 *
garrow_decimal128_rescale(GArrowDecimal128 *decimal,
gint32 original_scale,
gint32 new_scale,
GError **error);
/* Disabled because it conflicts with GARROW_TYPE_DECIMAL256 in GArrowType. */
/* #define GARROW_TYPE_DECIMAL256 (garrow_decimal256_get_type()) */
GARROW_AVAILABLE_IN_3_0
G_DECLARE_DERIVABLE_TYPE(GArrowDecimal256, garrow_decimal256, GARROW, DECIMAL256, GObject)
struct _GArrowDecimal256Class
{
GObjectClass parent_class;
};
GARROW_AVAILABLE_IN_3_0
GArrowDecimal256 *
garrow_decimal256_new_string(const gchar *data, GError **error);
GARROW_AVAILABLE_IN_3_0
GArrowDecimal256 *
garrow_decimal256_new_integer(const gint64 data);
GARROW_AVAILABLE_IN_3_0
GArrowDecimal256 *
garrow_decimal256_copy(GArrowDecimal256 *decimal);
GARROW_AVAILABLE_IN_3_0
gboolean
garrow_decimal256_equal(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal);
GARROW_AVAILABLE_IN_3_0
gboolean
garrow_decimal256_not_equal(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal);
GARROW_AVAILABLE_IN_3_0
gboolean
garrow_decimal256_less_than(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal);
GARROW_AVAILABLE_IN_3_0
gboolean
garrow_decimal256_less_than_or_equal(GArrowDecimal256 *decimal,
GArrowDecimal256 *other_decimal);
GARROW_AVAILABLE_IN_3_0
gboolean
garrow_decimal256_greater_than(GArrowDecimal256 *decimal,
GArrowDecimal256 *other_decimal);
GARROW_AVAILABLE_IN_3_0
gboolean
garrow_decimal256_greater_than_or_equal(GArrowDecimal256 *decimal,
GArrowDecimal256 *other_decimal);
GARROW_AVAILABLE_IN_3_0
gchar *
garrow_decimal256_to_string_scale(GArrowDecimal256 *decimal, gint32 scale);
GARROW_AVAILABLE_IN_3_0
gchar *
garrow_decimal256_to_string(GArrowDecimal256 *decimal);
GARROW_AVAILABLE_IN_3_0
GBytes *
garrow_decimal256_to_bytes(GArrowDecimal256 *decimal);
GARROW_AVAILABLE_IN_3_0
void
garrow_decimal256_abs(GArrowDecimal256 *decimal);
GARROW_AVAILABLE_IN_3_0
void
garrow_decimal256_negate(GArrowDecimal256 *decimal);
GARROW_AVAILABLE_IN_3_0
GArrowDecimal256 *
garrow_decimal256_plus(GArrowDecimal256 *left, GArrowDecimal256 *right);
GARROW_AVAILABLE_IN_3_0
GArrowDecimal256 *
garrow_decimal256_multiply(GArrowDecimal256 *left, GArrowDecimal256 *right);
GARROW_AVAILABLE_IN_3_0
GArrowDecimal256 *
garrow_decimal256_divide(GArrowDecimal256 *left,
GArrowDecimal256 *right,
GArrowDecimal256 **remainder,
GError **error);
GARROW_AVAILABLE_IN_3_0
GArrowDecimal256 *
garrow_decimal256_rescale(GArrowDecimal256 *decimal,
gint32 original_scale,
gint32 new_scale,
GError **error);
G_END_DECLS