From ecc77e275f3e54f0ab9336211665ba4fbbf09dad Mon Sep 17 00:00:00 2001 From: Danila Belous Date: Wed, 18 Dec 2024 16:52:54 +0300 Subject: [PATCH 1/4] fix INT128_MIN write --- src/write.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/write.jl b/src/write.jl index b0b14108..314f5e1a 100644 --- a/src/write.jl +++ b/src/write.jl @@ -435,7 +435,7 @@ end function writecell(buf, pos, len, io, x::Integer, opts) if x < 0 - x *= -1 + x = unsigned(-(x + 1)) + 1 @check 1 @inbounds buf[pos] = UInt8('-') pos += 1 From 1c1ce1ede6456be9fed2504413e6485f2ffee7e7 Mon Sep 17 00:00:00 2001 From: Danila Belous Date: Wed, 18 Dec 2024 17:43:10 +0300 Subject: [PATCH 2/4] add write INT128_MIN test --- test/write.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/write.jl b/test/write.jl index a9f683f3..671d8fe0 100644 --- a/test/write.jl +++ b/test/write.jl @@ -195,6 +195,12 @@ 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),)], + NamedTuple(), + "a\n-170141183460469231731687303715884105728\n" ) ] From 636e2027e8c8c302c4fe26db69603406c35759f7 Mon Sep 17 00:00:00 2001 From: belous-dp Date: Mon, 6 Jan 2025 19:54:22 +0300 Subject: [PATCH 3/4] use Base.uabs Co-authored-by: Nathan Zimmerberg <39104088+nhz2@users.noreply.github.com> --- src/write.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/write.jl b/src/write.jl index 314f5e1a..83e38715 100644 --- a/src/write.jl +++ b/src/write.jl @@ -435,7 +435,7 @@ end function writecell(buf, pos, len, io, x::Integer, opts) if x < 0 - x = unsigned(-(x + 1)) + 1 + x = Base.uabs(x) @check 1 @inbounds buf[pos] = UInt8('-') pos += 1 From 39a57a49c10decac8698969f94ff03b13c838fab Mon Sep 17 00:00:00 2001 From: Danila Belous Date: Mon, 6 Jan 2025 23:33:08 +0300 Subject: [PATCH 4/4] add BigInt test --- test/write.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/write.jl b/test/write.jl index 671d8fe0..db965397 100644 --- a/test/write.jl +++ b/test/write.jl @@ -198,9 +198,11 @@ Base.string(x::AF) = string(x.f) ), # 1151 ( - [(a=Int128(-170141183460469231731687303715884105728),)], + [(a=Int128(-170141183460469231731687303715884105728), + b=big(-170141183460469231731687303715884105728), + c=big(-170141183460469231731687303715884105729),)], NamedTuple(), - "a\n-170141183460469231731687303715884105728\n" + "a,b,c\n-170141183460469231731687303715884105728,-170141183460469231731687303715884105728,-170141183460469231731687303715884105729\n" ) ]