Skip to content

Commit

Permalink
fix INT128_MIN write (#1152)
Browse files Browse the repository at this point in the history
* fix INT128_MIN write

* add write INT128_MIN test

* use Base.uabs

Co-authored-by: Nathan Zimmerberg <[email protected]>

* add BigInt test

---------

Co-authored-by: Nathan Zimmerberg <[email protected]>
  • Loading branch information
belous-dp and nhz2 authored Jan 10, 2025
1 parent 41a6875 commit 8207959
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ end

function writecell(buf, pos, len, io, x::Integer, opts)
if x < 0
x *= -1
x = Base.uabs(x)
@check 1
@inbounds buf[pos] = UInt8('-')
pos += 1
Expand Down
8 changes: 8 additions & 0 deletions test/write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ Base.string(x::AF) = string(x.f)
[StructType(Date("2021-12-01"), "string 1", 123.45), StructType(Date("2021-12-02"), "string 2", 456.78)],
(header=["Date Column", "String Column", "Number Column"],),
"Date Column,String Column,Number Column\n2021-12-01,string 1,123.45\n2021-12-02,string 2,456.78\n"
),
# 1151
(
[(a=Int128(-170141183460469231731687303715884105728),
b=big(-170141183460469231731687303715884105728),
c=big(-170141183460469231731687303715884105729),)],
NamedTuple(),
"a,b,c\n-170141183460469231731687303715884105728,-170141183460469231731687303715884105728,-170141183460469231731687303715884105729\n"
)
]

Expand Down

0 comments on commit 8207959

Please sign in to comment.