Skip to content

Commit 95608e1

Browse files
committed
Make rounding mode consistent with other benchmarks
1 parent c68aa53 commit 95608e1

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

test/benchmark_libbid.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ __attribute__ ((noinline)) void generate_vector_32(Decimal32* buffer, size_t buf
4949
{
5050
for (size_t i = 0; i < buffer_len; ++i)
5151
{
52-
buffer[i] = bid32_from_uint32(random_uint32(), BID_ROUNDING_DOWN, &flag);
52+
buffer[i] = bid32_from_uint32(random_uint32(), BID_ROUNDING_TO_NEAREST, &flag);
5353
}
5454
}
5555

@@ -86,7 +86,7 @@ __attribute__ ((noinline)) void generate_vector_64(Decimal64* buffer, size_t buf
8686
{
8787
for (size_t i = 0; i < buffer_len; ++i)
8888
{
89-
buffer[i] = bid64_from_uint64(random_uint64(), BID_ROUNDING_DOWN, &flag);
89+
buffer[i] = bid64_from_uint64(random_uint64(), BID_ROUNDING_TO_NEAREST, &flag);
9090
}
9191
}
9292

@@ -164,21 +164,21 @@ typedef Decimal32 (*operation_32)(Decimal32, Decimal32);
164164

165165
__attribute__ ((noinline)) Decimal32 add_32(Decimal32 a, Decimal32 b)
166166
{
167-
return bid32_add(a, b, BID_ROUNDING_DOWN, &flag);
167+
return bid32_add(a, b, BID_ROUNDING_TO_NEAREST, &flag);
168168
}
169169
__attribute__ ((noinline)) Decimal32 sub_32(Decimal32 a, Decimal32 b)
170170
{
171-
return bid32_sub(a, b, BID_ROUNDING_DOWN, &flag);
171+
return bid32_sub(a, b, BID_ROUNDING_TO_NEAREST, &flag);
172172
}
173173

174174
__attribute__ ((noinline)) Decimal32 mul_32(Decimal32 a, Decimal32 b)
175175
{
176-
return bid32_mul(a, b, BID_ROUNDING_DOWN, &flag);
176+
return bid32_mul(a, b, BID_ROUNDING_TO_NEAREST, &flag);
177177
}
178178

179179
__attribute__ ((noinline)) Decimal32 div_32(Decimal32 a, Decimal32 b)
180180
{
181-
return bid32_div(a, b, BID_ROUNDING_DOWN, &flag);
181+
return bid32_div(a, b, BID_ROUNDING_TO_NEAREST, &flag);
182182
}
183183

184184
__attribute__ ((noinline)) void test_two_element_operation_32(Decimal32* data, operation_32 op, const char* label, const char* op_label)
@@ -209,22 +209,22 @@ typedef Decimal64 (*operation_64)(Decimal64, Decimal64);
209209

210210
__attribute__ ((noinline)) Decimal64 add_64(Decimal64 a, Decimal64 b)
211211
{
212-
return bid64_add(a, b, BID_ROUNDING_DOWN, &flag);
212+
return bid64_add(a, b, BID_ROUNDING_TO_NEAREST, &flag);
213213
}
214214

215215
__attribute__ ((noinline)) Decimal64 sub_64(Decimal64 a, Decimal64 b)
216216
{
217-
return bid64_sub(a, b, BID_ROUNDING_DOWN, &flag);
217+
return bid64_sub(a, b, BID_ROUNDING_TO_NEAREST, &flag);
218218
}
219219

220220
__attribute__ ((noinline)) Decimal64 mul_64(Decimal64 a, Decimal64 b)
221221
{
222-
return bid64_mul(a, b, BID_ROUNDING_DOWN, &flag);
222+
return bid64_mul(a, b, BID_ROUNDING_TO_NEAREST, &flag);
223223
}
224224

225225
__attribute__ ((noinline)) Decimal64 div_64(Decimal64 a, Decimal64 b)
226226
{
227-
return bid64_div(a, b, BID_ROUNDING_DOWN, &flag);
227+
return bid64_div(a, b, BID_ROUNDING_TO_NEAREST, &flag);
228228
}
229229

230230
__attribute__ ((noinline)) void test_two_element_operation_64(Decimal64* data, operation_64 op, const char* label, const char* op_label)
@@ -256,22 +256,22 @@ typedef Decimal128 (*operation_128)(Decimal128, Decimal128);
256256

257257
__attribute__ ((__noinline__)) Decimal128 add_128(Decimal128 a, Decimal128 b)
258258
{
259-
return bid128_add(a, b, BID_ROUNDING_DOWN, &flag);
259+
return bid128_add(a, b, BID_ROUNDING_TO_NEAREST, &flag);
260260
}
261261

262262
__attribute__ ((__noinline__)) Decimal128 sub_128(Decimal128 a, Decimal128 b)
263263
{
264-
return bid128_sub(a, b, BID_ROUNDING_DOWN, &flag);
264+
return bid128_sub(a, b, BID_ROUNDING_TO_NEAREST, &flag);
265265
}
266266

267267
__attribute__ ((__noinline__)) Decimal128 mul_128(Decimal128 a, Decimal128 b)
268268
{
269-
return bid128_mul(a, b, BID_ROUNDING_DOWN, &flag);
269+
return bid128_mul(a, b, BID_ROUNDING_TO_NEAREST, &flag);
270270
}
271271

272272
__attribute__ ((__noinline__)) Decimal128 div_128(Decimal128 a, Decimal128 b)
273273
{
274-
return bid128_div(a, b, BID_ROUNDING_DOWN, &flag);
274+
return bid128_div(a, b, BID_ROUNDING_TO_NEAREST, &flag);
275275
}
276276

277277
__attribute__ ((__noinline__)) void test_two_element_operation_128(Decimal128* data, operation_128 op, const char* label, const char* op_label)

0 commit comments

Comments
 (0)