Fixes for longdouble perl builds
Mostly test fixes, but the Pg 'timestamp' type did have a small conversion bug.
This commit is contained in:
parent
8dca0a22a9
commit
de36b90cde
4 changed files with 8 additions and 5 deletions
|
|
@ -55,7 +55,7 @@ typedef struct {
|
|||
if (SvIOK(val)) iv = SvIV(val); \
|
||||
else if (SvNOK(val)) { \
|
||||
NV nv = SvNV(val); \
|
||||
if (nv < IV_MIN || nv > IV_MAX || fabs(nv - floor(nv)) > 0.0000000001) SERR("expected integer");\
|
||||
if (nv < IV_MIN || nv > IV_MAX || fabs((double)(nv - floor(nv))) > 0.0000000001) SERR("expected integer");\
|
||||
iv = SvIV(val); \
|
||||
} else if (SvPOK(val)) {\
|
||||
STRLEN sl; \
|
||||
|
|
@ -503,7 +503,7 @@ SENDFN(uuid) {
|
|||
RECVFN(timestamp) {
|
||||
RLEN(8);
|
||||
IV ts = fu_frombeI(64, buf);
|
||||
return newSVnv(((double)ts / 1000000) + UNIX_PG_EPOCH);
|
||||
return newSVnv(((NV)ts / 1000000) + UNIX_PG_EPOCH);
|
||||
}
|
||||
|
||||
SENDFN(timestamp) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use Test::More;
|
|||
use Tie::Array;
|
||||
use Tie::Hash;
|
||||
use FU::Util 'json_format';
|
||||
use Config;
|
||||
|
||||
|
||||
sub MyToJSON::TO_JSON { [scalar @_, ref $_[0], ${$_[0]}] }
|
||||
|
|
@ -54,7 +55,7 @@ my @tests = (
|
|||
''.$$, '"'.$$.'"',
|
||||
do { my $x = 12; utf8::decode($x); $x }, '"12"',
|
||||
do { no warnings 'numeric'; my $x = '19a'; $x += 0; $x }, '19',
|
||||
1844674407370955161 / 10, '1.84467440737096e+17',
|
||||
1844674407370955161 / 10, $Config{uselongdouble} ? 184467440737095516 : '1.84467440737096e+17',
|
||||
);
|
||||
|
||||
my @errors = (
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use Test::More;
|
|||
use FU::Util 'json_parse';
|
||||
no warnings 'experimental::builtin';
|
||||
use builtin 'is_bool', 'created_as_number';
|
||||
use Config;
|
||||
|
||||
my @error = (
|
||||
'',
|
||||
|
|
@ -96,8 +97,8 @@ num ' -0 ', 0;
|
|||
num '-9223372036854775808';
|
||||
num '9223372036854775807';
|
||||
num '18446744073709551615';
|
||||
num '-9223372036854775809', -9.22337203685478e+18;
|
||||
num '18446744073709551616', 1.84467440737096e+19;
|
||||
num '-9223372036854775809', $Config{uselongdouble} ? -9.22337203685477581e+18 : -9.22337203685478e+18;
|
||||
num '18446744073709551616', $Config{uselongdouble} ? 1.84467440737095516e+19 : 1.84467440737096e+19;
|
||||
num '1.234';
|
||||
num '1e5', 100000;
|
||||
num '1e+5', 100000;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use v5.36;
|
|||
use Test::More;
|
||||
no warnings 'experimental::builtin';
|
||||
use builtin qw/true false is_bool created_as_number/;
|
||||
use Config;
|
||||
|
||||
plan skip_all => $@ if !eval { require FU::Pg; } && $@ =~ /Unable to load libpq/;
|
||||
die $@ if $@;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue