Skip to content

Commit 8207959

Browse files
belous-dpnhz2
andauthored
fix INT128_MIN write (#1152)
* fix INT128_MIN write * add write INT128_MIN test * use Base.uabs Co-authored-by: Nathan Zimmerberg <39104088+nhz2@users.noreply.github.com> * add BigInt test --------- Co-authored-by: Nathan Zimmerberg <39104088+nhz2@users.noreply.github.com>
1 parent 41a6875 commit 8207959

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/write.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ end
435435

436436
function writecell(buf, pos, len, io, x::Integer, opts)
437437
if x < 0
438-
x *= -1
438+
x = Base.uabs(x)
439439
@check 1
440440
@inbounds buf[pos] = UInt8('-')
441441
pos += 1

test/write.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ Base.string(x::AF) = string(x.f)
195195
[StructType(Date("2021-12-01"), "string 1", 123.45), StructType(Date("2021-12-02"), "string 2", 456.78)],
196196
(header=["Date Column", "String Column", "Number Column"],),
197197
"Date Column,String Column,Number Column\n2021-12-01,string 1,123.45\n2021-12-02,string 2,456.78\n"
198+
),
199+
# 1151
200+
(
201+
[(a=Int128(-170141183460469231731687303715884105728),
202+
b=big(-170141183460469231731687303715884105728),
203+
c=big(-170141183460469231731687303715884105729),)],
204+
NamedTuple(),
205+
"a,b,c\n-170141183460469231731687303715884105728,-170141183460469231731687303715884105728,-170141183460469231731687303715884105729\n"
198206
)
199207
]
200208

0 commit comments

Comments
 (0)