Use the shortest representation when printing doubles

- Use the shortest representation (enough to guarantee roundtrip).
- Uses scientific notation for absolute numbers smaller than 1e-8. The previous behaviour was to output 0 for absolute values smaller than 1e-12 and fixed notation for anything bigger than that.
- Uses scientific notation for absolute numbers greater than 1e+15 (same behaviour).
- The precision parameter now also affects the scientific notation (before it was fixed [5-8]).
- All output functions now respect the requested precision (without any limits).
- The default precision is the same (9 for GeoJSON, 15 for everything else).

Many regress test changed mainly because of the fixes to the precision parameter, which is now respected as the amount of digits after the fixed point.

Closes https://github.com/postgis/postgis/pull/570
Closes #4660
This commit is contained in:
Raúl Marín 2020-04-19 18:14:29 +02:00
parent a714a46803
commit 1343712277
68 changed files with 2427 additions and 2059 deletions

17
NEWS
View file

@ -2,6 +2,23 @@ PostGIS 3.1.0beta1
2020/xx/xx
Only tickets not included in 3.1.0alpha2
* New features *
-
* Enhancements *
- #4660, Changes in double / coordinate printing (Raúl Marín)
- Use the shortest representation (enough to guarantee roundtrip).
- Uses scientific notation for absolute numbers smaller than 1e-8.
The previous behaviour was to output 0 for absolute values smaller than
1e-12 and fixed notation for anything bigger than that.
- Uses scientific notation for absolute numbers greater than 1e+15 (same behaviour).
- The precision parameter now also affects the scientific notation (before it was fixed [5-8]).
- All output functions now respect the requested precision (without any limits).
- The default precision is the same (9 for GeoJSON, 15 for everything else).
* Bug fixes *
-
PostGIS 3.1.0alpha2
2020/07/18

View file

@ -29,7 +29,7 @@ SHELL = @SHELL@
INSTALL = @INSTALL@
LIBTOOL = @LIBTOOL@
RYU_OBJS = d2fixed.o
RYU_OBJS = d2s.o
LT_RYU_OBJS = $(RYU_OBJS:.o=.lo)
all: @RYU_LIB@

104
deps/ryu/README.md vendored
View file

@ -20,110 +20,24 @@ Ryu Printf implements %f and %e formatting in a way that should be drop-in compa
The C implementation of Ryu comes from the ryu/ directory in the git repostitory (https://github.com/ulfjack/ryu).
We've only copied the necessary files, that is `d2fixed.c` and its headers. It is integrated in the project by generating a static library, libryu.la.
We've only copied the necessary files, that is `d2s.c` and its headers. It is integrated in the project by generating a static library, libryu.la.
### Main considerations about the library
The library has one single function to connect to liblwgeom, lwprint_double, which matches the behaviour as closely as possible to the previous output, based on printf. We only use 2 functions from ryu:
- d2fixed_buffered_n: Prints a double with decimal notation.
- d2exp_buffered_n: Prints a double with exponential notation.
- d2sfixed_buffered_n: Prints a double with decimal notation.
- d2sexp_buffered_n: Prints a double with exponential notation.
To speed up the removal of trailing zeros, extra code has been added to ryu itself since it already had the information necessary to do it. It has been proposed (https://github.com/ulfjack/ryu/issues/142), but it isn't included upstream yet. The full changediff is:
```diff
diff --git a/ryu/d2fixed.c b/ryu/d2fixed.c
index b008dab..3bcc22f 100644
--- a/ryu/d2fixed.c
+++ b/ryu/d2fixed.c
@@ -420,7 +420,8 @@ int d2fixed_buffered_n(double d, uint32_t precision, char* result) {
if (!nonzero) {
result[index++] = '0';
}
- if (precision > 0) {
+ const bool printDecimalPoint = precision > 0;
+ if (printDecimalPoint) {
result[index++] = '.';
}
#ifdef RYU_DEBUG
@@ -532,6 +533,18 @@ int d2fixed_buffered_n(double d, uint32_t precision, char* result) {
memset(result + index, '0', precision);
index += precision;
}
+
+#if RYU_NO_TRAILING_ZEROS
+ if (printDecimalPoint) {
+ while (result[index - 1] == '0') {
+ index--;
+ }
+ if (result[index - 1] == '.') {
+ index--;
+ }
+ }
+#endif
+
return index;
}
@@ -771,6 +784,18 @@ int d2exp_buffered_n(double d, uint32_t precision, char* result) {
}
}
}
+
+#if RYU_NO_TRAILING_ZEROS
+ if (printDecimalPoint) {
+ while (result[index - 1] == '0') {
+ index--;
+ }
+ if (result[index - 1] == '.') {
+ index--;
+ }
+ }
+#endif
+
result[index++] = 'e';
if (exp < 0) {
result[index++] = '-';
```
It is hidden behind `RYU_NO_TRAILING_ZEROS` so that macro has to be passed during compilation.
And to avoid ubsan warnings, the following changes have been introduced:
```diff
diff --git a/deps/ryu/d2fixed.c b/deps/ryu/d2fixed.c
index 3bcc22f48..b23ca17c4 100644
--- a/deps/ryu/d2fixed.c
+++ b/deps/ryu/d2fixed.c
@@ -402,10 +402,10 @@ int d2fixed_buffered_n(double d, uint32_t precision, char* result) {
printf("len=%d\n", len);
#endif
for (int32_t i = len - 1; i >= 0; --i) {
- const uint32_t j = p10bits - e2;
+ const int32_t j = ((int32_t) p10bits) - e2;
// Temporary: j is usually around 128, and by shifting a bit, we push it to 128 or above, which is
// a slightly faster code path in mulShift_mod1e9. Instead, we can just increase the multipliers.
- const uint32_t digits = mulShift_mod1e9(m2 << 8, POW10_SPLIT[POW10_OFFSET[idx] + i], (int32_t) (j + 8));
+ const uint32_t digits = mulShift_mod1e9(m2 << 8, POW10_SPLIT[POW10_OFFSET[idx] + i], j + 8);
if (nonzero) {
append_nine_digits(digits, result + index);
index += 9;
@@ -630,10 +630,10 @@ int d2exp_buffered_n(double d, uint32_t precision, char* result) {
printf("len=%d\n", len);
#endif
for (int32_t i = len - 1; i >= 0; --i) {
- const uint32_t j = p10bits - e2;
+ const int32_t j = ((int32_t) p10bits) - e2;
// Temporary: j is usually around 128, and by shifting a bit, we push it to 128 or above, which is
// a slightly faster code path in mulShift_mod1e9. Instead, we can just increase the multipliers.
- digits = mulShift_mod1e9(m2 << 8, POW10_SPLIT[POW10_OFFSET[idx] + i], (int32_t) (j + 8));
+ digits = mulShift_mod1e9(m2 << 8, POW10_SPLIT[POW10_OFFSET[idx] + i], j + 8);
if (printedDigits != 0) {
if (printedDigits + 9 > precision) {
availableDigits = 9;
```
Both functions have been heavily modified to support a new precision parameter that limits the amount of digits that are included after the floating point. This precision parameter affects both the scientific and fixed notation and respects proper rounding (round to nearest, ties to even).
The output has also been changed to match the old behaviour:
- Uses "e+1" instead of E1.
- Uses "e-1" instead of E-1.
- Never outputs negative 0. It always returns "0".
### Dependency changelog
- 2019-01-10 - [Ryu] Library extraction from https://github.com/ulfjack/ryu/tree/master/ryu. Added changes to remove trailing zeros from the output and minor changes to please ubsan.
- 2020-07-20 - [Ryu] Switch from d2fixed/d2exp to d2sfixed/d2sexp, that is, using the shortest notation

24
deps/ryu/common.h vendored
View file

@ -30,6 +30,7 @@ static inline uint32_t decimalLength9(const uint32_t v) {
// Function precondition: v is not a 10-digit number.
// (f2s: 9 digits are sufficient for round-tripping.)
// (d2fixed: We print 9-digit blocks.)
assert(v >= 0);
assert(v < 1000000000);
if (v >= 100000000) { return 9; }
if (v >= 10000000) { return 8; }
@ -42,16 +43,6 @@ static inline uint32_t decimalLength9(const uint32_t v) {
return 1;
}
// Returns e == 0 ? 1 : [log_2(5^e)]; requires 0 <= e <= 3528.
static inline int32_t log2pow5(const int32_t e) {
// This approximation works up to the point that the multiplication overflows at e = 3529.
// If the multiplication were done in 64 bits, it would fail at 5^4004 which is just greater
// than 2^9297.
assert(e >= 0);
assert(e <= 3528);
return (int32_t) ((((uint32_t) e) * 1217359) >> 19);
}
// Returns e == 0 ? 1 : ceil(log_2(5^e)); requires 0 <= e <= 3528.
static inline int32_t pow5bits(const int32_t e) {
// This approximation works up to the point that the multiplication overflows at e = 3529.
@ -64,7 +55,7 @@ static inline int32_t pow5bits(const int32_t e) {
// Returns e == 0 ? 1 : ceil(log_2(5^e)); requires 0 <= e <= 3528.
static inline int32_t ceil_log2pow5(const int32_t e) {
return log2pow5(e) + 1;
return pow5bits(e);
}
// Returns floor(log_10(2^e)); requires 0 <= e <= 1650.
@ -88,15 +79,16 @@ static inline int copy_special_str(char * const result, const bool sign, const b
memcpy(result, "NaN", 3);
return 3;
}
if (sign) {
result[0] = '-';
}
if (exponent) {
/* PostGIS: Do not print signed zero */
if (sign) {
result[0] = '-';
}
memcpy(result + sign, "Infinity", 8);
return sign + 8;
}
memcpy(result + sign, "0E0", 3);
return sign + 3;
memcpy(result, "0", 1);
return 1;
}
static inline uint32_t float_to_bits(const float f) {

830
deps/ryu/d2fixed.c vendored
View file

@ -1,830 +0,0 @@
// Copyright 2018 Ulf Adams
//
// The contents of this file may be used under the terms of the Apache License,
// Version 2.0.
//
// (See accompanying file LICENSE-Apache or copy at
// http://www.apache.org/licenses/LICENSE-2.0)
//
// Alternatively, the contents of this file may be used under the terms of
// the Boost Software License, Version 1.0.
// (See accompanying file LICENSE-Boost or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//
// Unless required by applicable law or agreed to in writing, this software
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.
// Runtime compiler options:
// -DRYU_DEBUG Generate verbose debugging output to stdout.
//
// -DRYU_ONLY_64_BIT_OPS Avoid using uint128_t or 64-bit intrinsics. Slower,
// depending on your compiler.
//
// -DRYU_AVOID_UINT128 Avoid using uint128_t. Slower, depending on your compiler.
#include "ryu/ryu.h"
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#ifdef RYU_DEBUG
#include <inttypes.h>
#include <stdio.h>
#endif
#include "ryu/common.h"
#include "ryu/digit_table.h"
#include "ryu/d2fixed_full_table.h"
#include "ryu/d2s_intrinsics.h"
#define DOUBLE_MANTISSA_BITS 52
#define DOUBLE_EXPONENT_BITS 11
#define DOUBLE_BIAS 1023
#define POW10_ADDITIONAL_BITS 120
#if defined(HAS_UINT128)
static inline uint128_t umul256(const uint128_t a, const uint64_t bHi, const uint64_t bLo, uint128_t* const productHi) {
const uint64_t aLo = (uint64_t)a;
const uint64_t aHi = (uint64_t)(a >> 64);
const uint128_t b00 = (uint128_t)aLo * bLo;
const uint128_t b01 = (uint128_t)aLo * bHi;
const uint128_t b10 = (uint128_t)aHi * bLo;
const uint128_t b11 = (uint128_t)aHi * bHi;
const uint64_t b00Lo = (uint64_t)b00;
const uint64_t b00Hi = (uint64_t)(b00 >> 64);
const uint128_t mid1 = b10 + b00Hi;
const uint64_t mid1Lo = (uint64_t)(mid1);
const uint64_t mid1Hi = (uint64_t)(mid1 >> 64);
const uint128_t mid2 = b01 + mid1Lo;
const uint64_t mid2Lo = (uint64_t)(mid2);
const uint64_t mid2Hi = (uint64_t)(mid2 >> 64);
const uint128_t pHi = b11 + mid1Hi + mid2Hi;
const uint128_t pLo = ((uint128_t)mid2Lo << 64) | b00Lo;
*productHi = pHi;
return pLo;
}
// Returns the high 128 bits of the 256-bit product of a and b.
static inline uint128_t umul256_hi(const uint128_t a, const uint64_t bHi, const uint64_t bLo) {
// Reuse the umul256 implementation.
// Optimizers will likely eliminate the instructions used to compute the
// low part of the product.
uint128_t hi;
umul256(a, bHi, bLo, &hi);
return hi;
}
// Unfortunately, gcc/clang do not automatically turn a 128-bit integer division
// into a multiplication, so we have to do it manually.
static inline uint32_t uint128_mod1e9(const uint128_t v) {
// After multiplying, we're going to shift right by 29, then truncate to uint32_t.
// This means that we need only 29 + 32 = 61 bits, so we can truncate to uint64_t before shifting.
const uint64_t multiplied = (uint64_t) umul256_hi(v, 0x89705F4136B4A597u, 0x31680A88F8953031u);
// For uint32_t truncation, see the mod1e9() comment in d2s_intrinsics.h.
const uint32_t shifted = (uint32_t) (multiplied >> 29);
return ((uint32_t) v) - 1000000000 * shifted;
}
// Best case: use 128-bit type.
static inline uint32_t mulShift_mod1e9(const uint64_t m, const uint64_t* const mul, const int32_t j) {
const uint128_t b0 = ((uint128_t) m) * mul[0]; // 0
const uint128_t b1 = ((uint128_t) m) * mul[1]; // 64
const uint128_t b2 = ((uint128_t) m) * mul[2]; // 128
#ifdef RYU_DEBUG
if (j < 128 || j > 180) {
printf("%d\n", j);
}
#endif
assert(j >= 128);
assert(j <= 180);
// j: [128, 256)
const uint128_t mid = b1 + (uint64_t) (b0 >> 64); // 64
const uint128_t s1 = b2 + (uint64_t) (mid >> 64); // 128
return uint128_mod1e9(s1 >> (j - 128));
}
#else // HAS_UINT128
#if defined(HAS_64_BIT_INTRINSICS)
// Returns the low 64 bits of the high 128 bits of the 256-bit product of a and b.
static inline uint64_t umul256_hi128_lo64(
const uint64_t aHi, const uint64_t aLo, const uint64_t bHi, const uint64_t bLo) {
uint64_t b00Hi;
const uint64_t b00Lo = umul128(aLo, bLo, &b00Hi);
uint64_t b01Hi;
const uint64_t b01Lo = umul128(aLo, bHi, &b01Hi);
uint64_t b10Hi;
const uint64_t b10Lo = umul128(aHi, bLo, &b10Hi);
uint64_t b11Hi;
const uint64_t b11Lo = umul128(aHi, bHi, &b11Hi);
(void) b00Lo; // unused
(void) b11Hi; // unused
const uint64_t temp1Lo = b10Lo + b00Hi;
const uint64_t temp1Hi = b10Hi + (temp1Lo < b10Lo);
const uint64_t temp2Lo = b01Lo + temp1Lo;
const uint64_t temp2Hi = b01Hi + (temp2Lo < b01Lo);
return b11Lo + temp1Hi + temp2Hi;
}
static inline uint32_t uint128_mod1e9(const uint64_t vHi, const uint64_t vLo) {
// After multiplying, we're going to shift right by 29, then truncate to uint32_t.
// This means that we need only 29 + 32 = 61 bits, so we can truncate to uint64_t before shifting.
const uint64_t multiplied = umul256_hi128_lo64(vHi, vLo, 0x89705F4136B4A597u, 0x31680A88F8953031u);
// For uint32_t truncation, see the mod1e9() comment in d2s_intrinsics.h.
const uint32_t shifted = (uint32_t) (multiplied >> 29);
return ((uint32_t) vLo) - 1000000000 * shifted;
}
#endif // HAS_64_BIT_INTRINSICS
static inline uint32_t mulShift_mod1e9(const uint64_t m, const uint64_t* const mul, const int32_t j) {
uint64_t high0; // 64
const uint64_t low0 = umul128(m, mul[0], &high0); // 0
uint64_t high1; // 128
const uint64_t low1 = umul128(m, mul[1], &high1); // 64
uint64_t high2; // 192
const uint64_t low2 = umul128(m, mul[2], &high2); // 128
const uint64_t s0low = low0; // 0
(void) s0low; // unused
const uint64_t s0high = low1 + high0; // 64
const uint32_t c1 = s0high < low1;
const uint64_t s1low = low2 + high1 + c1; // 128
const uint32_t c2 = s1low < low2; // high1 + c1 can't overflow, so compare against low2
const uint64_t s1high = high2 + c2; // 192
#ifdef RYU_DEBUG
if (j < 128 || j > 180) {
printf("%d\n", j);
}
#endif
assert(j >= 128);
assert(j <= 180);
#if defined(HAS_64_BIT_INTRINSICS)
const uint32_t dist = (uint32_t) (j - 128); // dist: [0, 52]
const uint64_t shiftedhigh = s1high >> dist;
const uint64_t shiftedlow = shiftright128(s1low, s1high, dist);
return uint128_mod1e9(shiftedhigh, shiftedlow);
#else // HAS_64_BIT_INTRINSICS
if (j < 160) { // j: [128, 160)
const uint64_t r0 = mod1e9(s1high);
const uint64_t r1 = mod1e9((r0 << 32) | (s1low >> 32));
const uint64_t r2 = ((r1 << 32) | (s1low & 0xffffffff));
return mod1e9(r2 >> (j - 128));
} else { // j: [160, 192)
const uint64_t r0 = mod1e9(s1high);
const uint64_t r1 = ((r0 << 32) | (s1low >> 32));
return mod1e9(r1 >> (j - 160));
}
#endif // HAS_64_BIT_INTRINSICS
}
#endif // HAS_UINT128
static inline void append_n_digits(const uint32_t olength, uint32_t digits, char* const result) {
#ifdef RYU_DEBUG
printf("DIGITS=%u\n", digits);
#endif
uint32_t i = 0;
while (digits >= 10000) {
#ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=38217
const uint32_t c = digits - 10000 * (digits / 10000);
#else
const uint32_t c = digits % 10000;
#endif
digits /= 10000;
const uint32_t c0 = (c % 100) << 1;
const uint32_t c1 = (c / 100) << 1;
memcpy(result + olength - i - 2, DIGIT_TABLE + c0, 2);
memcpy(result + olength - i - 4, DIGIT_TABLE + c1, 2);
i += 4;
}
if (digits >= 100) {
const uint32_t c = (digits % 100) << 1;
digits /= 100;
memcpy(result + olength - i - 2, DIGIT_TABLE + c, 2);
i += 2;
}
if (digits >= 10) {
const uint32_t c = digits << 1;
memcpy(result + olength - i - 2, DIGIT_TABLE + c, 2);
} else {
result[0] = (char) ('0' + digits);
}
}
static inline void append_d_digits(const uint32_t olength, uint32_t digits, char* const result) {
#ifdef RYU_DEBUG
printf("DIGITS=%u\n", digits);
#endif
uint32_t i = 0;
while (digits >= 10000) {
#ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=38217
const uint32_t c = digits - 10000 * (digits / 10000);
#else
const uint32_t c = digits % 10000;
#endif
digits /= 10000;
const uint32_t c0 = (c % 100) << 1;
const uint32_t c1 = (c / 100) << 1;
memcpy(result + olength + 1 - i - 2, DIGIT_TABLE + c0, 2);
memcpy(result + olength + 1 - i - 4, DIGIT_TABLE + c1, 2);
i += 4;
}
if (digits >= 100) {
const uint32_t c = (digits % 100) << 1;
digits /= 100;
memcpy(result + olength + 1 - i - 2, DIGIT_TABLE + c, 2);
i += 2;
}
if (digits >= 10) {
const uint32_t c = digits << 1;
result[2] = DIGIT_TABLE[c + 1];
result[1] = '.';
result[0] = DIGIT_TABLE[c];
} else {
result[1] = '.';
result[0] = (char) ('0' + digits);
}
}
static inline void append_c_digits(const uint32_t count, uint32_t digits, char* const result) {
#ifdef RYU_DEBUG
printf("DIGITS=%u\n", digits);
#endif
uint32_t i = 0;
for (; i < count - 1; i += 2) {
const uint32_t c = (digits % 100) << 1;
digits /= 100;
memcpy(result + count - i - 2, DIGIT_TABLE + c, 2);
}
if (i < count) {
const char c = (char) ('0' + (digits % 10));
result[count - i - 1] = c;
}
}
static inline void append_nine_digits(uint32_t digits, char* const result) {
#ifdef RYU_DEBUG
printf("DIGITS=%u\n", digits);
#endif
if (digits == 0) {
memset(result, '0', 9);
return;
}
for (uint32_t i = 0; i < 5; i += 4) {
#ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=38217
const uint32_t c = digits - 10000 * (digits / 10000);
#else
const uint32_t c = digits % 10000;
#endif
digits /= 10000;
const uint32_t c0 = (c % 100) << 1;
const uint32_t c1 = (c / 100) << 1;
memcpy(result + 7 - i, DIGIT_TABLE + c0, 2);
memcpy(result + 5 - i, DIGIT_TABLE + c1, 2);
}
result[0] = (char) ('0' + digits);
}
static inline uint32_t indexForExponent(const uint32_t e) {
return (e + 15) / 16;
}
static inline uint32_t pow10BitsForIndex(const uint32_t idx) {
return 16 * idx + POW10_ADDITIONAL_BITS;
}
static inline uint32_t lengthForIndex(const uint32_t idx) {
// +1 for ceil, +16 for mantissa, +8 to round up when dividing by 9
return (log10Pow2(16 * (int32_t) idx) + 1 + 16 + 8) / 9;
}
static inline int copy_special_str_printf(char* const result, const bool sign, const uint64_t mantissa) {
#if defined(_MSC_VER)
// TODO: Check that -nan is expected output on Windows.
if (sign) {
result[0] = '-';
}
if (mantissa) {
if (mantissa < (1ull << (DOUBLE_MANTISSA_BITS - 1))) {
memcpy(result + sign, "nan(snan)", 9);
return sign + 9;
}
memcpy(result + sign, "nan", 3);
return sign + 3;
}
#else
if (mantissa) {
memcpy(result, "nan", 3);
return 3;
}
if (sign) {
result[0] = '-';
}
#endif
memcpy(result + sign, "Infinity", 8);
return sign + 8;
}
int d2fixed_buffered_n(double d, uint32_t precision, char* result) {
const uint64_t bits = double_to_bits(d);
#ifdef RYU_DEBUG
printf("IN=");
for (int32_t bit = 63; bit >= 0; --bit) {
printf("%d", (int) ((bits >> bit) & 1));
}
printf("\n");
#endif
// Decode bits into sign, mantissa, and exponent.
const bool ieeeSign = ((bits >> (DOUBLE_MANTISSA_BITS + DOUBLE_EXPONENT_BITS)) & 1) != 0;
const uint64_t ieeeMantissa = bits & ((1ull << DOUBLE_MANTISSA_BITS) - 1);
const uint32_t ieeeExponent = (uint32_t) ((bits >> DOUBLE_MANTISSA_BITS) & ((1u << DOUBLE_EXPONENT_BITS) - 1));
// Case distinction; exit early for the easy cases.
if (ieeeExponent == ((1u << DOUBLE_EXPONENT_BITS) - 1u)) {
return copy_special_str_printf(result, ieeeSign, ieeeMantissa);
}
if (ieeeExponent == 0 && ieeeMantissa == 0) {
int index = 0;
if (ieeeSign) {
result[index++] = '-';
}
result[index++] = '0';
if (precision > 0) {
result[index++] = '.';
memset(result + index, '0', precision);
index += precision;
}
return index;
}
int32_t e2;
uint64_t m2;
if (ieeeExponent == 0) {
e2 = 1 - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS;
m2 = ieeeMantissa;
} else {
e2 = (int32_t) ieeeExponent - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS;
m2 = (1ull << DOUBLE_MANTISSA_BITS) | ieeeMantissa;
}
#ifdef RYU_DEBUG
printf("-> %" PRIu64 " * 2^%d\n", m2, e2);
#endif
int index = 0;
bool nonzero = false;
if (ieeeSign) {
result[index++] = '-';
}
if (e2 >= -52) {
const uint32_t idx = e2 < 0 ? 0 : indexForExponent((uint32_t) e2);
const uint32_t p10bits = pow10BitsForIndex(idx);
const int32_t len = (int32_t) lengthForIndex(idx);
#ifdef RYU_DEBUG
printf("idx=%u\n", idx);
printf("len=%d\n", len);
#endif
for (int32_t i = len - 1; i >= 0; --i) {
const int32_t j = ((int32_t) p10bits) - e2;
// Temporary: j is usually around 128, and by shifting a bit, we push it to 128 or above, which is
// a slightly faster code path in mulShift_mod1e9. Instead, we can just increase the multipliers.
const uint32_t digits = mulShift_mod1e9(m2 << 8, POW10_SPLIT[POW10_OFFSET[idx] + i], j + 8);
if (nonzero) {
append_nine_digits(digits, result + index);
index += 9;
} else if (digits != 0) {
const uint32_t olength = decimalLength9(digits);
append_n_digits(olength, digits, result + index);
index += olength;
nonzero = true;
}
}
}
if (!nonzero) {
result[index++] = '0';
}
const bool printDecimalPoint = precision > 0;
if (printDecimalPoint) {
result[index++] = '.';
}
#ifdef RYU_DEBUG
printf("e2=%d\n", e2);
#endif
if (e2 < 0) {
const int32_t idx = -e2 / 16;
#ifdef RYU_DEBUG
printf("idx=%d\n", idx);
#endif
const uint32_t blocks = precision / 9 + 1;
// 0 = don't round up; 1 = round up unconditionally; 2 = round up if odd.
int roundUp = 0;
uint32_t i = 0;
if (blocks <= MIN_BLOCK_2[idx]) {
i = blocks;
memset(result + index, '0', precision);
index += precision;
} else if (i < MIN_BLOCK_2[idx]) {
i = MIN_BLOCK_2[idx];
memset(result + index, '0', 9 * i);
index += 9 * i;
}
for (; i < blocks; ++i) {
const int32_t j = ADDITIONAL_BITS_2 + (-e2 - 16 * idx);
const uint32_t p = POW10_OFFSET_2[idx] + i - MIN_BLOCK_2[idx];
if (p >= POW10_OFFSET_2[idx + 1]) {
// If the remaining digits are all 0, then we might as well use memset.
// No rounding required in this case.
const uint32_t fill = precision - 9 * i;
memset(result + index, '0', fill);
index += fill;
break;
}
// Temporary: j is usually around 128, and by shifting a bit, we push it to 128 or above, which is
// a slightly faster code path in mulShift_mod1e9. Instead, we can just increase the multipliers.
uint32_t digits = mulShift_mod1e9(m2 << 8, POW10_SPLIT_2[p], j + 8);
#ifdef RYU_DEBUG
printf("digits=%u\n", digits);
#endif
if (i < blocks - 1) {
append_nine_digits(digits, result + index);
index += 9;
} else {
const uint32_t maximum = precision - 9 * i;
uint32_t lastDigit = 0;
for (uint32_t k = 0; k < 9 - maximum; ++k) {
lastDigit = digits % 10;
digits /= 10;
}
#ifdef RYU_DEBUG
printf("lastDigit=%u\n", lastDigit);
#endif
if (lastDigit != 5) {
roundUp = lastDigit > 5;
} else {
// Is m * 10^(additionalDigits + 1) / 2^(-e2) integer?
const int32_t requiredTwos = -e2 - (int32_t) precision - 1;
const bool trailingZeros = requiredTwos <= 0
|| (requiredTwos < 60 && multipleOfPowerOf2(m2, (uint32_t) requiredTwos));
roundUp = trailingZeros ? 2 : 1;
#ifdef RYU_DEBUG
printf("requiredTwos=%d\n", requiredTwos);
printf("trailingZeros=%s\n", trailingZeros ? "true" : "false");
#endif
}
if (maximum > 0) {
append_c_digits(maximum, digits, result + index);
index += maximum;
}
break;
}
}
#ifdef RYU_DEBUG
printf("roundUp=%d\n", roundUp);
#endif
if (roundUp != 0) {
int roundIndex = index;
int dotIndex = 0; // '.' can't be located at index 0
while (true) {
--roundIndex;
char c;
if (roundIndex == -1 || (c = result[roundIndex], c == '-')) {
result[roundIndex + 1] = '1';
if (dotIndex > 0) {
result[dotIndex] = '0';
result[dotIndex + 1] = '.';
}
result[index++] = '0';
break;
}
if (c == '.') {
dotIndex = roundIndex;
continue;
} else if (c == '9') {
result[roundIndex] = '0';
roundUp = 1;
continue;
} else {
if (roundUp == 2 && c % 2 == 0) {
break;
}
result[roundIndex] = c + 1;
break;
}
}
}
} else {
memset(result + index, '0', precision);
index += precision;
}
#if RYU_NO_TRAILING_ZEROS
if (printDecimalPoint) {
while (result[index - 1] == '0') {
index--;
}
if (result[index - 1] == '.') {
index--;
}
}
#endif
return index;
}
void d2fixed_buffered(double d, uint32_t precision, char* result) {
const int len = d2fixed_buffered_n(d, precision, result);
result[len] = '\0';
}
char* d2fixed(double d, uint32_t precision) {
char* const buffer = (char*)malloc(2000);
const int index = d2fixed_buffered_n(d, precision, buffer);
buffer[index] = '\0';
return buffer;
}
int d2exp_buffered_n(double d, uint32_t precision, char* result) {
const uint64_t bits = double_to_bits(d);
#ifdef RYU_DEBUG
printf("IN=");
for (int32_t bit = 63; bit >= 0; --bit) {
printf("%d", (int) ((bits >> bit) & 1));
}
printf("\n");
#endif
// Decode bits into sign, mantissa, and exponent.
const bool ieeeSign = ((bits >> (DOUBLE_MANTISSA_BITS + DOUBLE_EXPONENT_BITS)) & 1) != 0;
const uint64_t ieeeMantissa = bits & ((1ull << DOUBLE_MANTISSA_BITS) - 1);
const uint32_t ieeeExponent = (uint32_t) ((bits >> DOUBLE_MANTISSA_BITS) & ((1u << DOUBLE_EXPONENT_BITS) - 1));
// Case distinction; exit early for the easy cases.
if (ieeeExponent == ((1u << DOUBLE_EXPONENT_BITS) - 1u)) {
return copy_special_str_printf(result, ieeeSign, ieeeMantissa);
}
if (ieeeExponent == 0 && ieeeMantissa == 0) {
int index = 0;
if (ieeeSign) {
result[index++] = '-';
}
result[index++] = '0';
if (precision > 0) {
result[index++] = '.';
memset(result + index, '0', precision);
index += precision;
}
memcpy(result + index, "e+00", 4);
index += 4;
return index;
}
int32_t e2;
uint64_t m2;
if (ieeeExponent == 0) {
e2 = 1 - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS;
m2 = ieeeMantissa;
} else {
e2 = (int32_t) ieeeExponent - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS;
m2 = (1ull << DOUBLE_MANTISSA_BITS) | ieeeMantissa;
}
#ifdef RYU_DEBUG
printf("-> %" PRIu64 " * 2^%d\n", m2, e2);
#endif
const bool printDecimalPoint = precision > 0;
++precision;
int index = 0;
if (ieeeSign) {
result[index++] = '-';
}
uint32_t digits = 0;
uint32_t printedDigits = 0;
uint32_t availableDigits = 0;
int32_t exp = 0;
if (e2 >= -52) {
const uint32_t idx = e2 < 0 ? 0 : indexForExponent((uint32_t) e2);
const uint32_t p10bits = pow10BitsForIndex(idx);
const int32_t len = (int32_t) lengthForIndex(idx);
#ifdef RYU_DEBUG
printf("idx=%u\n", idx);
printf("len=%d\n", len);
#endif
for (int32_t i = len - 1; i >= 0; --i) {
const int32_t j = ((int32_t) p10bits) - e2;
// Temporary: j is usually around 128, and by shifting a bit, we push it to 128 or above, which is
// a slightly faster code path in mulShift_mod1e9. Instead, we can just increase the multipliers.
digits = mulShift_mod1e9(m2 << 8, POW10_SPLIT[POW10_OFFSET[idx] + i], j + 8);
if (printedDigits != 0) {
if (printedDigits + 9 > precision) {
availableDigits = 9;
break;
}
append_nine_digits(digits, result + index);
index += 9;
printedDigits += 9;
} else if (digits != 0) {
availableDigits = decimalLength9(digits);
exp = i * 9 + (int32_t) availableDigits - 1;
if (availableDigits > precision) {
break;
}
if (printDecimalPoint) {
append_d_digits(availableDigits, digits, result + index);
index += availableDigits + 1; // +1 for decimal point
} else {
result[index++] = (char) ('0' + digits);
}
printedDigits = availableDigits;
availableDigits = 0;
}
}
}
if (e2 < 0 && availableDigits == 0) {
const int32_t idx = -e2 / 16;
#ifdef RYU_DEBUG
printf("idx=%d, e2=%d, min=%d\n", idx, e2, MIN_BLOCK_2[idx]);
#endif
for (int32_t i = MIN_BLOCK_2[idx]; i < 200; ++i) {
const int32_t j = ADDITIONAL_BITS_2 + (-e2 - 16 * idx);
const uint32_t p = POW10_OFFSET_2[idx] + (uint32_t) i - MIN_BLOCK_2[idx];
// Temporary: j is usually around 128, and by shifting a bit, we push it to 128 or above, which is
// a slightly faster code path in mulShift_mod1e9. Instead, we can just increase the multipliers.
digits = (p >= POW10_OFFSET_2[idx + 1]) ? 0 : mulShift_mod1e9(m2 << 8, POW10_SPLIT_2[p], j + 8);
#ifdef RYU_DEBUG
printf("exact=%" PRIu64 " * (%" PRIu64 " + %" PRIu64 " << 64) >> %d\n", m2, POW10_SPLIT_2[p][0], POW10_SPLIT_2[p][1], j);
printf("digits=%u\n", digits);
#endif
if (printedDigits != 0) {
if (printedDigits + 9 > precision) {
availableDigits = 9;
break;
}
append_nine_digits(digits, result + index);
index += 9;
printedDigits += 9;
} else if (digits != 0) {
availableDigits = decimalLength9(digits);
exp = -(i + 1) * 9 + (int32_t) availableDigits - 1;
if (availableDigits > precision) {
break;
}
if (printDecimalPoint) {
append_d_digits(availableDigits, digits, result + index);
index += availableDigits + 1; // +1 for decimal point
} else {
result[index++] = (char) ('0' + digits);
}
printedDigits = availableDigits;
availableDigits = 0;
}
}
}
const uint32_t maximum = precision - printedDigits;
#ifdef RYU_DEBUG
printf("availableDigits=%u\n", availableDigits);
printf("digits=%u\n", digits);
printf("maximum=%u\n", maximum);
#endif
if (availableDigits == 0) {
digits = 0;
}
uint32_t lastDigit = 0;
if (availableDigits > maximum) {
for (uint32_t k = 0; k < availableDigits - maximum; ++k) {
lastDigit = digits % 10;
digits /= 10;
}
}
#ifdef RYU_DEBUG
printf("lastDigit=%u\n", lastDigit);
#endif
// 0 = don't round up; 1 = round up unconditionally; 2 = round up if odd.
int roundUp = 0;
if (lastDigit != 5) {
roundUp = lastDigit > 5;
} else {
// Is m * 2^e2 * 10^(precision + 1 - exp) integer?
// precision was already increased by 1, so we don't need to write + 1 here.
const int32_t rexp = (int32_t) precision - exp;
const int32_t requiredTwos = -e2 - rexp;
bool trailingZeros = requiredTwos <= 0
|| (requiredTwos < 60 && multipleOfPowerOf2(m2, (uint32_t) requiredTwos));
if (rexp < 0) {
const int32_t requiredFives = -rexp;
trailingZeros = trailingZeros && multipleOfPowerOf5(m2, (uint32_t) requiredFives);
}
roundUp = trailingZeros ? 2 : 1;
#ifdef RYU_DEBUG
printf("requiredTwos=%d\n", requiredTwos);
printf("trailingZeros=%s\n", trailingZeros ? "true" : "false");
#endif
}
if (printedDigits != 0) {
if (digits == 0) {
memset(result + index, '0', maximum);
} else {
append_c_digits(maximum, digits, result + index);
}
index += maximum;
} else {
if (printDecimalPoint) {
append_d_digits(maximum, digits, result + index);
index += maximum + 1; // +1 for decimal point
} else {
result[index++] = (char) ('0' + digits);
}
}
#ifdef RYU_DEBUG
printf("roundUp=%d\n", roundUp);
#endif
if (roundUp != 0) {
int roundIndex = index;
while (true) {
--roundIndex;
char c;
if (roundIndex == -1 || (c = result[roundIndex], c == '-')) {
result[roundIndex + 1] = '1';
++exp;
break;
}
if (c == '.') {
continue;
} else if (c == '9') {
result[roundIndex] = '0';
roundUp = 1;
continue;
} else {
if (roundUp == 2 && c % 2 == 0) {
break;
}
result[roundIndex] = c + 1;
break;
}
}
}
#if RYU_NO_TRAILING_ZEROS
if (printDecimalPoint) {
while (result[index - 1] == '0') {
index--;
}
if (result[index - 1] == '.') {
index--;
}
}
#endif
result[index++] = 'e';
if (exp < 0) {
result[index++] = '-';
exp = -exp;
} else {
result[index++] = '+';
}
if (exp >= 100) {
const int32_t c = exp % 10;
memcpy(result + index, DIGIT_TABLE + 2 * (exp / 10), 2);
result[index + 2] = (char) ('0' + c);
index += 3;
} else {
memcpy(result + index, DIGIT_TABLE + 2 * exp, 2);
index += 2;
}
return index;
}
void d2exp_buffered(double d, uint32_t precision, char* result) {
const int len = d2exp_buffered_n(d, precision, result);
result[len] = '\0';
}
char* d2exp(double d, uint32_t precision) {
char* const buffer = (char*)malloc(2000);
const int index = d2exp_buffered_n(d, precision, buffer);
buffer[index] = '\0';
return buffer;
}

806
deps/ryu/d2s.c vendored Normal file
View file

@ -0,0 +1,806 @@
// Copyright 2018 Ulf Adams
//
// The contents of this file may be used under the terms of the Apache License,
// Version 2.0.
//
// (See accompanying file LICENSE-Apache or copy at
// http://www.apache.org/licenses/LICENSE-2.0)
//
// Alternatively, the contents of this file may be used under the terms of
// the Boost Software License, Version 1.0.
// (See accompanying file LICENSE-Boost or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//
// Unless required by applicable law or agreed to in writing, this software
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.
// Runtime compiler options:
// -DRYU_DEBUG Generate verbose debugging output to stdout.
//
// -DRYU_ONLY_64_BIT_OPS Avoid using uint128_t or 64-bit intrinsics. Slower,
// depending on your compiler.
//
// -DRYU_OPTIMIZE_SIZE Use smaller lookup tables. Instead of storing every
// required power of 5, only store every 26th entry, and compute
// intermediate values with a multiplication. This reduces the lookup table
// size by about 10x (only one case, and only double) at the cost of some
// performance. Currently requires MSVC intrinsics.
#include "ryu/ryu.h"
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#ifdef RYU_DEBUG
#include <inttypes.h>
#include <stdio.h>
#endif
#include "ryu/common.h"
#include "ryu/digit_table.h"
#include "ryu/d2s_intrinsics.h"
// Include either the small or the full lookup tables depending on the mode.
#if defined(RYU_OPTIMIZE_SIZE)
#include "ryu/d2s_small_table.h"
#else
#include "ryu/d2s_full_table.h"
#endif
#define DOUBLE_MANTISSA_BITS 52
#define DOUBLE_EXPONENT_BITS 11
#define DOUBLE_BIAS 1023
// We need a 64x128-bit multiplication and a subsequent 128-bit shift.
// Multiplication:
// The 64-bit factor is variable and passed in, the 128-bit factor comes
// from a lookup table. We know that the 64-bit factor only has 55
// significant bits (i.e., the 9 topmost bits are zeros). The 128-bit
// factor only has 124 significant bits (i.e., the 4 topmost bits are
// zeros).
// Shift:
// In principle, the multiplication result requires 55 + 124 = 179 bits to
// represent. However, we then shift this value to the right by j, which is
// at least j >= 115, so the result is guaranteed to fit into 179 - 115 = 64
// bits. This means that we only need the topmost 64 significant bits of
// the 64x128-bit multiplication.
//
// There are several ways to do this:
// 1. Best case: the compiler exposes a 128-bit type.
// We perform two 64x64-bit multiplications, add the higher 64 bits of the
// lower result to the higher result, and shift by j - 64 bits.
//
// We explicitly cast from 64-bit to 128-bit, so the compiler can tell
// that these are only 64-bit inputs, and can map these to the best
// possible sequence of assembly instructions.
// x64 machines happen to have matching assembly instructions for
// 64x64-bit multiplications and 128-bit shifts.
//
// 2. Second best case: the compiler exposes intrinsics for the x64 assembly
// instructions mentioned in 1.
//
// 3. We only have 64x64 bit instructions that return the lower 64 bits of
// the result, i.e., we have to use plain C.
// Our inputs are less than the full width, so we have three options:
// a. Ignore this fact and just implement the intrinsics manually.
// b. Split both into 31-bit pieces, which guarantees no internal overflow,
// but requires extra work upfront (unless we change the lookup table).
// c. Split only the first factor into 31-bit pieces, which also guarantees
// no internal overflow, but requires extra work since the intermediate
// results are not perfectly aligned.
#if defined(HAS_UINT128)
// Best case: use 128-bit type.
static inline uint64_t mulShift(const uint64_t m, const uint64_t* const mul, const int32_t j) {
const uint128_t b0 = ((uint128_t) m) * mul[0];
const uint128_t b2 = ((uint128_t) m) * mul[1];
return (uint64_t) (((b0 >> 64) + b2) >> (j - 64));
}
static inline uint64_t mulShiftAll(const uint64_t m, const uint64_t* const mul, const int32_t j,
uint64_t* const vp, uint64_t* const vm, const uint32_t mmShift) {
// m <<= 2;
// uint128_t b0 = ((uint128_t) m) * mul[0]; // 0
// uint128_t b2 = ((uint128_t) m) * mul[1]; // 64
//
// uint128_t hi = (b0 >> 64) + b2;
// uint128_t lo = b0 & 0xffffffffffffffffull;
// uint128_t factor = (((uint128_t) mul[1]) << 64) + mul[0];
// uint128_t vpLo = lo + (factor << 1);
// *vp = (uint64_t) ((hi + (vpLo >> 64)) >> (j - 64));
// uint128_t vmLo = lo - (factor << mmShift);
// *vm = (uint64_t) ((hi + (vmLo >> 64) - (((uint128_t) 1ull) << 64)) >> (j - 64));
// return (uint64_t) (hi >> (j - 64));
*vp = mulShift(4 * m + 2, mul, j);
*vm = mulShift(4 * m - 1 - mmShift, mul, j);
return mulShift(4 * m, mul, j);
}
#elif defined(HAS_64_BIT_INTRINSICS)
static inline uint64_t mulShift(const uint64_t m, const uint64_t* const mul, const int32_t j) {
// m is maximum 55 bits
uint64_t high1; // 128
const uint64_t low1 = umul128(m, mul[1], &high1); // 64
uint64_t high0; // 64
umul128(m, mul[0], &high0); // 0
const uint64_t sum = high0 + low1;
if (sum < high0) {
++high1; // overflow into high1
}
return shiftright128(sum, high1, j - 64);
}
static inline uint64_t mulShiftAll(const uint64_t m, const uint64_t* const mul, const int32_t j,
uint64_t* const vp, uint64_t* const vm, const uint32_t mmShift) {
*vp = mulShift(4 * m + 2, mul, j);
*vm = mulShift(4 * m - 1 - mmShift, mul, j);
return mulShift(4 * m, mul, j);
}
#else // !defined(HAS_UINT128) && !defined(HAS_64_BIT_INTRINSICS)
static inline uint64_t mulShiftAll(uint64_t m, const uint64_t* const mul, const int32_t j,
uint64_t* const vp, uint64_t* const vm, const uint32_t mmShift) {
m <<= 1;
// m is maximum 55 bits
uint64_t tmp;
const uint64_t lo = umul128(m, mul[0], &tmp);
uint64_t hi;
const uint64_t mid = tmp + umul128(m, mul[1], &hi);
hi += mid < tmp; // overflow into hi
const uint64_t lo2 = lo + mul[0];
const uint64_t mid2 = mid + mul[1] + (lo2 < lo);
const uint64_t hi2 = hi + (mid2 < mid);
*vp = shiftright128(mid2, hi2, (uint32_t) (j - 64 - 1));
if (mmShift == 1) {
const uint64_t lo3 = lo - mul[0];
const uint64_t mid3 = mid - mul[1] - (lo3 > lo);
const uint64_t hi3 = hi - (mid3 > mid);
*vm = shiftright128(mid3, hi3, (uint32_t) (j - 64 - 1));
} else {
const uint64_t lo3 = lo + lo;
const uint64_t mid3 = mid + mid + (lo3 < lo);
const uint64_t hi3 = hi + hi + (mid3 < mid);
const uint64_t lo4 = lo3 - mul[0];
const uint64_t mid4 = mid3 - mul[1] - (lo4 > lo3);
const uint64_t hi4 = hi3 - (mid4 > mid3);
*vm = shiftright128(mid4, hi4, (uint32_t) (j - 64));
}
return shiftright128(mid, hi, (uint32_t) (j - 64 - 1));
}
#endif // HAS_64_BIT_INTRINSICS
static inline uint32_t decimalLength17(const uint64_t v) {
// This is slightly faster than a loop.
// The average output length is 16.38 digits, so we check high-to-low.
// Function precondition: v is not an 18, 19, or 20-digit number.
// (17 digits are sufficient for round-tripping.)
assert(v < 100000000000000000L);
if (v >= 10000000000000000L) { return 17; }
if (v >= 1000000000000000L) { return 16; }
if (v >= 100000000000000L) { return 15; }
if (v >= 10000000000000L) { return 14; }
if (v >= 1000000000000L) { return 13; }
if (v >= 100000000000L) { return 12; }
if (v >= 10000000000L) { return 11; }
if (v >= 1000000000L) { return 10; }
if (v >= 100000000L) { return 9; }
if (v >= 10000000L) { return 8; }
if (v >= 1000000L) { return 7; }
if (v >= 100000L) { return 6; }
if (v >= 10000L) { return 5; }
if (v >= 1000L) { return 4; }
if (v >= 100L) { return 3; }
if (v >= 10L) { return 2; }
return 1;
}
// A floating decimal representing m * 10^e.
typedef struct floating_decimal_64 {
uint64_t mantissa;
// Decimal exponent's range is -324 to 308
// inclusive, and can fit in a short if needed.
int32_t exponent;
} floating_decimal_64;
static inline floating_decimal_64 d2d(const uint64_t ieeeMantissa, const uint32_t ieeeExponent) {
int32_t e2;
uint64_t m2;
if (ieeeExponent == 0) {
// We subtract 2 so that the bounds computation has 2 additional bits.
e2 = 1 - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS - 2;
m2 = ieeeMantissa;
} else {
e2 = (int32_t) ieeeExponent - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS - 2;
m2 = (1ull << DOUBLE_MANTISSA_BITS) | ieeeMantissa;
}
const bool even = (m2 & 1) == 0;
const bool acceptBounds = even;
#ifdef RYU_DEBUG
printf("-> %" PRIu64 " * 2^%d\n", m2, e2 + 2);
#endif
// Step 2: Determine the interval of valid decimal representations.
const uint64_t mv = 4 * m2;
// Implicit bool -> int conversion. True is 1, false is 0.
const uint32_t mmShift = ieeeMantissa != 0 || ieeeExponent <= 1;
// We would compute mp and mm like this:
// uint64_t mp = 4 * m2 + 2;
// uint64_t mm = mv - 1 - mmShift;
// Step 3: Convert to a decimal power base using 128-bit arithmetic.
uint64_t vr, vp, vm;
int32_t e10;
bool vmIsTrailingZeros = false;
bool vrIsTrailingZeros = false;
if (e2 >= 0) {
// I tried special-casing q == 0, but there was no effect on performance.
// This expression is slightly faster than max(0, log10Pow2(e2) - 1).
const uint32_t q = log10Pow2(e2) - (e2 > 3);
e10 = (int32_t) q;
const int32_t k = DOUBLE_POW5_INV_BITCOUNT + pow5bits((int32_t) q) - 1;
const int32_t i = -e2 + (int32_t) q + k;
#if defined(RYU_OPTIMIZE_SIZE)
uint64_t pow5[2];
double_computeInvPow5(q, pow5);
vr = mulShiftAll(m2, pow5, i, &vp, &vm, mmShift);
#else
vr = mulShiftAll(m2, DOUBLE_POW5_INV_SPLIT[q], i, &vp, &vm, mmShift);
#endif
#ifdef RYU_DEBUG
printf("%" PRIu64 " * 2^%d / 10^%u\n", mv, e2, q);
printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm);
#endif
if (q <= 21) {
// This should use q <= 22, but I think 21 is also safe. Smaller values
// may still be safe, but it's more difficult to reason about them.
// Only one of mp, mv, and mm can be a multiple of 5, if any.
const uint32_t mvMod5 = ((uint32_t) mv) - 5 * ((uint32_t) div5(mv));
if (mvMod5 == 0) {
vrIsTrailingZeros = multipleOfPowerOf5(mv, q);
} else if (acceptBounds) {
// Same as min(e2 + (~mm & 1), pow5Factor(mm)) >= q
// <=> e2 + (~mm & 1) >= q && pow5Factor(mm) >= q
// <=> true && pow5Factor(mm) >= q, since e2 >= q.
vmIsTrailingZeros = multipleOfPowerOf5(mv - 1 - mmShift, q);
} else {
// Same as min(e2 + 1, pow5Factor(mp)) >= q.
vp -= multipleOfPowerOf5(mv + 2, q);
}
}
} else {
// This expression is slightly faster than max(0, log10Pow5(-e2) - 1).
const uint32_t q = log10Pow5(-e2) - (-e2 > 1);
e10 = (int32_t) q + e2;
const int32_t i = -e2 - (int32_t) q;
const int32_t k = pow5bits(i) - DOUBLE_POW5_BITCOUNT;
const int32_t j = (int32_t) q - k;
#if defined(RYU_OPTIMIZE_SIZE)
uint64_t pow5[2];
double_computePow5(i, pow5);
vr = mulShiftAll(m2, pow5, j, &vp, &vm, mmShift);
#else
vr = mulShiftAll(m2, DOUBLE_POW5_SPLIT[i], j, &vp, &vm, mmShift);
#endif
#ifdef RYU_DEBUG
printf("%" PRIu64 " * 5^%d / 10^%u\n", mv, -e2, q);
printf("%u %d %d %d\n", q, i, k, j);
printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm);
#endif
if (q <= 1) {
// {vr,vp,vm} is trailing zeros if {mv,mp,mm} has at least q trailing 0 bits.
// mv = 4 * m2, so it always has at least two trailing 0 bits.
vrIsTrailingZeros = true;
if (acceptBounds) {
// mm = mv - 1 - mmShift, so it has 1 trailing 0 bit iff mmShift == 1.
vmIsTrailingZeros = mmShift == 1;
} else {
// mp = mv + 2, so it always has at least one trailing 0 bit.
--vp;
}
} else if (q < 63) { // TODO(ulfjack): Use a tighter bound here.
// We want to know if the full product has at least q trailing zeros.
// We need to compute min(p2(mv), p5(mv) - e2) >= q
// <=> p2(mv) >= q && p5(mv) - e2 >= q
// <=> p2(mv) >= q (because -e2 >= q)
vrIsTrailingZeros = multipleOfPowerOf2(mv, q);
#ifdef RYU_DEBUG
printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false");
#endif
}
}
#ifdef RYU_DEBUG
printf("e10=%d\n", e10);
printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm);
printf("vm is trailing zeros=%s\n", vmIsTrailingZeros ? "true" : "false");
printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false");
#endif
// Step 4: Find the shortest decimal representation in the interval of valid representations.
int32_t removed = 0;
uint8_t lastRemovedDigit = 0;
uint64_t output;
// On average, we remove ~2 digits.
if (vmIsTrailingZeros || vrIsTrailingZeros) {
// General case, which happens rarely (~0.7%).
for (;;) {
const uint64_t vpDiv10 = div10(vp);
const uint64_t vmDiv10 = div10(vm);
if (vpDiv10 <= vmDiv10) {
break;
}
const uint32_t vmMod10 = ((uint32_t) vm) - 10 * ((uint32_t) vmDiv10);
const uint64_t vrDiv10 = div10(vr);
const uint32_t vrMod10 = ((uint32_t) vr) - 10 * ((uint32_t) vrDiv10);
vmIsTrailingZeros &= vmMod10 == 0;
vrIsTrailingZeros &= lastRemovedDigit == 0;
lastRemovedDigit = (uint8_t) vrMod10;
vr = vrDiv10;
vp = vpDiv10;
vm = vmDiv10;
++removed;
}
#ifdef RYU_DEBUG
printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm);
printf("d-10=%s\n", vmIsTrailingZeros ? "true" : "false");
#endif
if (vmIsTrailingZeros) {
for (;;) {
const uint64_t vmDiv10 = div10(vm);
const uint32_t vmMod10 = ((uint32_t) vm) - 10 * ((uint32_t) vmDiv10);
if (vmMod10 != 0) {
break;
}
const uint64_t vpDiv10 = div10(vp);
const uint64_t vrDiv10 = div10(vr);
const uint32_t vrMod10 = ((uint32_t) vr) - 10 * ((uint32_t) vrDiv10);
vrIsTrailingZeros &= lastRemovedDigit == 0;
lastRemovedDigit = (uint8_t) vrMod10;
vr = vrDiv10;
vp = vpDiv10;
vm = vmDiv10;
++removed;
}
}
#ifdef RYU_DEBUG
printf("%" PRIu64 " %d\n", vr, lastRemovedDigit);
printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false");
#endif
if (vrIsTrailingZeros && lastRemovedDigit == 5 && vr % 2 == 0) {
// Round even if the exact number is .....50..0.
lastRemovedDigit = 4;
}
// We need to take vr + 1 if vr is outside bounds or we need to round up.
output = vr + ((vr == vm && (!acceptBounds || !vmIsTrailingZeros)) || lastRemovedDigit >= 5);
} else {
// Specialized for the common case (~99.3%). Percentages below are relative to this.
bool roundUp = false;
const uint64_t vpDiv100 = div100(vp);
const uint64_t vmDiv100 = div100(vm);
if (vpDiv100 > vmDiv100) { // Optimization: remove two digits at a time (~86.2%).
const uint64_t vrDiv100 = div100(vr);
const uint32_t vrMod100 = ((uint32_t) vr) - 100 * ((uint32_t) vrDiv100);
roundUp = vrMod100 >= 50;
vr = vrDiv100;
vp = vpDiv100;
vm = vmDiv100;
removed += 2;
}
// Loop iterations below (approximately), without optimization above:
// 0: 0.03%, 1: 13.8%, 2: 70.6%, 3: 14.0%, 4: 1.40%, 5: 0.14%, 6+: 0.02%
// Loop iterations below (approximately), with optimization above:
// 0: 70.6%, 1: 27.8%, 2: 1.40%, 3: 0.14%, 4+: 0.02%
for (;;) {
const uint64_t vpDiv10 = div10(vp);
const uint64_t vmDiv10 = div10(vm);
if (vpDiv10 <= vmDiv10) {
break;
}
const uint64_t vrDiv10 = div10(vr);
const uint32_t vrMod10 = ((uint32_t) vr) - 10 * ((uint32_t) vrDiv10);
roundUp = vrMod10 >= 5;
vr = vrDiv10;
vp = vpDiv10;
vm = vmDiv10;
++removed;
}
#ifdef RYU_DEBUG
printf("%" PRIu64 " roundUp=%s\n", vr, roundUp ? "true" : "false");
printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false");
#endif
// We need to take vr + 1 if vr is outside bounds or we need to round up.
output = vr + (vr == vm || roundUp);
}
const int32_t exp = e10 + removed;
#ifdef RYU_DEBUG
printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm);
printf("O=%" PRIu64 "\n", output);
printf("EXP=%d\n", exp);
#endif
floating_decimal_64 fd;
fd.exponent = exp;
fd.mantissa = output;
return fd;
}
static inline uint64_t
pow_10(const int32_t exp)
{
static const uint64_t POW_TABLE[18] = {
1ULL,
10ULL,
100ULL,
1000ULL,
10000ULL,
100000ULL,
1000000ULL,
10000000ULL,
100000000ULL,
1000000000ULL,
10000000000ULL,
100000000000ULL,
1000000000000ULL,
10000000000000ULL,
100000000000000ULL,
1000000000000000ULL,
10000000000000000ULL,
100000000000000000ULL
};
assert(exp <= 17);
assert(exp >= 0);
return POW_TABLE[exp];
}
static inline int to_chars_uint64(uint64_t output, uint32_t olength, char* const result)
{
uint32_t i = 0;
// We prefer 32-bit operations, even on 64-bit platforms.
// We have at most 17 digits, and uint32_t can store 9 digits.
// If output doesn't fit into uint32_t, we cut off 8 digits,
// so the rest will fit into uint32_t.
if ((output >> 32) != 0) {
// Expensive 64-bit division.
const uint64_t q = div1e8(output);
uint32_t output2 = ((uint32_t) output) - 100000000 * ((uint32_t) q);
output = q;
const uint32_t c = output2 % 10000;
output2 /= 10000;
const uint32_t d = output2 % 10000;
const uint32_t c0 = (c % 100) << 1;
const uint32_t c1 = (c / 100) << 1;
const uint32_t d0 = (d % 100) << 1;
const uint32_t d1 = (d / 100) << 1;
memcpy(result + olength - i - 2, DIGIT_TABLE + c0, 2);
memcpy(result + olength - i - 4, DIGIT_TABLE + c1, 2);
memcpy(result + olength - i - 6, DIGIT_TABLE + d0, 2);
memcpy(result + olength - i - 8, DIGIT_TABLE + d1, 2);
i += 8;
}
uint32_t output2 = (uint32_t) output;
while (output2 >= 10000)
{
#ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=38217
const uint32_t c = output2 - 10000 * (output2 / 10000);
#else
const uint32_t c = output2 % 10000;
#endif
output2 /= 10000;
const uint32_t c0 = (c % 100) << 1;
const uint32_t c1 = (c / 100) << 1;
memcpy(result + olength - i - 2, DIGIT_TABLE + c0, 2);
memcpy(result + olength - i - 4, DIGIT_TABLE + c1, 2);
i += 4;
}
if (output2 >= 100)
{
#ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=38217
const uint32_t c = (output2 % 100) << 1;
#else
const uint32_t c = (output2 - 100 * (output2 / 100)) << 1;
#endif
output2 /= 100;
memcpy(result + olength - i - 2, DIGIT_TABLE + c, 2);
i += 2;
}
if (output2 >= 10)
{
const uint32_t c = output2 << 1;
memcpy(result + olength - i - 2, DIGIT_TABLE + c, 2);
i += 2;
} else {
result[0] = (char) ('0' + output2);
i += 1;
}
return i;
}
static inline int to_chars_fixed(const floating_decimal_64 v, const bool sign, uint32_t precision, char* const result)
{
uint64_t output = v.mantissa;
uint32_t olength = decimalLength17(output);
int32_t exp = v.exponent;
uint64_t integer_part;
uint32_t integer_part_length = 0;
uint64_t decimal_part;
uint32_t decimal_part_length = 0;
uint32_t trailing_integer_zeros = 0;
uint32_t leading_decimal_zeros = 0;
if (exp >= 0)
{
integer_part = output;
integer_part_length = olength;
trailing_integer_zeros = exp;
decimal_part = 0;
}
else
{
/* Adapt the decimal digits to the desired precision */
if (precision < (uint32_t) -exp)
{
int32_t digits_to_trim = -exp - precision;
if (digits_to_trim > (int32_t) olength)
{
output = 0;
exp = 0;
}
else
{
const uint64_t divisor = pow_10(digits_to_trim);
const uint64_t divisor_half = divisor / 2;
const uint64_t outputDiv = output / divisor;
const uint64_t remainder = output - outputDiv * divisor;
output = outputDiv;
exp += digits_to_trim;
if (remainder > divisor_half || (remainder == divisor_half && (output & 1)))
{
output++;
olength = decimalLength17(output);
}
else
{
olength -= digits_to_trim;
}
while (output && output % 10 == 0)
{
output = div10(output);
exp++;
olength--;
}
}
}
int32_t nexp = -exp;
if (exp >= 0)
{
integer_part = output;
integer_part_length = olength;
trailing_integer_zeros = exp;
decimal_part = 0;
}
else if (nexp < (int32_t) olength)
{
uint64_t p = pow_10(nexp);
integer_part = output / p;
decimal_part = output % p;
integer_part_length = olength - nexp;
decimal_part_length = olength - integer_part_length;
if (decimal_part < pow_10(decimal_part_length - 1))
{
/* The decimal part had leading zeros (e.g. 123.0001) which were lost */
decimal_part_length = decimalLength17(decimal_part);
leading_decimal_zeros = olength - integer_part_length - decimal_part_length;
}
}
else
{
integer_part = 0;
decimal_part = output;
decimal_part_length = olength;
leading_decimal_zeros = nexp - olength;
}
}
#ifdef RYU_DEBUG
printf("DIGITS=%" PRIu64 "\n", v.mantissa);
printf("EXP=%d\n", v.exponent);
printf("INTEGER=%lu\n", integer_part);
printf("DECIMAL=%lu\n", decimal_part);
printf("EXTRA TRAILING ZEROS=%d\n", trailing_integer_zeros);
printf("EXTRA LEADING ZEROS=%d\n", leading_decimal_zeros);
#endif
/* If we have removed all digits, it may happen that we have -0 and we want it to be just 0 */
int index = 0;
if (sign && (integer_part || decimal_part))
{
result[index++] = '-';
}
index += to_chars_uint64(integer_part, integer_part_length, &result[index]);
for (uint32_t i = 0; i < trailing_integer_zeros; i++)
result[index++] = '0';
if (decimal_part)
{
result[index++] = '.';
for (uint32_t i = 0; i < leading_decimal_zeros; i++)
result[index++] = '0';
index += to_chars_uint64(decimal_part, decimal_part_length, &result[index]);
}
return index;
}
static inline bool d2d_small_int(const uint64_t ieeeMantissa, const uint32_t ieeeExponent,
floating_decimal_64* const v) {
const uint64_t m2 = (1ull << DOUBLE_MANTISSA_BITS) | ieeeMantissa;
const int32_t e2 = (int32_t) ieeeExponent - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS;
if (e2 > 0) {
// f = m2 * 2^e2 >= 2^53 is an integer.
// Ignore this case for now.
return false;
}
if (e2 < -52) {
// f < 1.
return false;
}
// Since 2^52 <= m2 < 2^53 and 0 <= -e2 <= 52: 1 <= f = m2 / 2^-e2 < 2^53.
// Test if the lower -e2 bits of the significand are 0, i.e. whether the fraction is 0.
const uint64_t mask = (1ull << -e2) - 1;
const uint64_t fraction = m2 & mask;
if (fraction != 0) {
return false;
}
// f is an integer in the range [1, 2^53).
// Note: mantissa might contain trailing (decimal) 0's.
// Note: since 2^53 < 10^16, there is no need to adjust decimalLength17().
v->mantissa = m2 >> -e2;
v->exponent = 0;
return true;
}
int d2sfixed_buffered_n(double f, uint32_t precision, char* result) {
// Step 1: Decode the floating-point number, and unify normalized and subnormal cases.
const uint64_t bits = double_to_bits(f);
#ifdef RYU_DEBUG
printf("IN=");
for (int32_t bit = 63; bit >= 0; --bit) {
printf("%d", (int) ((bits >> bit) & 1));
}
printf("\n");
#endif
// Decode bits into sign, mantissa, and exponent.
const bool ieeeSign = ((bits >> (DOUBLE_MANTISSA_BITS + DOUBLE_EXPONENT_BITS)) & 1) != 0;
const uint64_t ieeeMantissa = bits & ((1ull << DOUBLE_MANTISSA_BITS) - 1);
const uint32_t ieeeExponent = (uint32_t) ((bits >> DOUBLE_MANTISSA_BITS) & ((1u << DOUBLE_EXPONENT_BITS) - 1));
// Case distinction; exit early for the easy cases.
if (ieeeExponent == ((1u << DOUBLE_EXPONENT_BITS) - 1u) || (ieeeExponent == 0 && ieeeMantissa == 0)) {
return copy_special_str(result, ieeeSign, ieeeExponent, ieeeMantissa);
}
floating_decimal_64 v;
const bool isSmallInt = d2d_small_int(ieeeMantissa, ieeeExponent, &v);
if (isSmallInt) {
// For small integers in the range [1, 2^53), v.mantissa might contain trailing (decimal) zeros.
// For scientific notation we need to move these zeros into the exponent.
// (This is not needed for fixed-point notation, so it might be beneficial to trim
// trailing zeros in to_chars only if needed - once fixed-point notation output is implemented.)
for (;;) {
const uint64_t q = div10(v.mantissa);
const uint32_t r = ((uint32_t) v.mantissa) - 10 * ((uint32_t) q);
if (r != 0) {
break;
}
v.mantissa = q;
++v.exponent;
}
} else {
v = d2d(ieeeMantissa, ieeeExponent);
}
return to_chars_fixed(v, ieeeSign, precision, result);
}
int d2sexp_buffered_n(double f, uint32_t precision, char* result) {
// Step 1: Decode the floating-point number, and unify normalized and subnormal cases.
const uint64_t bits = double_to_bits(f);
#ifdef RYU_DEBUG
printf("IN=");
for (int32_t bit = 63; bit >= 0; --bit) {
printf("%d", (int) ((bits >> bit) & 1));
}
printf("\n");
#endif
// Decode bits into sign, mantissa, and exponent.
const bool ieeeSign = ((bits >> (DOUBLE_MANTISSA_BITS + DOUBLE_EXPONENT_BITS)) & 1) != 0;
const uint64_t ieeeMantissa = bits & ((1ull << DOUBLE_MANTISSA_BITS) - 1);
const uint32_t ieeeExponent = (uint32_t) ((bits >> DOUBLE_MANTISSA_BITS) & ((1u << DOUBLE_EXPONENT_BITS) - 1));
// Case distinction; exit early for the easy cases.
if (ieeeExponent == ((1u << DOUBLE_EXPONENT_BITS) - 1u) || (ieeeExponent == 0 && ieeeMantissa == 0)) {
return copy_special_str(result, ieeeSign, ieeeExponent, ieeeMantissa);
}
floating_decimal_64 v;
const bool isSmallInt = d2d_small_int(ieeeMantissa, ieeeExponent, &v);
if (isSmallInt) {
// For small integers in the range [1, 2^53), v.mantissa might contain trailing (decimal) zeros.
// For scientific notation we need to move these zeros into the exponent.
// (This is not needed for fixed-point notation, so it might be beneficial to trim
// trailing zeros in to_chars only if needed - once fixed-point notation output is implemented.)
for (;;) {
const uint64_t q = div10(v.mantissa);
const uint32_t r = ((uint32_t) v.mantissa) - 10 * ((uint32_t) q);
if (r != 0) {
break;
}
v.mantissa = q;
++v.exponent;
}
} else {
v = d2d(ieeeMantissa, ieeeExponent);
}
// Print first the mantissa using the fixed point notation, then add the exponent manually
const int32_t olength = (int32_t) decimalLength17(v.mantissa);
const int32_t original_ieeeExponent = v.exponent + olength - 1;
v.exponent = 1 - olength;
int index = to_chars_fixed(v, ieeeSign, precision, result);
// Print the exponent.
result[index++] = 'e';
int32_t exp = original_ieeeExponent;
if (exp < 0) {
result[index++] = '-';
exp = -exp;
}
else
{
result[index++] = '+';
}
if (exp >= 100) {
const int32_t c = exp % 10;
memcpy(result + index, DIGIT_TABLE + 2 * (exp / 10), 2);
result[index + 2] = (char) ('0' + c);
index += 3;
} else if (exp >= 10) {
memcpy(result + index, DIGIT_TABLE + 2 * exp, 2);
index += 2;
} else {
result[index++] = (char) ('0' + exp);
}
return index;
}

339
deps/ryu/d2s_full_table.h vendored Normal file
View file

@ -0,0 +1,339 @@
// Copyright 2018 Ulf Adams
//
// The contents of this file may be used under the terms of the Apache License,
// Version 2.0.
//
// (See accompanying file LICENSE-Apache or copy at
// http://www.apache.org/licenses/LICENSE-2.0)
//
// Alternatively, the contents of this file may be used under the terms of
// the Boost Software License, Version 1.0.
// (See accompanying file LICENSE-Boost or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//
// Unless required by applicable law or agreed to in writing, this software
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.
#ifndef RYU_D2S_FULL_TABLE_H
#define RYU_D2S_FULL_TABLE_H
// These tables are generated by PrintDoubleLookupTable.
#define DOUBLE_POW5_INV_BITCOUNT 125
#define DOUBLE_POW5_BITCOUNT 125
static const uint64_t DOUBLE_POW5_INV_SPLIT[292][2] = {
{ 1u, 2305843009213693952u }, { 11068046444225730970u, 1844674407370955161u },
{ 5165088340638674453u, 1475739525896764129u }, { 7821419487252849886u, 1180591620717411303u },
{ 8824922364862649494u, 1888946593147858085u }, { 7059937891890119595u, 1511157274518286468u },
{ 13026647942995916322u, 1208925819614629174u }, { 9774590264567735146u, 1934281311383406679u },
{ 11509021026396098440u, 1547425049106725343u }, { 16585914450600699399u, 1237940039285380274u },
{ 15469416676735388068u, 1980704062856608439u }, { 16064882156130220778u, 1584563250285286751u },
{ 9162556910162266299u, 1267650600228229401u }, { 7281393426775805432u, 2028240960365167042u },
{ 16893161185646375315u, 1622592768292133633u }, { 2446482504291369283u, 1298074214633706907u },
{ 7603720821608101175u, 2076918743413931051u }, { 2393627842544570617u, 1661534994731144841u },
{ 16672297533003297786u, 1329227995784915872u }, { 11918280793837635165u, 2126764793255865396u },
{ 5845275820328197809u, 1701411834604692317u }, { 15744267100488289217u, 1361129467683753853u },
{ 3054734472329800808u, 2177807148294006166u }, { 17201182836831481939u, 1742245718635204932u },
{ 6382248639981364905u, 1393796574908163946u }, { 2832900194486363201u, 2230074519853062314u },
{ 5955668970331000884u, 1784059615882449851u }, { 1075186361522890384u, 1427247692705959881u },
{ 12788344622662355584u, 2283596308329535809u }, { 13920024512871794791u, 1826877046663628647u },
{ 3757321980813615186u, 1461501637330902918u }, { 10384555214134712795u, 1169201309864722334u },
{ 5547241898389809503u, 1870722095783555735u }, { 4437793518711847602u, 1496577676626844588u },
{ 10928932444453298728u, 1197262141301475670u }, { 17486291911125277965u, 1915619426082361072u },
{ 6610335899416401726u, 1532495540865888858u }, { 12666966349016942027u, 1225996432692711086u },
{ 12888448528943286597u, 1961594292308337738u }, { 17689456452638449924u, 1569275433846670190u },
{ 14151565162110759939u, 1255420347077336152u }, { 7885109000409574610u, 2008672555323737844u },
{ 9997436015069570011u, 1606938044258990275u }, { 7997948812055656009u, 1285550435407192220u },
{ 12796718099289049614u, 2056880696651507552u }, { 2858676849947419045u, 1645504557321206042u },
{ 13354987924183666206u, 1316403645856964833u }, { 17678631863951955605u, 2106245833371143733u },
{ 3074859046935833515u, 1684996666696914987u }, { 13527933681774397782u, 1347997333357531989u },
{ 10576647446613305481u, 2156795733372051183u }, { 15840015586774465031u, 1725436586697640946u },
{ 8982663654677661702u, 1380349269358112757u }, { 18061610662226169046u, 2208558830972980411u },
{ 10759939715039024913u, 1766847064778384329u }, { 12297300586773130254u, 1413477651822707463u },
{ 15986332124095098083u, 2261564242916331941u }, { 9099716884534168143u, 1809251394333065553u },
{ 14658471137111155161u, 1447401115466452442u }, { 4348079280205103483u, 1157920892373161954u },
{ 14335624477811986218u, 1852673427797059126u }, { 7779150767507678651u, 1482138742237647301u },
{ 2533971799264232598u, 1185710993790117841u }, { 15122401323048503126u, 1897137590064188545u },
{ 12097921058438802501u, 1517710072051350836u }, { 5988988032009131678u, 1214168057641080669u },
{ 16961078480698431330u, 1942668892225729070u }, { 13568862784558745064u, 1554135113780583256u },
{ 7165741412905085728u, 1243308091024466605u }, { 11465186260648137165u, 1989292945639146568u },
{ 16550846638002330379u, 1591434356511317254u }, { 16930026125143774626u, 1273147485209053803u },
{ 4951948911778577463u, 2037035976334486086u }, { 272210314680951647u, 1629628781067588869u },
{ 3907117066486671641u, 1303703024854071095u }, { 6251387306378674625u, 2085924839766513752u },
{ 16069156289328670670u, 1668739871813211001u }, { 9165976216721026213u, 1334991897450568801u },
{ 7286864317269821294u, 2135987035920910082u }, { 16897537898041588005u, 1708789628736728065u },
{ 13518030318433270404u, 1367031702989382452u }, { 6871453250525591353u, 2187250724783011924u },
{ 9186511415162383406u, 1749800579826409539u }, { 11038557946871817048u, 1399840463861127631u },
{ 10282995085511086630u, 2239744742177804210u }, { 8226396068408869304u, 1791795793742243368u },
{ 13959814484210916090u, 1433436634993794694u }, { 11267656730511734774u, 2293498615990071511u },
{ 5324776569667477496u, 1834798892792057209u }, { 7949170070475892320u, 1467839114233645767u },
{ 17427382500606444826u, 1174271291386916613u }, { 5747719112518849781u, 1878834066219066582u },
{ 15666221734240810795u, 1503067252975253265u }, { 12532977387392648636u, 1202453802380202612u },
{ 5295368560860596524u, 1923926083808324180u }, { 4236294848688477220u, 1539140867046659344u },
{ 7078384693692692099u, 1231312693637327475u }, { 11325415509908307358u, 1970100309819723960u },
{ 9060332407926645887u, 1576080247855779168u }, { 14626963555825137356u, 1260864198284623334u },
{ 12335095245094488799u, 2017382717255397335u }, { 9868076196075591040u, 1613906173804317868u },
{ 15273158586344293478u, 1291124939043454294u }, { 13369007293925138595u, 2065799902469526871u },
{ 7005857020398200553u, 1652639921975621497u }, { 16672732060544291412u, 1322111937580497197u },
{ 11918976037903224966u, 2115379100128795516u }, { 5845832015580669650u, 1692303280103036413u },
{ 12055363241948356366u, 1353842624082429130u }, { 841837113407818570u, 2166148198531886609u },
{ 4362818505468165179u, 1732918558825509287u }, { 14558301248600263113u, 1386334847060407429u },
{ 12225235553534690011u, 2218135755296651887u }, { 2401490813343931363u, 1774508604237321510u },
{ 1921192650675145090u, 1419606883389857208u }, { 17831303500047873437u, 2271371013423771532u },
{ 6886345170554478103u, 1817096810739017226u }, { 1819727321701672159u, 1453677448591213781u },
{ 16213177116328979020u, 1162941958872971024u }, { 14873036941900635463u, 1860707134196753639u },
{ 15587778368262418694u, 1488565707357402911u }, { 8780873879868024632u, 1190852565885922329u },
{ 2981351763563108441u, 1905364105417475727u }, { 13453127855076217722u, 1524291284333980581u },
{ 7073153469319063855u, 1219433027467184465u }, { 11317045550910502167u, 1951092843947495144u },
{ 12742985255470312057u, 1560874275157996115u }, { 10194388204376249646u, 1248699420126396892u },
{ 1553625868034358140u, 1997919072202235028u }, { 8621598323911307159u, 1598335257761788022u },
{ 17965325103354776697u, 1278668206209430417u }, { 13987124906400001422u, 2045869129935088668u },
{ 121653480894270168u, 1636695303948070935u }, { 97322784715416134u, 1309356243158456748u },
{ 14913111714512307107u, 2094969989053530796u }, { 8241140556867935363u, 1675975991242824637u },
{ 17660958889720079260u, 1340780792994259709u }, { 17189487779326395846u, 2145249268790815535u },
{ 13751590223461116677u, 1716199415032652428u }, { 18379969808252713988u, 1372959532026121942u },
{ 14650556434236701088u, 2196735251241795108u }, { 652398703163629901u, 1757388200993436087u },
{ 11589965406756634890u, 1405910560794748869u }, { 7475898206584884855u, 2249456897271598191u },
{ 2291369750525997561u, 1799565517817278553u }, { 9211793429904618695u, 1439652414253822842u },
{ 18428218302589300235u, 2303443862806116547u }, { 7363877012587619542u, 1842755090244893238u },
{ 13269799239553916280u, 1474204072195914590u }, { 10615839391643133024u, 1179363257756731672u },
{ 2227947767661371545u, 1886981212410770676u }, { 16539753473096738529u, 1509584969928616540u },
{ 13231802778477390823u, 1207667975942893232u }, { 6413489186596184024u, 1932268761508629172u },
{ 16198837793502678189u, 1545815009206903337u }, { 5580372605318321905u, 1236652007365522670u },
{ 8928596168509315048u, 1978643211784836272u }, { 18210923379033183008u, 1582914569427869017u },
{ 7190041073742725760u, 1266331655542295214u }, { 436019273762630246u, 2026130648867672343u },
{ 7727513048493924843u, 1620904519094137874u }, { 9871359253537050198u, 1296723615275310299u },
{ 4726128361433549347u, 2074757784440496479u }, { 7470251503888749801u, 1659806227552397183u },
{ 13354898832594820487u, 1327844982041917746u }, { 13989140502667892133u, 2124551971267068394u },
{ 14880661216876224029u, 1699641577013654715u }, { 11904528973500979224u, 1359713261610923772u },
{ 4289851098633925465u, 2175541218577478036u }, { 18189276137874781665u, 1740432974861982428u },
{ 3483374466074094362u, 1392346379889585943u }, { 1884050330976640656u, 2227754207823337509u },
{ 5196589079523222848u, 1782203366258670007u }, { 15225317707844309248u, 1425762693006936005u },
{ 5913764258841343181u, 2281220308811097609u }, { 8420360221814984868u, 1824976247048878087u },
{ 17804334621677718864u, 1459980997639102469u }, { 17932816512084085415u, 1167984798111281975u },
{ 10245762345624985047u, 1868775676978051161u }, { 4507261061758077715u, 1495020541582440929u },
{ 7295157664148372495u, 1196016433265952743u }, { 7982903447895485668u, 1913626293225524389u },
{ 10075671573058298858u, 1530901034580419511u }, { 4371188443704728763u, 1224720827664335609u },
{ 14372599139411386667u, 1959553324262936974u }, { 15187428126271019657u, 1567642659410349579u },
{ 15839291315758726049u, 1254114127528279663u }, { 3206773216762499739u, 2006582604045247462u },
{ 13633465017635730761u, 1605266083236197969u }, { 14596120828850494932u, 1284212866588958375u },
{ 4907049252451240275u, 2054740586542333401u }, { 236290587219081897u, 1643792469233866721u },
{ 14946427728742906810u, 1315033975387093376u }, { 16535586736504830250u, 2104054360619349402u },
{ 5849771759720043554u, 1683243488495479522u }, { 15747863852001765813u, 1346594790796383617u },
{ 10439186904235184007u, 2154551665274213788u }, { 15730047152871967852u, 1723641332219371030u },
{ 12584037722297574282u, 1378913065775496824u }, { 9066413911450387881u, 2206260905240794919u },
{ 10942479943902220628u, 1765008724192635935u }, { 8753983955121776503u, 1412006979354108748u },
{ 10317025513452932081u, 2259211166966573997u }, { 874922781278525018u, 1807368933573259198u },
{ 8078635854506640661u, 1445895146858607358u }, { 13841606313089133175u, 1156716117486885886u },
{ 14767872471458792434u, 1850745787979017418u }, { 746251532941302978u, 1480596630383213935u },
{ 597001226353042382u, 1184477304306571148u }, { 15712597221132509104u, 1895163686890513836u },
{ 8880728962164096960u, 1516130949512411069u }, { 10793931984473187891u, 1212904759609928855u },
{ 17270291175157100626u, 1940647615375886168u }, { 2748186495899949531u, 1552518092300708935u },
{ 2198549196719959625u, 1242014473840567148u }, { 18275073973719576693u, 1987223158144907436u },
{ 10930710364233751031u, 1589778526515925949u }, { 12433917106128911148u, 1271822821212740759u },
{ 8826220925580526867u, 2034916513940385215u }, { 7060976740464421494u, 1627933211152308172u },
{ 16716827836597268165u, 1302346568921846537u }, { 11989529279587987770u, 2083754510274954460u },
{ 9591623423670390216u, 1667003608219963568u }, { 15051996368420132820u, 1333602886575970854u },
{ 13015147745246481542u, 2133764618521553367u }, { 3033420566713364587u, 1707011694817242694u },
{ 6116085268112601993u, 1365609355853794155u }, { 9785736428980163188u, 2184974969366070648u },
{ 15207286772667951197u, 1747979975492856518u }, { 1097782973908629988u, 1398383980394285215u },
{ 1756452758253807981u, 2237414368630856344u }, { 5094511021344956708u, 1789931494904685075u },
{ 4075608817075965366u, 1431945195923748060u }, { 6520974107321544586u, 2291112313477996896u },
{ 1527430471115325346u, 1832889850782397517u }, { 12289990821117991246u, 1466311880625918013u },
{ 17210690286378213644u, 1173049504500734410u }, { 9090360384495590213u, 1876879207201175057u },
{ 18340334751822203140u, 1501503365760940045u }, { 14672267801457762512u, 1201202692608752036u },
{ 16096930852848599373u, 1921924308174003258u }, { 1809498238053148529u, 1537539446539202607u },
{ 12515645034668249793u, 1230031557231362085u }, { 1578287981759648052u, 1968050491570179337u },
{ 12330676829633449412u, 1574440393256143469u }, { 13553890278448669853u, 1259552314604914775u },
{ 3239480371808320148u, 2015283703367863641u }, { 17348979556414297411u, 1612226962694290912u },
{ 6500486015647617283u, 1289781570155432730u }, { 10400777625036187652u, 2063650512248692368u },
{ 15699319729512770768u, 1650920409798953894u }, { 16248804598352126938u, 1320736327839163115u },
{ 7551343283653851484u, 2113178124542660985u }, { 6041074626923081187u, 1690542499634128788u },
{ 12211557331022285596u, 1352433999707303030u }, { 1091747655926105338u, 2163894399531684849u },
{ 4562746939482794594u, 1731115519625347879u }, { 7339546366328145998u, 1384892415700278303u },
{ 8053925371383123274u, 2215827865120445285u }, { 6443140297106498619u, 1772662292096356228u },
{ 12533209867169019542u, 1418129833677084982u }, { 5295740528502789974u, 2269007733883335972u },
{ 15304638867027962949u, 1815206187106668777u }, { 4865013464138549713u, 1452164949685335022u },
{ 14960057215536570740u, 1161731959748268017u }, { 9178696285890871890u, 1858771135597228828u },
{ 14721654658196518159u, 1487016908477783062u }, { 4398626097073393881u, 1189613526782226450u },
{ 7037801755317430209u, 1903381642851562320u }, { 5630241404253944167u, 1522705314281249856u },
{ 814844308661245011u, 1218164251424999885u }, { 1303750893857992017u, 1949062802279999816u },
{ 15800395974054034906u, 1559250241823999852u }, { 5261619149759407279u, 1247400193459199882u },
{ 12107939454356961969u, 1995840309534719811u }, { 5997002748743659252u, 1596672247627775849u },
{ 8486951013736837725u, 1277337798102220679u }, { 2511075177753209390u, 2043740476963553087u },
{ 13076906586428298482u, 1634992381570842469u }, { 14150874083884549109u, 1307993905256673975u },
{ 4194654460505726958u, 2092790248410678361u }, { 18113118827372222859u, 1674232198728542688u },
{ 3422448617672047318u, 1339385758982834151u }, { 16543964232501006678u, 2143017214372534641u },
{ 9545822571258895019u, 1714413771498027713u }, { 15015355686490936662u, 1371531017198422170u },
{ 5577825024675947042u, 2194449627517475473u }, { 11840957649224578280u, 1755559702013980378u },
{ 16851463748863483271u, 1404447761611184302u }, { 12204946739213931940u, 2247116418577894884u },
{ 13453306206113055875u, 1797693134862315907u }, { 3383947335406624054u, 1438154507889852726u }
};
static const uint64_t DOUBLE_POW5_SPLIT[326][2] = {
{ 0u, 1152921504606846976u }, { 0u, 1441151880758558720u },
{ 0u, 1801439850948198400u }, { 0u, 2251799813685248000u },
{ 0u, 1407374883553280000u }, { 0u, 1759218604441600000u },
{ 0u, 2199023255552000000u }, { 0u, 1374389534720000000u },
{ 0u, 1717986918400000000u }, { 0u, 2147483648000000000u },
{ 0u, 1342177280000000000u }, { 0u, 1677721600000000000u },
{ 0u, 2097152000000000000u }, { 0u, 1310720000000000000u },
{ 0u, 1638400000000000000u }, { 0u, 2048000000000000000u },
{ 0u, 1280000000000000000u }, { 0u, 1600000000000000000u },
{ 0u, 2000000000000000000u }, { 0u, 1250000000000000000u },
{ 0u, 1562500000000000000u }, { 0u, 1953125000000000000u },
{ 0u, 1220703125000000000u }, { 0u, 1525878906250000000u },
{ 0u, 1907348632812500000u }, { 0u, 1192092895507812500u },
{ 0u, 1490116119384765625u }, { 4611686018427387904u, 1862645149230957031u },
{ 9799832789158199296u, 1164153218269348144u }, { 12249790986447749120u, 1455191522836685180u },
{ 15312238733059686400u, 1818989403545856475u }, { 14528612397897220096u, 2273736754432320594u },
{ 13692068767113150464u, 1421085471520200371u }, { 12503399940464050176u, 1776356839400250464u },
{ 15629249925580062720u, 2220446049250313080u }, { 9768281203487539200u, 1387778780781445675u },
{ 7598665485932036096u, 1734723475976807094u }, { 274959820560269312u, 2168404344971008868u },
{ 9395221924704944128u, 1355252715606880542u }, { 2520655369026404352u, 1694065894508600678u },
{ 12374191248137781248u, 2117582368135750847u }, { 14651398557727195136u, 1323488980084844279u },
{ 13702562178731606016u, 1654361225106055349u }, { 3293144668132343808u, 2067951531382569187u },
{ 18199116482078572544u, 1292469707114105741u }, { 8913837547316051968u, 1615587133892632177u },
{ 15753982952572452864u, 2019483917365790221u }, { 12152082354571476992u, 1262177448353618888u },
{ 15190102943214346240u, 1577721810442023610u }, { 9764256642163156992u, 1972152263052529513u },
{ 17631875447420442880u, 1232595164407830945u }, { 8204786253993389888u, 1540743955509788682u },
{ 1032610780636961552u, 1925929944387235853u }, { 2951224747111794922u, 1203706215242022408u },
{ 3689030933889743652u, 1504632769052528010u }, { 13834660704216955373u, 1880790961315660012u },
{ 17870034976990372916u, 1175494350822287507u }, { 17725857702810578241u, 1469367938527859384u },
{ 3710578054803671186u, 1836709923159824231u }, { 26536550077201078u, 2295887403949780289u },
{ 11545800389866720434u, 1434929627468612680u }, { 14432250487333400542u, 1793662034335765850u },
{ 8816941072311974870u, 2242077542919707313u }, { 17039803216263454053u, 1401298464324817070u },
{ 12076381983474541759u, 1751623080406021338u }, { 5872105442488401391u, 2189528850507526673u },
{ 15199280947623720629u, 1368455531567204170u }, { 9775729147674874978u, 1710569414459005213u },
{ 16831347453020981627u, 2138211768073756516u }, { 1296220121283337709u, 1336382355046097823u },
{ 15455333206886335848u, 1670477943807622278u }, { 10095794471753144002u, 2088097429759527848u },
{ 6309871544845715001u, 1305060893599704905u }, { 12499025449484531656u, 1631326116999631131u },
{ 11012095793428276666u, 2039157646249538914u }, { 11494245889320060820u, 1274473528905961821u },
{ 532749306367912313u, 1593091911132452277u }, { 5277622651387278295u, 1991364888915565346u },
{ 7910200175544436838u, 1244603055572228341u }, { 14499436237857933952u, 1555753819465285426u },
{ 8900923260467641632u, 1944692274331606783u }, { 12480606065433357876u, 1215432671457254239u },
{ 10989071563364309441u, 1519290839321567799u }, { 9124653435777998898u, 1899113549151959749u },
{ 8008751406574943263u, 1186945968219974843u }, { 5399253239791291175u, 1483682460274968554u },
{ 15972438586593889776u, 1854603075343710692u }, { 759402079766405302u, 1159126922089819183u },
{ 14784310654990170340u, 1448908652612273978u }, { 9257016281882937117u, 1811135815765342473u },
{ 16182956370781059300u, 2263919769706678091u }, { 7808504722524468110u, 1414949856066673807u },
{ 5148944884728197234u, 1768687320083342259u }, { 1824495087482858639u, 2210859150104177824u },
{ 1140309429676786649u, 1381786968815111140u }, { 1425386787095983311u, 1727233711018888925u },
{ 6393419502297367043u, 2159042138773611156u }, { 13219259225790630210u, 1349401336733506972u },
{ 16524074032238287762u, 1686751670916883715u }, { 16043406521870471799u, 2108439588646104644u },
{ 803757039314269066u, 1317774742903815403u }, { 14839754354425000045u, 1647218428629769253u },
{ 4714634887749086344u, 2059023035787211567u }, { 9864175832484260821u, 1286889397367007229u },
{ 16941905809032713930u, 1608611746708759036u }, { 2730638187581340797u, 2010764683385948796u },
{ 10930020904093113806u, 1256727927116217997u }, { 18274212148543780162u, 1570909908895272496u },
{ 4396021111970173586u, 1963637386119090621u }, { 5053356204195052443u, 1227273366324431638u },
{ 15540067292098591362u, 1534091707905539547u }, { 14813398096695851299u, 1917614634881924434u },
{ 13870059828862294966u, 1198509146801202771u }, { 12725888767650480803u, 1498136433501503464u },
{ 15907360959563101004u, 1872670541876879330u }, { 14553786618154326031u, 1170419088673049581u },
{ 4357175217410743827u, 1463023860841311977u }, { 10058155040190817688u, 1828779826051639971u },
{ 7961007781811134206u, 2285974782564549964u }, { 14199001900486734687u, 1428734239102843727u },
{ 13137066357181030455u, 1785917798878554659u }, { 11809646928048900164u, 2232397248598193324u },
{ 16604401366885338411u, 1395248280373870827u }, { 16143815690179285109u, 1744060350467338534u },
{ 10956397575869330579u, 2180075438084173168u }, { 6847748484918331612u, 1362547148802608230u },
{ 17783057643002690323u, 1703183936003260287u }, { 17617136035325974999u, 2128979920004075359u },
{ 17928239049719816230u, 1330612450002547099u }, { 17798612793722382384u, 1663265562503183874u },
{ 13024893955298202172u, 2079081953128979843u }, { 5834715712847682405u, 1299426220705612402u },
{ 16516766677914378815u, 1624282775882015502u }, { 11422586310538197711u, 2030353469852519378u },
{ 11750802462513761473u, 1268970918657824611u }, { 10076817059714813937u, 1586213648322280764u },
{ 12596021324643517422u, 1982767060402850955u }, { 5566670318688504437u, 1239229412751781847u },
{ 2346651879933242642u, 1549036765939727309u }, { 7545000868343941206u, 1936295957424659136u },
{ 4715625542714963254u, 1210184973390411960u }, { 5894531928393704067u, 1512731216738014950u },
{ 16591536947346905892u, 1890914020922518687u }, { 17287239619732898039u, 1181821263076574179u },
{ 16997363506238734644u, 1477276578845717724u }, { 2799960309088866689u, 1846595723557147156u },
{ 10973347230035317489u, 1154122327223216972u }, { 13716684037544146861u, 1442652909029021215u },
{ 12534169028502795672u, 1803316136286276519u }, { 11056025267201106687u, 2254145170357845649u },
{ 18439230838069161439u, 1408840731473653530u }, { 13825666510731675991u, 1761050914342066913u },
{ 3447025083132431277u, 2201313642927583642u }, { 6766076695385157452u, 1375821026829739776u },
{ 8457595869231446815u, 1719776283537174720u }, { 10571994836539308519u, 2149720354421468400u },
{ 6607496772837067824u, 1343575221513417750u }, { 17482743002901110588u, 1679469026891772187u },
{ 17241742735199000331u, 2099336283614715234u }, { 15387775227926763111u, 1312085177259197021u },
{ 5399660979626290177u, 1640106471573996277u }, { 11361262242960250625u, 2050133089467495346u },
{ 11712474920277544544u, 1281333180917184591u }, { 10028907631919542777u, 1601666476146480739u },
{ 7924448521472040567u, 2002083095183100924u }, { 14176152362774801162u, 1251301934489438077u },
{ 3885132398186337741u, 1564127418111797597u }, { 9468101516160310080u, 1955159272639746996u },
{ 15140935484454969608u, 1221974545399841872u }, { 479425281859160394u, 1527468181749802341u },
{ 5210967620751338397u, 1909335227187252926u }, { 17091912818251750210u, 1193334516992033078u },
{ 12141518985959911954u, 1491668146240041348u }, { 15176898732449889943u, 1864585182800051685u },
{ 11791404716994875166u, 1165365739250032303u }, { 10127569877816206054u, 1456707174062540379u },
{ 8047776328842869663u, 1820883967578175474u }, { 836348374198811271u, 2276104959472719343u },
{ 7440246761515338900u, 1422565599670449589u }, { 13911994470321561530u, 1778206999588061986u },
{ 8166621051047176104u, 2222758749485077483u }, { 2798295147690791113u, 1389224218428173427u },
{ 17332926989895652603u, 1736530273035216783u }, { 17054472718942177850u, 2170662841294020979u },
{ 8353202440125167204u, 1356664275808763112u }, { 10441503050156459005u, 1695830344760953890u },
{ 3828506775840797949u, 2119787930951192363u }, { 86973725686804766u, 1324867456844495227u },
{ 13943775212390669669u, 1656084321055619033u }, { 3594660960206173375u, 2070105401319523792u },
{ 2246663100128858359u, 1293815875824702370u }, { 12031700912015848757u, 1617269844780877962u },
{ 5816254103165035138u, 2021587305976097453u }, { 5941001823691840913u, 1263492066235060908u },
{ 7426252279614801142u, 1579365082793826135u }, { 4671129331091113523u, 1974206353492282669u },
{ 5225298841145639904u, 1233878970932676668u }, { 6531623551432049880u, 1542348713665845835u },
{ 3552843420862674446u, 1927935892082307294u }, { 16055585193321335241u, 1204959932551442058u },
{ 10846109454796893243u, 1506199915689302573u }, { 18169322836923504458u, 1882749894611628216u },
{ 11355826773077190286u, 1176718684132267635u }, { 9583097447919099954u, 1470898355165334544u },
{ 11978871809898874942u, 1838622943956668180u }, { 14973589762373593678u, 2298278679945835225u },
{ 2440964573842414192u, 1436424174966147016u }, { 3051205717303017741u, 1795530218707683770u },
{ 13037379183483547984u, 2244412773384604712u }, { 8148361989677217490u, 1402757983365377945u },
{ 14797138505523909766u, 1753447479206722431u }, { 13884737113477499304u, 2191809349008403039u },
{ 15595489723564518921u, 1369880843130251899u }, { 14882676136028260747u, 1712351053912814874u },
{ 9379973133180550126u, 2140438817391018593u }, { 17391698254306313589u, 1337774260869386620u },
{ 3292878744173340370u, 1672217826086733276u }, { 4116098430216675462u, 2090272282608416595u },
{ 266718509671728212u, 1306420176630260372u }, { 333398137089660265u, 1633025220787825465u },
{ 5028433689789463235u, 2041281525984781831u }, { 10060300083759496378u, 1275800953740488644u },
{ 12575375104699370472u, 1594751192175610805u }, { 1884160825592049379u, 1993438990219513507u },
{ 17318501580490888525u, 1245899368887195941u }, { 7813068920331446945u, 1557374211108994927u },
{ 5154650131986920777u, 1946717763886243659u }, { 915813323278131534u, 1216698602428902287u },
{ 14979824709379828129u, 1520873253036127858u }, { 9501408849870009354u, 1901091566295159823u },
{ 12855909558809837702u, 1188182228934474889u }, { 2234828893230133415u, 1485227786168093612u },
{ 2793536116537666769u, 1856534732710117015u }, { 8663489100477123587u, 1160334207943823134u },
{ 1605989338741628675u, 1450417759929778918u }, { 11230858710281811652u, 1813022199912223647u },
{ 9426887369424876662u, 2266277749890279559u }, { 12809333633531629769u, 1416423593681424724u },
{ 16011667041914537212u, 1770529492101780905u }, { 6179525747111007803u, 2213161865127226132u },
{ 13085575628799155685u, 1383226165704516332u }, { 16356969535998944606u, 1729032707130645415u },
{ 15834525901571292854u, 2161290883913306769u }, { 2979049660840976177u, 1350806802445816731u },
{ 17558870131333383934u, 1688508503057270913u }, { 8113529608884566205u, 2110635628821588642u },
{ 9682642023980241782u, 1319147268013492901u }, { 16714988548402690132u, 1648934085016866126u },
{ 11670363648648586857u, 2061167606271082658u }, { 11905663298832754689u, 1288229753919426661u },
{ 1047021068258779650u, 1610287192399283327u }, { 15143834390605638274u, 2012858990499104158u },
{ 4853210475701136017u, 1258036869061940099u }, { 1454827076199032118u, 1572546086327425124u },
{ 1818533845248790147u, 1965682607909281405u }, { 3442426662494187794u, 1228551629943300878u },
{ 13526405364972510550u, 1535689537429126097u }, { 3072948650933474476u, 1919611921786407622u },
{ 15755650962115585259u, 1199757451116504763u }, { 15082877684217093670u, 1499696813895630954u },
{ 9630225068416591280u, 1874621017369538693u }, { 8324733676974063502u, 1171638135855961683u },
{ 5794231077790191473u, 1464547669819952104u }, { 7242788847237739342u, 1830684587274940130u },
{ 18276858095901949986u, 2288355734093675162u }, { 16034722328366106645u, 1430222333808546976u },
{ 1596658836748081690u, 1787777917260683721u }, { 6607509564362490017u, 2234722396575854651u },
{ 1823850468512862308u, 1396701497859909157u }, { 6891499104068465790u, 1745876872324886446u },
{ 17837745916940358045u, 2182346090406108057u }, { 4231062170446641922u, 1363966306503817536u },
{ 5288827713058302403u, 1704957883129771920u }, { 6611034641322878003u, 2131197353912214900u },
{ 13355268687681574560u, 1331998346195134312u }, { 16694085859601968200u, 1664997932743917890u },
{ 11644235287647684442u, 2081247415929897363u }, { 4971804045566108824u, 1300779634956185852u },
{ 6214755056957636030u, 1625974543695232315u }, { 3156757802769657134u, 2032468179619040394u },
{ 6584659645158423613u, 1270292612261900246u }, { 17454196593302805324u, 1587865765327375307u },
{ 17206059723201118751u, 1984832206659219134u }, { 6142101308573311315u, 1240520129162011959u },
{ 3065940617289251240u, 1550650161452514949u }, { 8444111790038951954u, 1938312701815643686u },
{ 665883850346957067u, 1211445438634777304u }, { 832354812933696334u, 1514306798293471630u },
{ 10263815553021896226u, 1892883497866839537u }, { 17944099766707154901u, 1183052186166774710u },
{ 13206752671529167818u, 1478815232708468388u }, { 16508440839411459773u, 1848519040885585485u },
{ 12623618533845856310u, 1155324400553490928u }, { 15779523167307320387u, 1444155500691863660u },
{ 1277659885424598868u, 1805194375864829576u }, { 1597074856780748586u, 2256492969831036970u },
{ 5609857803915355770u, 1410308106144398106u }, { 16235694291748970521u, 1762885132680497632u },
{ 1847873790976661535u, 2203606415850622041u }, { 12684136165428883219u, 1377254009906638775u },
{ 11243484188358716120u, 1721567512383298469u }, { 219297180166231438u, 2151959390479123087u },
{ 7054589765244976505u, 1344974619049451929u }, { 13429923224983608535u, 1681218273811814911u },
{ 12175718012802122765u, 2101522842264768639u }, { 14527352785642408584u, 1313451776415480399u },
{ 13547504963625622826u, 1641814720519350499u }, { 12322695186104640628u, 2052268400649188124u },
{ 16925056528170176201u, 1282667750405742577u }, { 7321262604930556539u, 1603334688007178222u },
{ 18374950293017971482u, 2004168360008972777u }, { 4566814905495150320u, 1252605225005607986u },
{ 14931890668723713708u, 1565756531257009982u }, { 9441491299049866327u, 1957195664071262478u },
{ 1289246043478778550u, 1223247290044539049u }, { 6223243572775861092u, 1529059112555673811u },
{ 3167368447542438461u, 1911323890694592264u }, { 1979605279714024038u, 1194577431684120165u },
{ 7086192618069917952u, 1493221789605150206u }, { 18081112809442173248u, 1866527237006437757u },
{ 13606538515115052232u, 1166579523129023598u }, { 7784801107039039482u, 1458224403911279498u },
{ 507629346944023544u, 1822780504889099373u }, { 5246222702107417334u, 2278475631111374216u },
{ 3278889188817135834u, 1424047269444608885u }, { 8710297504448807696u, 1780059086805761106u }
};
#endif // RYU_D2S_FULL_TABLE_H

View file

@ -215,146 +215,8 @@ static inline bool multipleOfPowerOf5(const uint64_t value, const uint32_t p) {
// Returns true if value is divisible by 2^p.
static inline bool multipleOfPowerOf2(const uint64_t value, const uint32_t p) {
assert(value != 0);
// __builtin_ctzll doesn't appear to be faster here.
// return __builtin_ctzll(value) >= p;
return (value & ((1ull << p) - 1)) == 0;
}
// We need a 64x128-bit multiplication and a subsequent 128-bit shift.
// Multiplication:
// The 64-bit factor is variable and passed in, the 128-bit factor comes
// from a lookup table. We know that the 64-bit factor only has 55
// significant bits (i.e., the 9 topmost bits are zeros). The 128-bit
// factor only has 124 significant bits (i.e., the 4 topmost bits are
// zeros).
// Shift:
// In principle, the multiplication result requires 55 + 124 = 179 bits to
// represent. However, we then shift this value to the right by j, which is
// at least j >= 115, so the result is guaranteed to fit into 179 - 115 = 64
// bits. This means that we only need the topmost 64 significant bits of
// the 64x128-bit multiplication.
//
// There are several ways to do this:
// 1. Best case: the compiler exposes a 128-bit type.
// We perform two 64x64-bit multiplications, add the higher 64 bits of the
// lower result to the higher result, and shift by j - 64 bits.
//
// We explicitly cast from 64-bit to 128-bit, so the compiler can tell
// that these are only 64-bit inputs, and can map these to the best
// possible sequence of assembly instructions.
// x64 machines happen to have matching assembly instructions for
// 64x64-bit multiplications and 128-bit shifts.
//
// 2. Second best case: the compiler exposes intrinsics for the x64 assembly
// instructions mentioned in 1.
//
// 3. We only have 64x64 bit instructions that return the lower 64 bits of
// the result, i.e., we have to use plain C.
// Our inputs are less than the full width, so we have three options:
// a. Ignore this fact and just implement the intrinsics manually.
// b. Split both into 31-bit pieces, which guarantees no internal overflow,
// but requires extra work upfront (unless we change the lookup table).
// c. Split only the first factor into 31-bit pieces, which also guarantees
// no internal overflow, but requires extra work since the intermediate
// results are not perfectly aligned.
#if defined(HAS_UINT128)
// Best case: use 128-bit type.
static inline uint64_t mulShift64(const uint64_t m, const uint64_t* const mul, const int32_t j) {
const uint128_t b0 = ((uint128_t) m) * mul[0];
const uint128_t b2 = ((uint128_t) m) * mul[1];
return (uint64_t) (((b0 >> 64) + b2) >> (j - 64));
}
static inline uint64_t mulShiftAll64(const uint64_t m, const uint64_t* const mul, const int32_t j,
uint64_t* const vp, uint64_t* const vm, const uint32_t mmShift) {
// m <<= 2;
// uint128_t b0 = ((uint128_t) m) * mul[0]; // 0
// uint128_t b2 = ((uint128_t) m) * mul[1]; // 64
//
// uint128_t hi = (b0 >> 64) + b2;
// uint128_t lo = b0 & 0xffffffffffffffffull;
// uint128_t factor = (((uint128_t) mul[1]) << 64) + mul[0];
// uint128_t vpLo = lo + (factor << 1);
// *vp = (uint64_t) ((hi + (vpLo >> 64)) >> (j - 64));
// uint128_t vmLo = lo - (factor << mmShift);
// *vm = (uint64_t) ((hi + (vmLo >> 64) - (((uint128_t) 1ull) << 64)) >> (j - 64));
// return (uint64_t) (hi >> (j - 64));
*vp = mulShift64(4 * m + 2, mul, j);
*vm = mulShift64(4 * m - 1 - mmShift, mul, j);
return mulShift64(4 * m, mul, j);
}
#elif defined(HAS_64_BIT_INTRINSICS)
static inline uint64_t mulShift64(const uint64_t m, const uint64_t* const mul, const int32_t j) {
// m is maximum 55 bits
uint64_t high1; // 128
const uint64_t low1 = umul128(m, mul[1], &high1); // 64
uint64_t high0; // 64
umul128(m, mul[0], &high0); // 0
const uint64_t sum = high0 + low1;
if (sum < high0) {
++high1; // overflow into high1
}
return shiftright128(sum, high1, j - 64);
}
static inline uint64_t mulShiftAll64(const uint64_t m, const uint64_t* const mul, const int32_t j,
uint64_t* const vp, uint64_t* const vm, const uint32_t mmShift) {
*vp = mulShift64(4 * m + 2, mul, j);
*vm = mulShift64(4 * m - 1 - mmShift, mul, j);
return mulShift64(4 * m, mul, j);
}
#else // !defined(HAS_UINT128) && !defined(HAS_64_BIT_INTRINSICS)
static inline uint64_t mulShift64(const uint64_t m, const uint64_t* const mul, const int32_t j) {
// m is maximum 55 bits
uint64_t high1; // 128
const uint64_t low1 = umul128(m, mul[1], &high1); // 64
uint64_t high0; // 64
umul128(m, mul[0], &high0); // 0
const uint64_t sum = high0 + low1;
if (sum < high0) {
++high1; // overflow into high1
}
return shiftright128(sum, high1, j - 64);
}
// This is faster if we don't have a 64x64->128-bit multiplication.
static inline uint64_t mulShiftAll64(uint64_t m, const uint64_t* const mul, const int32_t j,
uint64_t* const vp, uint64_t* const vm, const uint32_t mmShift) {
m <<= 1;
// m is maximum 55 bits
uint64_t tmp;
const uint64_t lo = umul128(m, mul[0], &tmp);
uint64_t hi;
const uint64_t mid = tmp + umul128(m, mul[1], &hi);
hi += mid < tmp; // overflow into hi
const uint64_t lo2 = lo + mul[0];
const uint64_t mid2 = mid + mul[1] + (lo2 < lo);
const uint64_t hi2 = hi + (mid2 < mid);
*vp = shiftright128(mid2, hi2, (uint32_t) (j - 64 - 1));
if (mmShift == 1) {
const uint64_t lo3 = lo - mul[0];
const uint64_t mid3 = mid - mul[1] - (lo3 > lo);
const uint64_t hi3 = hi - (mid3 > mid);
*vm = shiftright128(mid3, hi3, (uint32_t) (j - 64 - 1));
} else {
const uint64_t lo3 = lo + lo;
const uint64_t mid3 = mid + mid + (lo3 < lo);
const uint64_t hi3 = hi + hi + (mid3 < mid);
const uint64_t lo4 = lo3 - mul[0];
const uint64_t mid4 = mid3 - mul[1] - (lo4 > lo3);
const uint64_t hi4 = hi3 - (mid4 > mid3);
*vm = shiftright128(mid4, hi4, (uint32_t) (j - 64));
}
return shiftright128(mid, hi, (uint32_t) (j - 64 - 1));
}
#endif // HAS_64_BIT_INTRINSICS
#endif // RYU_D2S_INTRINSICS_H

23
deps/ryu/ryu.h vendored
View file

@ -23,21 +23,16 @@ extern "C" {
#include <inttypes.h>
int d2s_buffered_n(double f, char* result);
void d2s_buffered(double f, char* result);
char* d2s(double f);
/* Print the shortest representation of a double using fixed notation
* Only works for numbers smaller than 1e+17 (absolute value)
* Precision limits the amount of digits of the decimal part
*/
int d2sfixed_buffered_n(double f, uint32_t precision, char* result);
int f2s_buffered_n(float f, char* result);
void f2s_buffered(float f, char* result);
char* f2s(float f);
int d2fixed_buffered_n(double d, uint32_t precision, char* result);
void d2fixed_buffered(double d, uint32_t precision, char* result);
char* d2fixed(double d, uint32_t precision);
int d2exp_buffered_n(double d, uint32_t precision, char* result);
void d2exp_buffered(double d, uint32_t precision, char* result);
char* d2exp(double d, uint32_t precision);
/* Print the shortest representation of a double using scientific notation
* Precision limits the amount of digits of the decimal part
*/
int d2sexp_buffered_n(double f, uint32_t precision, char* result);
#ifdef __cplusplus
}

View file

@ -175,7 +175,7 @@ $(LT_OBJS): ../postgis_config.h ../postgis_revision.h $(SA_HEADERS)
RYU_LIBPATH = ../deps/ryu/@RYU_LIB@
$(RYU_LIBPATH):
$(RYU_LIBPATH): ../deps/ryu/d2s.c
$(MAKE) -C ../deps/ryu @RYU_LIB@
liblwgeom.la: $(LT_OBJS) $(RYU_LIBPATH)

View file

@ -149,7 +149,7 @@ test_geos_makevalid(void)
out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom2);
ASSERT_STRING_EQUAL(
out_ewkt,
"GEOMETRYCOLLECTION(POLYGON((92114.014 463463.469,92115.5120743171 463462.206937429,92115.512 463462.207,92127.546 463452.075,92117.173 463439.755,92133.675 463425.942,92122.136 463412.826,92092.377 463437.77,92114.014 463463.469)),MULTIPOINT(92115.5120743171 463462.206937429,92122.136 463412.826))");
"GEOMETRYCOLLECTION(POLYGON((92114.014 463463.469,92115.51207431706 463462.206937429,92115.512 463462.207,92127.546 463452.075,92117.173 463439.755,92133.675 463425.942,92122.136 463412.82600000006,92092.377 463437.77,92114.014 463463.469)),MULTIPOINT(92115.51207431706 463462.2069374289,92122.136 463412.826))");
lwfree(out_ewkt);
lwgeom_free(geom1);
lwgeom_free(geom2);

View file

@ -81,16 +81,7 @@ static void out_geojson_test_precision(void)
NULL, 15, 0);
/* small numbers */
/* NOTE: precision of 300 will be converted to max precision (15)
* and being there no significant digit within that range
* only zeroes will be returned
* See http://trac.osgeo.org/postgis/ticket/2051#comment:11
*/
do_geojson_test("POINT(1E-300 -2E-200)",
"{\"type\":\"Point\",\"coordinates\":[0,0]}",
NULL,
300,
0);
do_geojson_test("POINT(1E-300 -2E-200)", "{\"type\":\"Point\",\"coordinates\":[1e-300,-2e-200]}", NULL, 300, 0);
}

View file

@ -113,10 +113,7 @@ static void out_svg_test_precision(void)
0, 0);
/* huge data - with relative PointArray */
do_svg_test(
"LINESTRING(1E300 -1E300,1E301 -1E301)",
"M 1e+300 1e+300 l 9e+300 9e+300",
0, 1);
do_svg_test("LINESTRING(1E300 -1E300,1E301 -1E301)", "M 1e+300 1e+300 l 9e+300 9e+300", 0, 1);
}

View file

@ -79,15 +79,15 @@ static void test_wkt_out_point(void)
CU_ASSERT_STRING_EQUAL(cu_wkt("SRID=100;POINT(100.1 100 12 12)",WKT_EXTENDED), "SRID=100;POINT(100.1 100 12 12)");
/* Test big numbers */
CU_ASSERT_STRING_EQUAL(cu_wkt("POINT(-123456789012345.12345678 -1234567890123458.12345678)", WKT_ISO),
"POINT(-123456789012345 -1.234568e+15)");
CU_ASSERT_STRING_EQUAL(
ASSERT_STRING_EQUAL(cu_wkt("POINT(-123456789012345.12345678 -1234567890123458.12345678)", WKT_ISO),
"POINT(-123456789012345.12 -1.23456789e+15)");
ASSERT_STRING_EQUAL(
cu_wkt(
"POINT( "
"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 "
"0.000000000000000000000000000001)",
WKT_ISO),
"POINT(1e+100 0)");
"POINT(1e+100 1e-30)");
}
static void test_wkt_out_linestring(void)

View file

@ -63,8 +63,7 @@ static void out_x3d3_test_precision(void)
9, 0);
/* huge data */
do_x3d3_test(
"POINT(1E300 -105E-153 4E300)", "1e+300 0 4e+300", 0, 0);
do_x3d3_test("POINT(1E300 -105E-153 4E300)", "1e+300 -1e-151 4e+300", 0, 0);
}

View file

@ -17,7 +17,8 @@
#include "liblwgeom_internal.h"
#include "cu_tester.h"
static void test_lwprint_assert_format(char * point_wkt, const char * format, const char * expected)
static void
test_lwpoint_to_latlon_assert_format(char *point_wkt, const char *format, const char *expected)
{
LWPOINT * test_point = (LWPOINT*)lwgeom_from_wkt(point_wkt, LW_PARSER_CHECK_NONE);
int num_old_failures, num_new_failures;
@ -39,7 +40,8 @@ static void test_lwprint_assert_format(char * point_wkt, const char * format, co
lwfree(actual);
lwpoint_free(test_point);
}
static void test_lwprint_assert_error(char * point_wkt, const char * format)
static void
test_lwpoint_to_latlon_assert_error(char *point_wkt, const char *format)
{
LWPOINT * test_point = (LWPOINT*)lwgeom_from_wkt(point_wkt, LW_PARSER_CHECK_NONE);
cu_error_msg_reset();
@ -60,103 +62,499 @@ static void test_lwprint_assert_error(char * point_wkt, const char * format)
/*
** Test points around the globe using the default format. Null and empty string both mean use the default.
*/
static void test_lwprint_default_format(void)
static void
test_lwpoint_to_latlon_default_format(void)
{
test_lwprint_assert_format("POINT(0 0)", NULL, "0\xC2\xB0""0'0.000\"N 0\xC2\xB0""0'0.000\"E");
test_lwprint_assert_format("POINT(45.4545 12.34567)", "" , "12\xC2\xB0""20'44.412\"N 45\xC2\xB0""27'16.200\"E");
test_lwprint_assert_format("POINT(180 90)", NULL, "90\xC2\xB0""0'0.000\"N 180\xC2\xB0""0'0.000\"E");
test_lwprint_assert_format("POINT(181 91)", "" , "89\xC2\xB0""0'0.000\"N 1\xC2\xB0""0'0.000\"E");
test_lwprint_assert_format("POINT(180.0001 90.0001)", NULL, "89\xC2\xB0""59'59.640\"N 0\xC2\xB0""0'0.360\"E");
test_lwprint_assert_format("POINT(45.4545 -12.34567)", "" , "12\xC2\xB0""20'44.412\"S 45\xC2\xB0""27'16.200\"E");
test_lwprint_assert_format("POINT(180 -90)", NULL, "90\xC2\xB0""0'0.000\"S 180\xC2\xB0""0'0.000\"E");
test_lwprint_assert_format("POINT(181 -91)", "" , "89\xC2\xB0""0'0.000\"S 1\xC2\xB0""0'0.000\"E");
test_lwprint_assert_format("POINT(180.0001 -90.0001)", NULL, "89\xC2\xB0""59'59.640\"S 0\xC2\xB0""0'0.360\"E");
test_lwprint_assert_format("POINT(-45.4545 12.34567)", "" , "12\xC2\xB0""20'44.412\"N 45\xC2\xB0""27'16.200\"W");
test_lwprint_assert_format("POINT(-180 90)", NULL, "90\xC2\xB0""0'0.000\"N 180\xC2\xB0""0'0.000\"W");
test_lwprint_assert_format("POINT(-181 91)", "" , "89\xC2\xB0""0'0.000\"N 1\xC2\xB0""0'0.000\"W");
test_lwprint_assert_format("POINT(-180.0001 90.0001)", NULL, "89\xC2\xB0""59'59.640\"N 0\xC2\xB0""0'0.360\"W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "" , "12\xC2\xB0""20'44.412\"S 45\xC2\xB0""27'16.200\"W");
test_lwprint_assert_format("POINT(-180 -90)", NULL, "90\xC2\xB0""0'0.000\"S 180\xC2\xB0""0'0.000\"W");
test_lwprint_assert_format("POINT(-181 -91)", "" , "89\xC2\xB0""0'0.000\"S 1\xC2\xB0""0'0.000\"W");
test_lwprint_assert_format("POINT(-180.0001 -90.0001)", NULL, "89\xC2\xB0""59'59.640\"S 0\xC2\xB0""0'0.360\"W");
test_lwprint_assert_format("POINT(-2348982391.123456 -238749827.34879)", "" , "12\xC2\xB0""39'4.356\"N 31\xC2\xB0""7'24.442\"W");
test_lwpoint_to_latlon_assert_format("POINT(0 0)",
NULL,
"0\xC2\xB0"
"0'0.000\"N 0\xC2\xB0"
"0'0.000\"E");
test_lwpoint_to_latlon_assert_format("POINT(45.4545 12.34567)",
"",
"12\xC2\xB0"
"20'44.412\"N 45\xC2\xB0"
"27'16.200\"E");
test_lwpoint_to_latlon_assert_format("POINT(180 90)",
NULL,
"90\xC2\xB0"
"0'0.000\"N 180\xC2\xB0"
"0'0.000\"E");
test_lwpoint_to_latlon_assert_format("POINT(181 91)",
"",
"89\xC2\xB0"
"0'0.000\"N 1\xC2\xB0"
"0'0.000\"E");
test_lwpoint_to_latlon_assert_format("POINT(180.0001 90.0001)",
NULL,
"89\xC2\xB0"
"59'59.640\"N 0\xC2\xB0"
"0'0.360\"E");
test_lwpoint_to_latlon_assert_format("POINT(45.4545 -12.34567)",
"",
"12\xC2\xB0"
"20'44.412\"S 45\xC2\xB0"
"27'16.200\"E");
test_lwpoint_to_latlon_assert_format("POINT(180 -90)",
NULL,
"90\xC2\xB0"
"0'0.000\"S 180\xC2\xB0"
"0'0.000\"E");
test_lwpoint_to_latlon_assert_format("POINT(181 -91)",
"",
"89\xC2\xB0"
"0'0.000\"S 1\xC2\xB0"
"0'0.000\"E");
test_lwpoint_to_latlon_assert_format("POINT(180.0001 -90.0001)",
NULL,
"89\xC2\xB0"
"59'59.640\"S 0\xC2\xB0"
"0'0.360\"E");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 12.34567)",
"",
"12\xC2\xB0"
"20'44.412\"N 45\xC2\xB0"
"27'16.200\"W");
test_lwpoint_to_latlon_assert_format("POINT(-180 90)",
NULL,
"90\xC2\xB0"
"0'0.000\"N 180\xC2\xB0"
"0'0.000\"W");
test_lwpoint_to_latlon_assert_format("POINT(-181 91)",
"",
"89\xC2\xB0"
"0'0.000\"N 1\xC2\xB0"
"0'0.000\"W");
test_lwpoint_to_latlon_assert_format("POINT(-180.0001 90.0001)",
NULL,
"89\xC2\xB0"
"59'59.640\"N 0\xC2\xB0"
"0'0.360\"W");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)",
"",
"12\xC2\xB0"
"20'44.412\"S 45\xC2\xB0"
"27'16.200\"W");
test_lwpoint_to_latlon_assert_format("POINT(-180 -90)",
NULL,
"90\xC2\xB0"
"0'0.000\"S 180\xC2\xB0"
"0'0.000\"W");
test_lwpoint_to_latlon_assert_format("POINT(-181 -91)",
"",
"89\xC2\xB0"
"0'0.000\"S 1\xC2\xB0"
"0'0.000\"W");
test_lwpoint_to_latlon_assert_format("POINT(-180.0001 -90.0001)",
NULL,
"89\xC2\xB0"
"59'59.640\"S 0\xC2\xB0"
"0'0.360\"W");
test_lwpoint_to_latlon_assert_format("POINT(-2348982391.123456 -238749827.34879)",
"",
"12\xC2\xB0"
"39'4.356\"N 31\xC2\xB0"
"7'24.442\"W");
/* See https://trac.osgeo.org/postgis/ticket/3688 */
test_lwprint_assert_format("POINT (76.6 -76.6)", NULL, "76\xC2\xB0""36'0.000\"S 76\xC2\xB0""36'0.000\"E");
test_lwpoint_to_latlon_assert_format("POINT (76.6 -76.6)",
NULL,
"76\xC2\xB0"
"36'0.000\"S 76\xC2\xB0"
"36'0.000\"E");
}
/*
* Test all possible combinations of the orders of the parameters.
*/
static void test_lwprint_format_orders(void)
static void
test_lwpoint_to_latlon_format_orders(void)
{
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "C DD MM SS", "S 12 20 44 W 45 27 16");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "C DD SS MM", "S 12 44 20 W 45 16 27");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "C MM DD SS", "S 20 12 44 W 27 45 16");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "C MM SS DD", "S 20 44 12 W 27 16 45");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "C SS DD MM", "S 44 12 20 W 16 45 27");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "C SS MM DD", "S 44 20 12 W 16 27 45");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "C DD MM SS", "S 12 20 44 W 45 27 16");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "C DD SS MM", "S 12 44 20 W 45 16 27");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "C MM DD SS", "S 20 12 44 W 27 45 16");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "C MM SS DD", "S 20 44 12 W 27 16 45");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "C SS DD MM", "S 44 12 20 W 16 45 27");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "C SS MM DD", "S 44 20 12 W 16 27 45");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD C MM SS", "12 S 20 44 45 W 27 16");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD C SS MM", "12 S 44 20 45 W 16 27");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "MM C DD SS", "20 S 12 44 27 W 45 16");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "MM C SS DD", "20 S 44 12 27 W 16 45");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "SS C DD MM", "44 S 12 20 16 W 45 27");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "SS C MM DD", "44 S 20 12 16 W 27 45");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD C MM SS", "12 S 20 44 45 W 27 16");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD C SS MM", "12 S 44 20 45 W 16 27");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "MM C DD SS", "20 S 12 44 27 W 45 16");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "MM C SS DD", "20 S 44 12 27 W 16 45");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "SS C DD MM", "44 S 12 20 16 W 45 27");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "SS C MM DD", "44 S 20 12 16 W 27 45");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD MM C SS", "12 20 S 44 45 27 W 16");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD SS C MM", "12 44 S 20 45 16 W 27");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "MM DD C SS", "20 12 S 44 27 45 W 16");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "MM SS C DD", "20 44 S 12 27 16 W 45");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "SS DD C MM", "44 12 S 20 16 45 W 27");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "SS MM C DD", "44 20 S 12 16 27 W 45");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD MM C SS", "12 20 S 44 45 27 W 16");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD SS C MM", "12 44 S 20 45 16 W 27");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "MM DD C SS", "20 12 S 44 27 45 W 16");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "MM SS C DD", "20 44 S 12 27 16 W 45");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "SS DD C MM", "44 12 S 20 16 45 W 27");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "SS MM C DD", "44 20 S 12 16 27 W 45");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD MM SS C", "12 20 44 S 45 27 16 W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD SS MM C", "12 44 20 S 45 16 27 W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "MM DD SS C", "20 12 44 S 27 45 16 W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "MM SS DD C", "20 44 12 S 27 16 45 W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "SS DD MM C", "44 12 20 S 16 45 27 W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "SS MM DD C", "44 20 12 S 16 27 45 W");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD MM SS C", "12 20 44 S 45 27 16 W");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD SS MM C", "12 44 20 S 45 16 27 W");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "MM DD SS C", "20 12 44 S 27 45 16 W");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "MM SS DD C", "20 44 12 S 27 16 45 W");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "SS DD MM C", "44 12 20 S 16 45 27 W");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "SS MM DD C", "44 20 12 S 16 27 45 W");
}
/*
* Test with and without the optional parameters.
*/
static void test_lwprint_optional_format(void)
static void
test_lwpoint_to_latlon_optional_format(void)
{
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD", "-12.346 -45.455");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD C", "12.346 S 45.455 W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD MM.MMM", "-12.000 20.740 -45.000 27.270");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD MM.MMM C", "12.000 20.740 S 45.000 27.270 W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD MM.MMM SS.SSS", "-12.000 20.000 44.412 -45.000 27.000 16.200");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD MM.MMM SS.SSS C", "12.000 20.000 44.412 S 45.000 27.000 16.200 W");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD", "-12.346 -45.455");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD C", "12.346 S 45.455 W");
test_lwpoint_to_latlon_assert_format(
"POINT(-45.4545 -12.34567)", "DD.DDD MM.MMM", "-12.000 20.740 -45.000 27.270");
test_lwpoint_to_latlon_assert_format(
"POINT(-45.4545 -12.34567)", "DD.DDD MM.MMM C", "12.000 20.740 S 45.000 27.270 W");
test_lwpoint_to_latlon_assert_format(
"POINT(-45.4545 -12.34567)", "DD.DDD MM.MMM SS.SSS", "-12.000 20.000 44.412 -45.000 27.000 16.200");
test_lwpoint_to_latlon_assert_format(
"POINT(-45.4545 -12.34567)", "DD.DDD MM.MMM SS.SSS C", "12.000 20.000 44.412 S 45.000 27.000 16.200 W");
}
static void test_lwprint_oddball_formats(void)
static void
test_lwpoint_to_latlon_oddball_formats(void)
{
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDDMM.MMMSS.SSSC", "12.00020.00044.412S 45.00027.00016.200W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DDMM.MMM", "-1220.740 -4527.270");
test_lwpoint_to_latlon_assert_format(
"POINT(-45.4545 -12.34567)", "DD.DDDMM.MMMSS.SSSC", "12.00020.00044.412S 45.00027.00016.200W");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DDMM.MMM", "-1220.740 -4527.270");
/* "##." will be printed as "##" */
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.MM.MMM", "-1220.740 -4527.270");
test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD.MM.MMM", "-1220.740 -4527.270");
}
/*
* Test using formats that should produce errors.
*/
static void test_lwprint_bad_formats(void)
static void
test_lwpoint_to_latlon_bad_formats(void)
{
test_lwprint_assert_error("POINT(1.23456 7.89012)", "DD.DDD SS.SSS");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "MM.MMM SS.SSS");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "DD.DDD SS.SSS DD");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "DD MM SS MM");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "DD MM SS SS");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "C DD.DDD C");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "C \xC2""DD.DDD");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "C DD.DDD \xC2");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "C DD\x80""MM ");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "C DD \xFF""MM");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "C DD \xB0""MM");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "DD.DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "DD.DDD jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)", "DD.DDD SS.SSS");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)", "MM.MMM SS.SSS");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)", "DD.DDD SS.SSS DD");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)", "DD MM SS MM");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)", "DD MM SS SS");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)", "C DD.DDD C");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)",
"C \xC2"
"DD.DDD");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)", "C DD.DDD \xC2");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)",
"C DD\x80"
"MM ");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)",
"C DD \xFF"
"MM");
test_lwpoint_to_latlon_assert_error("POINT(1.23456 7.89012)",
"C DD \xB0"
"MM");
test_lwpoint_to_latlon_assert_error(
"POINT(1.23456 7.89012)",
"DD.DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
test_lwpoint_to_latlon_assert_error(
"POINT(1.23456 7.89012)",
"DD.DDD jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
}
char result[OUT_DOUBLE_BUFFER_SIZE] = {0};
#define assert_lwprint_equal(d, precision, expected) \
lwprint_double((d), (precision), result); \
ASSERT_STRING_EQUAL(result, (expected));
static void
test_lwprint(void)
{
static const int precision_start = -1; /* Check for negatives */
static const int precision_end = OUT_MAX_DIGITS + 2; /* Ask for more digits than available in all cases */
/* Negative zero should be printed as 0 */
for (int i = precision_start; i < precision_end; i++)
assert_lwprint_equal(-0, i, "0");
/* 2 = 0x4000000000000000
* -2 = 0xC000000000000000
* Both with exact representation, so we should never see extra digits
*/
for (int i = precision_start; i < precision_end; i++)
{
assert_lwprint_equal(2.0, i, "2");
assert_lwprint_equal(-2.0, i, "-2");
}
/* 0.3 doesn't have an exact representation but it's the shortest representation for 0x3FD3333333333333
* 2.99999999999999988897769753748E-1 = 0x3FD3333333333333
*/
assert_lwprint_equal(0.3, 0, "0");
for (int i = 1; i < precision_end; i++)
{
assert_lwprint_equal(0.3, i, "0.3");
assert_lwprint_equal(2.99999999999999988897769753748E-1, i, "0.3");
}
/* 2.5 has an exact representation (0x4004000000000000) */
assert_lwprint_equal(2.5, 0, "2");
for (int i = 1; i < precision_end; i++)
{
assert_lwprint_equal(2.5, i, "2.5");
}
/* Test trailing zeros and rounding
* 0.0000000298023223876953125 == 0x3E60000000000000 == 2.98023223876953125E-8
*/
assert_lwprint_equal(0.0000000298023223876953125, -1, "0");
assert_lwprint_equal(0.0000000298023223876953125, 0, "0");
assert_lwprint_equal(0.0000000298023223876953125, 1, "0");
assert_lwprint_equal(0.0000000298023223876953125, 2, "0");
assert_lwprint_equal(0.0000000298023223876953125, 3, "0");
assert_lwprint_equal(0.0000000298023223876953125, 4, "0");
assert_lwprint_equal(0.0000000298023223876953125, 5, "0");
assert_lwprint_equal(0.0000000298023223876953125, 6, "0");
assert_lwprint_equal(0.0000000298023223876953125, 7, "0");
assert_lwprint_equal(0.0000000298023223876953125, 8, "0.00000003");
assert_lwprint_equal(0.0000000298023223876953125, 9, "0.00000003");
assert_lwprint_equal(0.0000000298023223876953125, 10, "0.0000000298");
assert_lwprint_equal(0.0000000298023223876953125, 11, "0.0000000298");
assert_lwprint_equal(0.0000000298023223876953125, 12, "0.000000029802");
assert_lwprint_equal(0.0000000298023223876953125, 13, "0.0000000298023");
assert_lwprint_equal(0.0000000298023223876953125, 14, "0.00000002980232");
assert_lwprint_equal(0.0000000298023223876953125, 15, "0.000000029802322");
assert_lwprint_equal(0.0000000298023223876953125, 16, "0.0000000298023224");
assert_lwprint_equal(0.0000000298023223876953125, 17, "0.00000002980232239");
assert_lwprint_equal(0.0000000298023223876953125, 18, "0.000000029802322388");
assert_lwprint_equal(0.0000000298023223876953125, 19, "0.0000000298023223877");
assert_lwprint_equal(0.0000000298023223876953125, 20, "0.0000000298023223877");
assert_lwprint_equal(0.0000000298023223876953125, 21, "0.000000029802322387695");
assert_lwprint_equal(0.0000000298023223876953125, 22, "0.0000000298023223876953");
assert_lwprint_equal(0.0000000298023223876953125, 23, "0.00000002980232238769531");
assert_lwprint_equal(0.0000000298023223876953125, 24, "0.000000029802322387695312");
assert_lwprint_equal(0.0000000298023223876953125, 40, "0.000000029802322387695312");
/* Negative 0 after rounding should be printed as 0 */
assert_lwprint_equal(-0.0005, 0, "0");
assert_lwprint_equal(-0.0005, 1, "0");
assert_lwprint_equal(-0.0005, 2, "0");
assert_lwprint_equal(-0.0005, 3, "0");
assert_lwprint_equal(-0.0005, 4, "-0.0005");
/* Rounding on the first decimal digit */
assert_lwprint_equal(-2.5, 0, "-2");
assert_lwprint_equal(-1.5, 0, "-2");
assert_lwprint_equal(-0.99, 0, "-1");
assert_lwprint_equal(-0.5, 0, "0");
assert_lwprint_equal(-0.01, 0, "0");
assert_lwprint_equal(0.5, 0, "0");
assert_lwprint_equal(0.99, 0, "1");
assert_lwprint_equal(1.5, 0, "2");
assert_lwprint_equal(2.5, 0, "2");
/* Check rounding */
assert_lwprint_equal(0.035, 2, "0.04");
assert_lwprint_equal(0.045, 2, "0.04");
assert_lwprint_equal(0.04500000000000001, 2, "0.05");
assert_lwprint_equal(0.077, 2, "0.08");
assert_lwprint_equal(0.087, 2, "0.09");
assert_lwprint_equal(1.05, 1, "1");
assert_lwprint_equal(1.005, 2, "1");
assert_lwprint_equal(2.05, 1, "2");
assert_lwprint_equal(2.005, 2, "2");
for (int i = 0; i < 15; i++)
assert_lwprint_equal(-0.99999999999999988898, i, "-1");
for (int i = 15; i < 20; i++)
assert_lwprint_equal(-0.99999999999999988898, i, "-0.9999999999999999");
for (int i = 0; i < 16; i++)
assert_lwprint_equal(0.99999999999999977796, i, "1");
for (int i = 16; i < 20; i++)
assert_lwprint_equal(0.99999999999999977796, i, "0.9999999999999998");
assert_lwprint_equal(0.0999999999999999916733273153113, 0, "0");
assert_lwprint_equal(-0.0999999999999999916733273153113, 0, "0");
for (int i = 1; i < 15; i++)
{
assert_lwprint_equal(0.0999999999999999916733273153113, i, "0.1");
assert_lwprint_equal(-0.0999999999999999916733273153113, i, "-0.1");
}
assert_lwprint_equal(0.00999999999999999847, 0, "0");
assert_lwprint_equal(-0.00999999999999999847, 0, "0");
assert_lwprint_equal(0.00999999999999999847, 1, "0");
assert_lwprint_equal(-0.00999999999999999847, 1, "0");
for (int i = 2; i < 15; i++)
{
assert_lwprint_equal(0.00999999999999999847, i, "0.01");
assert_lwprint_equal(-0.00999999999999999847, i, "-0.01");
}
/* Test regression changes (output that changed in the tests vs 3.0) */
/* There is at most 17 significative digits */
assert_lwprint_equal(-123456789012345.12345678, 20, "-123456789012345.12");
assert_lwprint_equal(123456789012345.12345678, 20, "123456789012345.12");
/* Precision is respected (as number of decimal digits) */
assert_lwprint_equal(92115.51207431706, 12, "92115.51207431706");
assert_lwprint_equal(463412.82600000006, 12, "463412.82600000006");
assert_lwprint_equal(463462.2069374289, 12, "463462.2069374289");
assert_lwprint_equal(-115.17281600000001, OUT_DEFAULT_DECIMAL_DIGITS, "-115.17281600000001");
assert_lwprint_equal(-115.17281600000001, 12, "-115.172816");
assert_lwprint_equal(36.11464599999999, OUT_DEFAULT_DECIMAL_DIGITS, "36.11464599999999");
assert_lwprint_equal(36.11464599999999, 12, "36.114646");
assert_lwprint_equal(400000, 0, "400000");
assert_lwprint_equal(400000, 12, "400000");
assert_lwprint_equal(400000, 20, "400000");
assert_lwprint_equal(5.0833333333333330372738600999582558870316, 15, "5.083333333333333");
assert_lwprint_equal(1.4142135623730951, 15, "1.414213562373095");
assert_lwprint_equal(143.62025166838282, 15, "143.62025166838282");
assert_lwprint_equal(-30.037497356076827, 15, "-30.037497356076827");
assert_lwprint_equal(142.92857147299705, 15, "142.92857147299705");
assert_lwprint_equal(-32.75101196874403, 15, "-32.75101196874403");
/* Note about this:
* 149.57565307617187 == 0x4062B26BC0000000
* 149.57565307617188 == 0x4062B26BC0000000
*
* 0x4062B26BC0000000 == 149.575653076171875
* Both if we consider "round to nearest, ties to even" (which is what we use)
* or "round to nearest, ties away from zero":
* 75 => 80 => 8 for the last digit
*
* It acts the same way in PostgreSQL:
# Select '149.57565307617187'::float8, '149.575653076171875'::float8, '149.57565307617188'::float8;
float8 | float8 | float8
--------------------+--------------------+--------------------
149.57565307617188 | 149.57565307617188 | 149.57565307617188
(1 row)
*/
assert_lwprint_equal(149.57565307617187, 15, "149.57565307617188");
assert_lwprint_equal(-149.57565307617187, 15, "-149.57565307617188");
/* Shortest representation is used */
assert_lwprint_equal(7000109.9999999990686774253845214843750000000000, 8, "7000110");
assert_lwprint_equal(7000109.9999999990686774253845214843750000000000, 12, "7000109.999999999");
/* SnapToGrid by itself is not enough to limit output decimals */
const double d = 526355.92112222222;
const double gridsize = 0.00001;
const double gridded = rint(d / gridsize) * gridsize; /* Formula from ptarray_grid_in_place */
assert_lwprint_equal(gridded, 15, "526355.9211200001");
assert_lwprint_equal(gridded, 5, "526355.92112");
/* Test the change towards scientific notation */
assert_lwprint_equal(nextafter(OUT_MAX_DOUBLE, 0), OUT_MAX_DIGITS, "999999999999999.9");
assert_lwprint_equal(nextafter(-OUT_MAX_DOUBLE, 0), OUT_MAX_DIGITS, "-999999999999999.9");
assert_lwprint_equal(OUT_MAX_DOUBLE, OUT_MAX_DIGITS, "1e+15");
assert_lwprint_equal(-OUT_MAX_DOUBLE, OUT_MAX_DIGITS, "-1e+15");
assert_lwprint_equal(nextafter(OUT_MAX_DOUBLE, INFINITY), OUT_MAX_DIGITS, "1.0000000000000001e+15");
assert_lwprint_equal(nextafter(-OUT_MAX_DOUBLE, -INFINITY), OUT_MAX_DIGITS, "-1.0000000000000001e+15");
assert_lwprint_equal(nextafter(OUT_MIN_DOUBLE, 0), OUT_MAX_DIGITS, "9.999999999999999e-9");
assert_lwprint_equal(nextafter(-OUT_MIN_DOUBLE, 0), OUT_MAX_DIGITS, "-9.999999999999999e-9");
assert_lwprint_equal(OUT_MIN_DOUBLE, OUT_MAX_DIGITS, "1e-8");
assert_lwprint_equal(-OUT_MIN_DOUBLE, OUT_MAX_DIGITS, "-1e-8");
assert_lwprint_equal(nextafter(OUT_MIN_DOUBLE, INFINITY), OUT_MAX_DIGITS, "0.000000010000000000000002");
assert_lwprint_equal(nextafter(-OUT_MIN_DOUBLE, -INFINITY), OUT_MAX_DIGITS, "-0.000000010000000000000002");
/* Big numbers that use scientific notation respect the precision parameter */
assert_lwprint_equal(9e+300, 0, "9e+300");
assert_lwprint_equal(9e+300, 15, "9e+300");
assert_lwprint_equal(-9e+300, 0, "-9e+300");
assert_lwprint_equal(-9e+300, 15, "-9e+300");
assert_lwprint_equal(9.000000000000001e+300, 0, "9e+300");
assert_lwprint_equal(9.000000000000001e+300, 15, "9.000000000000001e+300");
assert_lwprint_equal(-9.000000000000001e+300, 0, "-9e+300");
assert_lwprint_equal(-9.000000000000001e+300, 15, "-9.000000000000001e+300");
assert_lwprint_equal(6917529027641081856.0, 17, "6.917529027641082e+18");
assert_lwprint_equal(6917529027641081856.0, 16, "6.917529027641082e+18");
assert_lwprint_equal(6917529027641081856.0, 15, "6.917529027641082e+18");
assert_lwprint_equal(6917529027641081856.0, 14, "6.91752902764108e+18");
assert_lwprint_equal(6917529027641081856.0, 13, "6.9175290276411e+18");
assert_lwprint_equal(6917529027641081856.0, 12, "6.917529027641e+18");
assert_lwprint_equal(6917529027641081856.0, 11, "6.91752902764e+18");
assert_lwprint_equal(6917529027641081856.0, 10, "6.9175290276e+18");
assert_lwprint_equal(6917529027641081856.0, 9, "6.917529028e+18");
assert_lwprint_equal(6917529027641081856.0, 8, "6.91752903e+18");
assert_lwprint_equal(6917529027641081856.0, 7, "6.917529e+18");
assert_lwprint_equal(6917529027641081856.0, 6, "6.917529e+18");
assert_lwprint_equal(6917529027641081856.0, 5, "6.91753e+18");
assert_lwprint_equal(6917529027641081856.0, 4, "6.9175e+18");
assert_lwprint_equal(6917529027641081856.0, 3, "6.918e+18");
assert_lwprint_equal(6917529027641081856.0, 2, "6.92e+18");
assert_lwprint_equal(6917529027641081856.0, 1, "6.9e+18");
assert_lwprint_equal(6917529027641081856.0, 0, "7e+18");
/* Test special values (+-inf, NaNs) */
for (int i = precision_start; i < precision_end; i++)
{
assert_lwprint_equal(NAN, i, "NaN");
assert_lwprint_equal(INFINITY, i, "Infinity");
assert_lwprint_equal(-INFINITY, i, "-Infinity");
}
/* Extremes */
assert_lwprint_equal(2.2250738585072014e-308, OUT_MAX_DIGITS, "2.2250738585072014e-308");
assert_lwprint_equal(1.7976931348623157e+308, OUT_MAX_DIGITS, "1.7976931348623157e+308"); /* Max */
assert_lwprint_equal(2.9802322387695312E-8, OUT_MAX_DIGITS, "0.000000029802322387695312"); /* Trailing zeros */
}
/* Macro to test rountrip of lwprint_double when using enough precision digits (OUT_MAX_DIGITS) */
#define assert_lwprint_roundtrip(d) \
{ \
char s[OUT_DOUBLE_BUFFER_SIZE] = {0}; \
lwprint_double(d, OUT_MAX_DIGITS, s); \
ASSERT_DOUBLE_EQUAL(atof(s), d); \
}
static void
test_lwprint_roundtrip(void)
{
/* Test roundtrip with the first value outside the range that's always printed as zero */
assert_lwprint_roundtrip(nextafter(FP_TOLERANCE, 1));
assert_lwprint_roundtrip(nextafter(-FP_TOLERANCE, -1));
/* Test roundtrip in around the switch to scientific notation */
assert_lwprint_roundtrip(nextafter(OUT_MAX_DOUBLE, 0));
assert_lwprint_roundtrip(nextafter(-OUT_MAX_DOUBLE, 0));
assert_lwprint_roundtrip(OUT_MAX_DOUBLE);
assert_lwprint_roundtrip(OUT_MAX_DOUBLE);
assert_lwprint_roundtrip(nextafter(OUT_MAX_DOUBLE, INFINITY));
assert_lwprint_roundtrip(nextafter(-OUT_MAX_DOUBLE, -INFINITY));
/* Test some numbers */
assert_lwprint_roundtrip(0);
assert_lwprint_roundtrip(0.0000000298023223876953125);
assert_lwprint_roundtrip(0.3);
assert_lwprint_roundtrip(0.5);
assert_lwprint_roundtrip(7000109.9999999990686774253845214843750000000000);
assert_lwprint_roundtrip(6917529027641081856.0);
assert_lwprint_roundtrip(9e+300);
assert_lwprint_roundtrip(-9e+300);
assert_lwprint_roundtrip(9.000000000000001e+300);
assert_lwprint_roundtrip(-9.000000000000001e+300);
/* Even if we write the **same** number differently as the (compiler) input the roundtrip is guaranteed */
assert_lwprint_roundtrip(149.57565307617187);
assert_lwprint_roundtrip(149.57565307617188);
assert_lwprint_roundtrip(-149.57565307617187);
assert_lwprint_roundtrip(-149.57565307617188);
/* Extremes */
assert_lwprint_roundtrip(2.2250738585072014e-308); /* We normalize small numbers to 0 */
assert_lwprint_roundtrip(1.7976931348623157e+308);
assert_lwprint_roundtrip(2.9802322387695312E-8);
/* Special cases */
assert_lwprint_roundtrip(-0); /* -0 is considered equal to 0 */
assert_lwprint_roundtrip(INFINITY);
assert_lwprint_roundtrip(-INFINITY);
/* nan is never equal to nan
* assert_lwprint_roundtrip(NAN);
*/
}
/*
@ -166,10 +564,12 @@ void print_suite_setup(void);
void print_suite_setup(void)
{
CU_pSuite suite = CU_add_suite("printing", NULL, NULL);
PG_ADD_TEST(suite, test_lwprint_default_format);
PG_ADD_TEST(suite, test_lwprint_format_orders);
PG_ADD_TEST(suite, test_lwprint_optional_format);
PG_ADD_TEST(suite, test_lwprint_oddball_formats);
PG_ADD_TEST(suite, test_lwprint_bad_formats);
PG_ADD_TEST(suite, test_lwpoint_to_latlon_default_format);
PG_ADD_TEST(suite, test_lwpoint_to_latlon_format_orders);
PG_ADD_TEST(suite, test_lwpoint_to_latlon_optional_format);
PG_ADD_TEST(suite, test_lwpoint_to_latlon_oddball_formats);
PG_ADD_TEST(suite, test_lwpoint_to_latlon_bad_formats);
PG_ADD_TEST(suite, test_lwprint);
PG_ADD_TEST(suite, test_lwprint_roundtrip);
}

View file

@ -132,19 +132,19 @@
* Export functions
*/
/* Any number higher than this will always be printed in scientific notation */
/* Any (absolute) values outside this range will be printed in scientific notation */
#define OUT_MIN_DOUBLE 1E-8
#define OUT_MAX_DOUBLE 1E15
#define OUT_DEFAULT_DECIMAL_DIGITS 15
/* Limit for the max amount of decimal digits to show, e.g: 0.123456789012345 has 15 */
#define OUT_MAX_DOUBLE_PRECISION 15
/* Limits for the max amount of digits to show, e.g: 1234567890.12345678 has 18 digits */
/* This used to be 20 but it never worked as announced and OUT_MAX_DOUBLE_PRECISION was used instead */
#define OUT_SHOW_DIGS_DOUBLE 15
/* 17 digits are sufficient for round-tripping
* Then we might add up to 8 (from OUT_MIN_DOUBLE) max leading zeroes (or 2 digits for "e+") */
#define OUT_MAX_DIGITS 17 + 8
/* Limit for the max amount of characters that a double can use, including dot and sign */
#define OUT_MAX_DIGS_DOUBLE (OUT_SHOW_DIGS_DOUBLE + 2) /* +2 mean add dot and sign */
#define OUT_DOUBLE_BUFFER_SIZE OUT_MAX_DIGS_DOUBLE + 1 /* +1 including NULL */
/* */
#define OUT_MAX_BYTES_DOUBLE (1 /* Sign */ + 2 /* 0.x */ + OUT_MAX_DIGITS)
#define OUT_DOUBLE_BUFFER_SIZE OUT_MAX_BYTES_DOUBLE + 1 /* +1 including NULL */
/**
* Constants for point-in-polygon return values
@ -451,7 +451,7 @@ double gbox_angular_width(const GBOX* gbox);
int gbox_centroid(const GBOX* gbox, POINT2D* out);
/* Utilities */
int lwprint_double(double d, uint32_t maxdd, char *buf, size_t bufsize);
int lwprint_double(double d, int maxdd, char *buf);
extern uint8_t MULTITYPE[NUMTYPES];
extern lwinterrupt_callback *_lwgeom_interrupt_callback;

View file

@ -52,8 +52,6 @@ lwgeom_to_geojson(const LWGEOM *geom, const char *srs, int precision, int has_bb
GBOX *bbox = NULL;
GBOX tmp;
if ( precision > OUT_MAX_DOUBLE_PRECISION ) precision = OUT_MAX_DOUBLE_PRECISION;
if (has_bbox)
{
/* Whether these are geography or geometry,
@ -131,12 +129,12 @@ asgeojson_bbox_size(int hasz, int precision)
if (!hasz)
{
size = sizeof("\"bbox\":[,,,],");
size += 2 * 2 * (OUT_MAX_DIGS_DOUBLE + precision);
size += 2 * 2 * (OUT_MAX_BYTES_DOUBLE + precision);
}
else
{
size = sizeof("\"bbox\":[,,,,,],");
size += 2 * 3 * (OUT_MAX_DIGS_DOUBLE + precision);
size += 2 * 3 * (OUT_MAX_BYTES_DOUBLE + precision);
}
return size;
@ -701,8 +699,6 @@ pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
{
char *ptr = output;
assert ( precision <= OUT_MAX_DOUBLE_PRECISION );
if (!FLAGS_GET_Z(pa->flags))
{
for (uint32_t i = 0; i < pa->npoints; i++)
@ -716,10 +712,10 @@ pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
*ptr = '[';
ptr++;
ptr += lwprint_double(pt->x, precision, ptr, OUT_DOUBLE_BUFFER_SIZE);
ptr += lwprint_double(pt->x, precision, ptr);
*ptr = ',';
ptr++;
ptr += lwprint_double(pt->y, precision, ptr, OUT_DOUBLE_BUFFER_SIZE);
ptr += lwprint_double(pt->y, precision, ptr);
*ptr = ']';
ptr++;
}
@ -737,13 +733,13 @@ pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
const POINT3D *pt = getPoint3d_cp(pa, i);
*ptr = '[';
ptr++;
ptr += lwprint_double(pt->x, precision, ptr, OUT_DOUBLE_BUFFER_SIZE);
ptr += lwprint_double(pt->x, precision, ptr);
*ptr = ',';
ptr++;
ptr += lwprint_double(pt->y, precision, ptr, OUT_DOUBLE_BUFFER_SIZE);
ptr += lwprint_double(pt->y, precision, ptr);
*ptr = ',';
ptr++;
ptr += lwprint_double(pt->z, precision, ptr, OUT_DOUBLE_BUFFER_SIZE);
ptr += lwprint_double(pt->z, precision, ptr);
*ptr = ']';
ptr++;
}
@ -759,11 +755,8 @@ pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
static size_t
pointArray_geojson_size(POINTARRAY *pa, int precision)
{
assert ( precision <= OUT_MAX_DOUBLE_PRECISION );
if (FLAGS_NDIMS(pa->flags) == 2)
return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(","))
* 2 * pa->npoints + sizeof(",[]");
return (OUT_MAX_BYTES_DOUBLE + precision + sizeof(",")) * 2 * pa->npoints + sizeof(",[]");
return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(",,"))
* 3 * pa->npoints + sizeof(",[]");
return (OUT_MAX_BYTES_DOUBLE + precision + sizeof(",,")) * 3 * pa->npoints + sizeof(",[]");
}

View file

@ -692,10 +692,8 @@ pointArray_toGML2(POINTARRAY *pa, char *output, int precision)
const POINT2D *pt;
pt = getPoint2d_cp(pa, i);
lwprint_double(
pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(
pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(pt->x, precision, x);
lwprint_double(pt->y, precision, y);
if ( i ) ptr += sprintf(ptr, " ");
ptr += sprintf(ptr, "%s,%s", x, y);
@ -706,12 +704,9 @@ pointArray_toGML2(POINTARRAY *pa, char *output, int precision)
for (i=0; i<pa->npoints; i++)
{
const POINT3D *pt = getPoint3d_cp(pa, i);
lwprint_double(
pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(
pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(
pt->z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(pt->x, precision, x);
lwprint_double(pt->y, precision, y);
lwprint_double(pt->z, precision, z);
if ( i ) ptr += sprintf(ptr, " ");
ptr += sprintf(ptr, "%s,%s,%s", x, y, z);
@ -1915,10 +1910,8 @@ pointArray_toGML3(POINTARRAY *pa, char *output, int precision, int opts)
{
const POINT2D *pt;
pt = getPoint2d_cp(pa, i);
lwprint_double(
pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(
pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(pt->x, precision, x);
lwprint_double(pt->y, precision, y);
if ( i ) ptr += sprintf(ptr, " ");
if (IS_DEGREE(opts))
@ -1933,12 +1926,9 @@ pointArray_toGML3(POINTARRAY *pa, char *output, int precision, int opts)
{
const POINT3D *pt = getPoint3d_cp(pa, i);
lwprint_double(
pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(
pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(
pt->z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(pt->x, precision, x);
lwprint_double(pt->y, precision, y);
lwprint_double(pt->z, precision, z);
if ( i ) ptr += sprintf(ptr, " ");
if (IS_DEGREE(opts))
@ -1960,7 +1950,7 @@ static size_t
pointArray_GMLsize(POINTARRAY *pa, int precision)
{
if (FLAGS_NDIMS(pa->flags) == 2)
return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(", ")) * 2 * pa->npoints;
return (OUT_MAX_BYTES_DOUBLE + precision + sizeof(", ")) * 2 * pa->npoints;
return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(", ")) * 3 * pa->npoints;
return (OUT_MAX_BYTES_DOUBLE + precision + sizeof(", ")) * 3 * pa->npoints;
}

View file

@ -110,15 +110,9 @@ ptarray_to_kml2_sb(const POINTARRAY *pa, int precision, stringbuffer_t *sb)
for (j = 0; j < dims; j++)
{
if ( j ) stringbuffer_append_len(sb,",",1);
if( fabs(d[j]) < OUT_MAX_DOUBLE )
{
if ( stringbuffer_aprintf(sb, "%.*f", precision, d[j]) < 0 ) return LW_FAILURE;
}
else
{
if ( stringbuffer_aprintf(sb, "%g", d[j]) < 0 ) return LW_FAILURE;
}
stringbuffer_trim_trailing_zeroes(sb);
char coord[OUT_DOUBLE_BUFFER_SIZE];
int len = lwprint_double(d[j], precision, coord);
stringbuffer_append_len(sb, coord, len);
}
}
return LW_SUCCESS;

View file

@ -108,7 +108,7 @@ assvg_point_size(__attribute__((__unused__)) const LWPOINT *point, int circle, i
{
size_t size;
size = (OUT_MAX_DIGS_DOUBLE + precision) * 2;
size = (OUT_MAX_BYTES_DOUBLE + precision) * 2;
if (circle) size += sizeof("cx='' cy=''");
else size += sizeof("x='' y=''");
@ -125,8 +125,8 @@ assvg_point_buf(const LWPOINT *point, char * output, int circle, int precision)
getPoint2d_p(point->point, 0, &pt);
lwprint_double(pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(-pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(pt.x, precision, x);
lwprint_double(-pt.y, precision, y);
if (circle) ptr += sprintf(ptr, "x=\"%s\" y=\"%s\"", x, y);
else ptr += sprintf(ptr, "cx=\"%s\" cy=\"%s\"", x, y);
@ -553,8 +553,8 @@ pointArray_svg_rel(POINTARRAY *pa, char *output, int close_ring, int precision)
x = round(pt->x*f)/f;
y = round(pt->y*f)/f;
lwprint_double(x, precision, sx, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(-y, precision, sy, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(x, precision, sx);
lwprint_double(-y, precision, sy);
ptr += sprintf(ptr,"%s %s l", sx, sy);
/* accum */
@ -573,8 +573,8 @@ pointArray_svg_rel(POINTARRAY *pa, char *output, int close_ring, int precision)
dx = x - accum_x;
dy = y - accum_y;
lwprint_double(dx, precision, sx, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(-dy, precision, sy, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(dx, precision, sx);
lwprint_double(-dy, precision, sy);
accum_x += dx;
accum_y += dy;
@ -607,8 +607,8 @@ pointArray_svg_abs(POINTARRAY *pa, char *output, int close_ring, int precision)
{
getPoint2d_p(pa, i, &pt);
lwprint_double(pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(-pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(pt.x, precision, x);
lwprint_double(-pt.y, precision, y);
if (i == 1) ptr += sprintf(ptr, " L ");
else if (i) ptr += sprintf(ptr, " ");
@ -625,6 +625,5 @@ pointArray_svg_abs(POINTARRAY *pa, char *output, int close_ring, int precision)
static size_t
pointArray_svg_size(POINTARRAY *pa, int precision)
{
return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(" "))
* 2 * pa->npoints + sizeof(" L ");
return (OUT_MAX_BYTES_DOUBLE + precision + sizeof(" ")) * 2 * pa->npoints + sizeof(" L ");
}

View file

@ -86,7 +86,7 @@ static void ptarray_to_wkt_sb(const POINTARRAY *ptarray, stringbuffer_t *sb, int
/* OGC only includes X/Y */
uint32_t dimensions = 2;
uint32_t i, j;
char coord[buffer_size];
char coord[OUT_DOUBLE_BUFFER_SIZE];
/* ISO and extended formats include all dimensions */
if ( variant & ( WKT_ISO | WKT_EXTENDED ) )
@ -110,7 +110,7 @@ static void ptarray_to_wkt_sb(const POINTARRAY *ptarray, stringbuffer_t *sb, int
/* Spaces before every ordinate but the first */
if ( j > 0 )
stringbuffer_append_len(sb, " ", 1);
int len = lwprint_double(dbl_ptr[j], precision, coord, buffer_size);
int len = lwprint_double(dbl_ptr[j], precision, coord);
stringbuffer_append_len(sb, coord, len);
}
}

View file

@ -525,10 +525,8 @@ ptarray_to_x3d3_sb(POINTARRAY *pa, int precision, int opts, int is_closed, strin
POINT2D pt;
getPoint2d_p(pa, i, &pt);
lwprint_double(
pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(
pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(pt.x, precision, x);
lwprint_double(pt.y, precision, y);
if ( i ) stringbuffer_append_len(sb," ",1);
@ -549,12 +547,9 @@ ptarray_to_x3d3_sb(POINTARRAY *pa, int precision, int opts, int is_closed, strin
POINT4D pt;
getPoint4d_p(pa, i, &pt);
lwprint_double(
pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(
pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(
pt.z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
lwprint_double(pt.x, precision, x);
lwprint_double(pt.y, precision, y);
lwprint_double(pt.z, precision, z);
if ( i ) stringbuffer_append_len(sb," ",1);

View file

@ -441,89 +441,32 @@ char* lwpoint_to_latlon(const LWPOINT * pt, const char *format)
return lwdoubles_to_latlon(p->y, p->x, format);
}
/**
* Returns the decimal length of a double. 0 for special cases (inf)
*/
static inline uint32_t
lwdecimal_length(const double d)
{
assert(d >= 0.0);
if (d > OUT_MAX_DOUBLE)
{
if (isinf(d))
return 0;
return floor(log10(d)) + 1;
}
int64_t v = (int64_t) d;
/* For compatibility with the previous implementation, we assume 0 has 0 digits,
* although that's clearly not the case */
if (v == 0) { return 0; }
if (v < 10) { return 1; }
if (v < 100) { return 2; }
if (v < 1000) { return 3; }
if (v < 10000) { return 4; }
if (v < 100000) { return 5; }
if (v < 1000000) { return 6; }
if (v < 10000000) { return 7; }
if (v < 100000000) { return 8; }
if (v < 1000000000) { return 9; }
if (v < 10000000000) { return 10; }
if (v < 100000000000) { return 11; }
if (v < 1000000000000) { return 12; }
if (v < 10000000000000) { return 13; }
if (v < 100000000000000) { return 14; }
return 15;
}
/*
* Print an ordinate value using at most **maxdd** number of decimal digits
*
* The actual number of printed decimal digits may be less than the
* requested ones if out of significant digits.
*
* The function will not write more than bufsize bytes, including the
* terminating NULL. Returns the number of bytes that would have been
* written if there was enough space (excluding terminating NULL).
* So a return of ``bufsize'' or more means that the string was
* truncated and misses a terminating NULL.
* The function will write at most OUT_DOUBLE_BUFFER_SIZE bytes, including the
* terminating NULL.
* It returns the number of bytes written (exluding the final NULL)
*
*/
int
lwprint_double(double d, uint32_t maxdd, char *buf, size_t bufsize)
lwprint_double(double d, int maxdd, char *buf)
{
assert(bufsize >= OUT_DOUBLE_BUFFER_SIZE);
int length;
double ad = fabs(d);
if (ad <= FP_TOLERANCE)
{
buf[0] = '0';
buf[1] = '\0';
return 1;
}
int precision = FP_MAX(0, maxdd);
if (ad >= OUT_MAX_DOUBLE)
if (ad <= OUT_MIN_DOUBLE || ad >= OUT_MAX_DOUBLE)
{
/* Compat with previous releases: The precision for exponential notation
* was, as far as I can see, 8 - length(exponent) */
const uint32_t fractional_digits = 8 - lwdecimal_length(lwdecimal_length(ad));
length = d2exp_buffered_n(d, fractional_digits, buf);
length = d2sexp_buffered_n(d, precision, buf);
}
else
{
/* We always need to save 1 last characters to add NULL */
const uint32_t max_chars = FP_MIN(OUT_DOUBLE_BUFFER_SIZE, bufsize) - 1;
const uint32_t integer_digits = lwdecimal_length(ad);
/* Although we could use this extra digit to show an extra decimal in positive
* numbers, we don't use it and save it instead */
static const uint32_t sign_digits = 1;
const uint32_t fractional_digits =
FP_MIN(maxdd, max_chars - integer_digits - sign_digits - 1 /* '.' */);
length = d2fixed_buffered_n(d, fractional_digits, buf);
length = d2sfixed_buffered_n(d, precision, buf);
}
buf[length] = '\0';
return length;
}
}

View file

@ -39,6 +39,7 @@
#include "catalog/pg_type.h" /* for CSTRINGOID, INT4OID */
#include "liblwgeom.h" /* For standard geometry types. */
#include "liblwgeom_internal.h"
#include "lwgeom_cache.h"
#include "lwgeom_pg.h" /* For debugging macros. */
#include "geography.h" /* For utility functions. */
@ -208,7 +209,7 @@ Datum geography_as_gml(PG_FUNCTION_ARGS)
int version;
const char *srs;
int32_t srid = SRID_DEFAULT;
int precision = DBL_DIG;
int precision = -1;
int option = 0;
int lwopts = LW_GML_IS_DIMS;
static const char *default_prefix = "gml:";
@ -251,12 +252,6 @@ Datum geography_as_gml(PG_FUNCTION_ARGS)
/* Convert to lwgeom so we can run the old functions */
lwgeom = lwgeom_from_gserialized(g);
/* Condition the precision argument */
if (precision > DBL_DIG)
precision = DBL_DIG;
if (precision < 0)
precision = 0;
/* Condition the prefix argument */
if (VARSIZE_ANY_EXHDR(prefix_text) > 0)
{
@ -341,8 +336,6 @@ Datum geography_as_kml(PG_FUNCTION_ARGS)
LWGEOM *lwgeom = lwgeom_from_gserialized(g);
/* Condition the precision */
if (precision > DBL_DIG)
precision = DBL_DIG;
if (precision < 0)
precision = 0;
@ -380,9 +373,7 @@ Datum geography_as_svg(PG_FUNCTION_ARGS)
int precision = PG_GETARG_INT32(2);
LWGEOM *lwgeom = lwgeom_from_gserialized(g);
if (precision > DBL_DIG)
precision = DBL_DIG;
else if (precision < 0)
if (precision < 0)
precision = 0;
PG_RETURN_TEXT_P(lwgeom_to_svg(lwgeom, precision, relative));
@ -403,8 +394,6 @@ Datum geography_as_geojson(PG_FUNCTION_ARGS)
int option = PG_GETARG_INT32(2);
LWGEOM *lwgeom = lwgeom_from_gserialized(g);
if (precision > DBL_DIG)
precision = DBL_DIG;
if (precision < 0)
precision = 0;

View file

@ -28,8 +28,6 @@
* Commons functions for all export functions
*/
#include "float.h" /* for DBL_DIG */
#include "postgres.h"
#include "catalog/pg_type.h" /* for INT4OID */
#include "executor/spi.h"
@ -40,6 +38,7 @@
#include "lwgeom_cache.h"
#include "lwgeom_pg.h"
#include "liblwgeom.h"
#include "liblwgeom_internal.h"
Datum LWGEOM_asGML(PG_FUNCTION_ARGS);
Datum LWGEOM_asGeoJson(PG_FUNCTION_ARGS);
@ -64,7 +63,7 @@ Datum LWGEOM_asGML(PG_FUNCTION_ARGS)
int32_t srid;
int option = 0;
int lwopts = LW_GML_IS_DIMS;
int precision = DBL_DIG;
int precision = OUT_DEFAULT_DECIMAL_DIGITS;
static const char* default_prefix = "gml:"; /* default prefix */
const char* prefix = default_prefix;
const char* gml_id = NULL;
@ -104,11 +103,6 @@ Datum LWGEOM_asGML(PG_FUNCTION_ARGS)
if (PG_NARGS() > argnum && !PG_ARGISNULL(argnum))
{
precision = PG_GETARG_INT32(argnum);
/* TODO: leave this to liblwgeom ? */
if (precision > DBL_DIG)
precision = DBL_DIG;
else if (precision < 0)
precision = 0;
}
argnum++;
@ -207,7 +201,7 @@ Datum LWGEOM_asGeoJson(PG_FUNCTION_ARGS)
{
GSERIALIZED *geom;
LWGEOM *lwgeom;
int precision = DBL_DIG;
int precision = OUT_DEFAULT_DECIMAL_DIGITS;
int output_bbox = LW_FALSE;
int output_long_crs = LW_FALSE;
int output_short_crs = LW_FALSE;
@ -226,10 +220,6 @@ Datum LWGEOM_asGeoJson(PG_FUNCTION_ARGS)
if ( PG_NARGS() > 1 && !PG_ARGISNULL(1) )
{
precision = PG_GETARG_INT32(1);
if ( precision > DBL_DIG )
precision = DBL_DIG;
else if ( precision < 0 )
precision = 0;
}
/* Retrieve output option
@ -303,7 +293,7 @@ Datum LWGEOM_asSVG(PG_FUNCTION_ARGS)
GSERIALIZED *geom;
LWGEOM *lwgeom;
int relative = 0;
int precision=DBL_DIG;
int precision = OUT_DEFAULT_DECIMAL_DIGITS;
if ( PG_ARGISNULL(0) ) PG_RETURN_NULL();
@ -316,10 +306,6 @@ Datum LWGEOM_asSVG(PG_FUNCTION_ARGS)
if ( PG_NARGS() > 2 && ! PG_ARGISNULL(2) )
{
precision = PG_GETARG_INT32(2);
/* TODO: leave this to liblwgeom ? */
if ( precision > DBL_DIG )
precision = DBL_DIG;
else if ( precision < 0 ) precision = 0;
}
lwgeom = lwgeom_from_gserialized(geom);
@ -336,7 +322,7 @@ Datum LWGEOM_asX3D(PG_FUNCTION_ARGS)
LWGEOM *lwgeom;
int version;
int option = 0;
int precision = DBL_DIG;
int precision = OUT_DEFAULT_DECIMAL_DIGITS;
static const char* default_defid = "x3d:"; /* default defid */
char *defidbuf;
const char* defid = default_defid;
@ -358,10 +344,6 @@ Datum LWGEOM_asX3D(PG_FUNCTION_ARGS)
if (PG_NARGS() >2 && !PG_ARGISNULL(2))
{
precision = PG_GETARG_INT32(2);
/* TODO: leave this to liblwgeom ? */
if ( precision > DBL_DIG )
precision = DBL_DIG;
else if ( precision < 0 ) precision = 0;
}
/* retrieve option */

View file

@ -32,6 +32,7 @@
#include "../postgis_config.h"
#include "liblwgeom.h"
#include "liblwgeom_internal.h"
#include "lwgeom_pg.h"
#include <math.h>
@ -2384,8 +2385,7 @@ Datum LWGEOM_asEWKT(PG_FUNCTION_ARGS)
LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
POSTGIS_DEBUG(2, "LWGEOM_asEWKT called.");
PG_RETURN_TEXT_P(lwgeom_to_wkt_varlena(lwgeom, WKT_EXTENDED, DBL_DIG));
PG_RETURN_TEXT_P(lwgeom_to_wkt_varlena(lwgeom, WKT_EXTENDED, OUT_DEFAULT_DECIMAL_DIGITS));
}
/**

View file

@ -27,8 +27,6 @@
#include "../postgis_config.h"
#include "float.h" /* for DBL_DIG */
/* PostgreSQL */
#include "postgres.h"
#include "funcapi.h"

View file

@ -40,6 +40,7 @@
#include "../postgis_config.h"
#include "liblwgeom.h"
#include "liblwgeom_internal.h"
#include "lwgeom_pg.h"
@ -824,7 +825,7 @@ Datum LWGEOM_asText(PG_FUNCTION_ARGS)
GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
int dbl_dig_for_wkt = DBL_DIG;
int dbl_dig_for_wkt = OUT_DEFAULT_DECIMAL_DIGITS;
if (PG_NARGS() > 1) dbl_dig_for_wkt = PG_GETARG_INT32(1);
PG_RETURN_TEXT_P(lwgeom_to_wkt_varlena(lwgeom, WKT_ISO, dbl_dig_for_wkt));

View file

@ -31,7 +31,6 @@
#include "liblwgeom.h"
#include "lwgeom_transform.h"
#include "float.h" /* DBL_DIG */
Datum transform(PG_FUNCTION_ARGS);
Datum transform_geom(PG_FUNCTION_ARGS);
@ -191,8 +190,6 @@ Datum LWGEOM_asKML(PG_FUNCTION_ARGS)
}
/* Condition precision */
if (precision > DBL_DIG)
precision = DBL_DIG;
if (precision < 0)
precision = 0;

View file

@ -99,7 +99,7 @@ VALUES ( 2, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:
2, --- nbband
'4BUI', true, 3, 2, --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
'16BSI', false, 13, 4, --- b2pixeltype, b2hasnodatavalue, b2nodatavalue, b2val
'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
'POLYGON((-75.55333285370983 49.28245855055764,-75.55252688847578 49.2826703629415,-75.55231507609193 49.28186439770746,-75.55312104132598 49.2816525853236,-75.55333285370983 49.28245855055764))',
(
'01' -- little endian (uint8 ndr)
||
@ -148,7 +148,7 @@ VALUES ( 3, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:
2, --- nbband
'4BUI', true, 3, 3, --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
'16BSI', false, 13, 4, --- b2pixeltype, b2hasnodatavalue, b2nodatavalue, b2val
'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
'POLYGON((-75.55333285370983 49.28245855055764,-75.55252688847578 49.2826703629415,-75.55231507609193 49.28186439770746,-75.55312104132598 49.2816525853236,-75.55333285370983 49.28245855055764))',
(
'01' -- little endian (uint8 ndr)
||
@ -197,7 +197,7 @@ VALUES ( 4, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:
2, --- nbband
'4BUI', true, 3, 3, --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
'16BSI', false, 13, 4, --- b2pixeltype, b2hasnodatavalue, b2nodatavalue, b2val
'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
'POLYGON((-75.55333285370983 49.28245855055764,-75.55252688847578 49.2826703629415,-75.55231507609193 49.28186439770746,-75.55312104132598 49.2816525853236,-75.55333285370983 49.28245855055764))',
(
'01' -- little endian (uint8 ndr)
||

View file

@ -1,13 +1,13 @@
SELECT 'mic-box' AS name,
st_astext(st_snaptogrid(center, 0.0001)) AS center,
st_astext(st_snaptogrid(nearest, 0.0001)) AS nearest,
st_astext(center, 4) AS center,
st_astext(nearest, 4) AS nearest,
round(radius::numeric,4) AS radius
FROM ST_MaximumInscribedCircle('Polygon((0 0, 100 0, 99 98, 0 100, 0 0))'::geometry);
SELECT 'mic-empty' AS name,
st_astext(st_snaptogrid(center, 0.0001)) AS center,
st_astext(st_snaptogrid(nearest, 0.0001)) AS nearest,
st_astext(center, 4) AS center,
st_astext(nearest, 4) AS nearest,
round(radius::numeric,4) AS radius
FROM ST_MaximumInscribedCircle('Polygon Empty'::geometry);
@ -15,20 +15,20 @@ SELECT 'mic-null' AS name, center, nearest, radius
FROM ST_MaximumInscribedCircle(NULL);
SELECT 'mic-line' AS name,
st_astext(st_snaptogrid(center, 0.0001)) AS center,
st_astext(st_snaptogrid(nearest, 0.0001)) AS nearest,
st_astext(center, 4) AS center,
st_astext(nearest, 4) AS nearest,
round(radius::numeric,4) AS radius
FROM ST_MaximumInscribedCircle('LINESTRING(0 0, 100 0, 99 98, 0 100, 0 0)'::geometry);
SELECT 'mic-mpoint' AS name,
st_astext(st_snaptogrid(center, 0.0001)) AS center,
st_astext(st_snaptogrid(nearest, 0.0001)) AS nearest,
st_astext(center, 4) AS center,
st_astext(nearest, 4) AS nearest,
round(radius::numeric,4) AS radius
FROM ST_MaximumInscribedCircle('MULTIPOINT(0 0, 100 0, 99 98, 0 100, 0 0)'::geometry);
SELECT 'mic-point' AS name,
st_astext(st_snaptogrid(center, 0.0001)) AS center,
st_astext(st_snaptogrid(nearest, 0.0001)) AS nearest,
st_astext(center, 4) AS center,
st_astext(nearest, 4) AS nearest,
round(radius::numeric,4) AS radius
FROM ST_MaximumInscribedCircle('POINT(0 0)'::geometry);

View file

@ -1,2 +1,2 @@
select 'linefromencodedpolyline_01',st_asewkt(st_linefromencodedpolyline('_p~iF~ps|U_ulLnnqC_mqNvxq`@'));
select 'linefromencodedpolyline_02',st_asewkt(ST_SnapToGrid(st_linefromencodedpolyline('_izlhAj}oidF{}jgCrotj@chtxCn`{nI', 6),0.001));
select 'linefromencodedpolyline_02',st_asewkt(ST_AsText(st_linefromencodedpolyline('_izlhAj}oidF{}jgCrotj@chtxCn`{nI', 6),3));

View file

@ -1,2 +1,2 @@
linefromencodedpolyline_01|SRID=4326;LINESTRING(-120.2 38.5,-120.95 40.7,-126.453 43.252)
linefromencodedpolyline_02|SRID=4326;LINESTRING(-120.234 38.5,-120.95 40.734,-126.453 43.252)
linefromencodedpolyline_02|LINESTRING(-120.234 38.5,-120.95 40.734,-126.453 43.252)

View file

@ -2,11 +2,11 @@ box2dfromgeohash_01|BOX(-115.172816 36.114646,-115.172816 36.114646)
box2dfromgeohash_02|BOX(-180 -90,180 90)
box2dfromgeohash_03|BOX(-115.172816 36.114646,-115.172816 36.114646)
box2dfromgeohash_04|BOX(-115.172816 36.114646,-115.172816 36.114646)
geomfromgeohash_01|POLYGON((-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646))
geomfromgeohash_01|POLYGON((-115.17281600000001 36.11464599999999,-115.17281600000001 36.114646,-115.172816 36.114646,-115.172816 36.11464599999999,-115.17281600000001 36.11464599999999))
geomfromgeohash_02|POLYGON((-180 -90,-180 90,180 90,180 -90,-180 -90))
geomfromgeohash_03|POLYGON((-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646))
geomfromgeohash_04|POLYGON((-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646))
pointfromgeohash_01|POINT(-115.172816 36.114646)
geomfromgeohash_03|POLYGON((-115.17281600000001 36.11464599999999,-115.17281600000001 36.114646,-115.172816 36.114646,-115.172816 36.11464599999999,-115.17281600000001 36.11464599999999))
geomfromgeohash_04|POLYGON((-115.17281600000001 36.11464599999999,-115.17281600000001 36.114646,-115.172816 36.114646,-115.172816 36.11464599999999,-115.17281600000001 36.11464599999999))
pointfromgeohash_01|POINT(-115.17281600000001 36.11464599999999)
pointfromgeohash_02|POINT(0 0)
pointfromgeohash_03|POINT(-115.172816 36.114646)
pointfromgeohash_04|POINT(-115.172816 36.114646)
pointfromgeohash_03|POINT(-115.17281600000001 36.11464599999999)
pointfromgeohash_04|POINT(-115.17281600000001 36.11464599999999)

View file

@ -293,7 +293,8 @@ SELECT 'mpoint_5', ST_AsEWKT(ST_GeomFromGML('<gml:MultiPoint></gml:MultiPoint>')
SELECT 'mpoint_6', ST_AsEWKT(ST_GeomFromGML(' <!-- --> <gml:MultiPoint> <!-- --> <gml:pointMember> <!-- --> <gml:Point> <!-- --> <gml:coordinates>1,2</gml:coordinates></gml:Point></gml:pointMember> <!-- --> <gml:pointMember> <!-- --> <gml:Point> <!-- --> <gml:coordinates>3,4</gml:coordinates></gml:Point></gml:pointMember></gml:MultiPoint>'));
-- Mixed srsName
SELECT 'mpoint_7', ST_AsEWKT(ST_GeomFromGML('<gml:MultiPoint srsName="EPSG:27582"><gml:pointMember><gml:Point><gml:coordinates>1,2</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point srsName="EPSG:27562"><gml:coordinates>400000,5000000</gml:coordinates></gml:Point></gml:pointMember></gml:MultiPoint>'));
WITH g AS (SELECT ST_GeomFromGML('<gml:MultiPoint srsName="EPSG:27582"><gml:pointMember><gml:Point><gml:coordinates>1,2</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point srsName="EPSG:27562"><gml:coordinates>400000,5000000</gml:coordinates></gml:Point></gml:pointMember></gml:MultiPoint>') as geom)
SELECT 'mpoint_7', ST_SRID(g.geom), ST_AsText(g.geom, 8) from g;
-- 1 point in pointMembers
SELECT 'mpoint_8', ST_AsEWKT(ST_GeomFromGML('<gml:MultiPoint><gml:pointMembers><gml:Point><gml:coordinates>1,2</gml:coordinates></gml:Point></gml:pointMembers></gml:MultiPoint>'));
@ -329,8 +330,8 @@ SELECT 'mline_7', ST_AsEWKT(ST_GeomFromGML('<gml:MultiLineString><gml:lineString
SELECT 'mline_8', ST_AsEWKT(ST_GeomFromGML('<gml:MultiLineString><gml:lineStringMember><gml:LineString><gml:posList srsDimension="2">1 2 3 4</gml:posList></gml:LineString></gml:lineStringMember><gml:lineStringMember><gml:LineString><gml:posList srsDimension="3">5 6 7 8 9 10</gml:posList></gml:LineString></gml:lineStringMember></gml:MultiLineString>'));
-- Mixed srsName
SELECT 'mline_9', ST_AsEWKT(ST_GeomFromGML('<gml:MultiLineString srsName="EPSG:27582"><gml:lineStringMember><gml:LineString><gml:coordinates>1,2 3,4</gml:coordinates></gml:LineString></gml:lineStringMember><gml:lineStringMember><gml:LineString srsName="EPSG:27562"><gml:coordinates>400000,5000000 400010,5000010</gml:coordinates></gml:LineString></gml:lineStringMember></gml:MultiLineString>'));
WITH g AS (SELECT ST_GeomFromGML('<gml:MultiLineString srsName="EPSG:27582"><gml:lineStringMember><gml:LineString><gml:coordinates>1,2 3,4</gml:coordinates></gml:LineString></gml:lineStringMember><gml:lineStringMember><gml:LineString srsName="EPSG:27562"><gml:coordinates>400000,5000000 400010,5000010</gml:coordinates></gml:LineString></gml:lineStringMember></gml:MultiLineString>') as g)
SELECT 'mline_9', ST_SRID(g.g), ST_AsText(g.g, 8) from g;
--
-- MultiCurve
--
@ -356,7 +357,8 @@ SELECT 'mcurve_7', ST_AsEWKT(ST_GeomFromGML('<gml:MultiCurve><gml:curveMember><g
SELECT 'mcurve_8', ST_AsEWKT(ST_GeomFromGML('<gml:MultiCurve><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension="2">1 2 3 4</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension="3">5 6 7 8 9 10</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:MultiCurve>'));
-- Mixed srsName
SELECT 'mcurve_9', ST_AsEWKT(ST_GeomFromGML('<gml:MultiCurve srsName="EPSG:27582"><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:coordinates>1,2 3,4</gml:coordinates></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember><gml:curveMember><gml:Curve srsName="EPSG:27562"><gml:segments><gml:LineStringSegment><gml:coordinates>400000,5000000 400010,5000010</gml:coordinates></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:MultiCurve>'));
WITH g AS (SELECT ST_GeomFromGML('<gml:MultiCurve srsName="EPSG:27582"><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:coordinates>1,2 3,4</gml:coordinates></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember><gml:curveMember><gml:Curve srsName="EPSG:27562"><gml:segments><gml:LineStringSegment><gml:coordinates>400000,5000000 400010,5000010</gml:coordinates></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:MultiCurve>') as g)
SELECT 'mcurve_9', ST_SRID(g.g), ST_AsText(g.g, 8) FROM g;
-- 1 curve in curveMembers
SELECT 'mcurve_10', ST_AsEWKT(ST_GeomFromGML('<gml:MultiCurve><gml:curveMembers><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList>1 2 3 4</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMembers></gml:MultiCurve>'));
@ -391,7 +393,8 @@ SELECT 'mpoly_7', ST_AsEWKT(ST_GeomFromGML('<gml:MultiPolygon><gml:polygonMember
SELECT 'mpoly_8', ST_AsEWKT(ST_GeomFromGML('<gml:MultiPolygon><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList srsDimension="2">1 2 3 4 5 6 1 2</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList srsDimension="3">7 8 9 10 11 12 13 14 15 7 8 9</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>'));
-- Mixed srsName
SELECT 'mpoly_9', ST_AsEWKT(ST_GeomFromGML('<gml:MultiPolygon srsName="EPSG:27582"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon srsName="EPSG:27562"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>400000,5000000 400010,5000010 400020,5000020 400000,5000000</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>400100,5000100 400110,5000110 400120,5000120 400100,5000100</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>'));
-- Note, Using ST_AsText with precision due to precision changes in proj
SELECT 'mpoly_9', ST_AsText(ST_GeomFromGML('<gml:MultiPolygon srsName="EPSG:27582"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon srsName="EPSG:27562"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>400000,5000000 400010,5000010 400020,5000020 400000,5000000</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>400100,5000100 400110,5000110 400120,5000120 400100,5000100</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>'), 8);
--
-- MultiSurface
@ -418,7 +421,8 @@ SELECT 'msurface_7', ST_AsEWKT(ST_GeomFromGML('<gml:MultiSurface><gml:surfaceMem
SELECT 'msurface_8', ST_AsEWKT(ST_GeomFromGML('<gml:MultiSurface><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList srsDimension="2">1 2 3 4 5 6 1 2</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList srsDimension="3">7 8 9 10 11 12 13 14 15 7 8 9</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>'));
-- Mixed srsName
SELECT 'msurface_9', ST_AsEWKT(ST_GeomFromGML('<gml:MultiSurface srsName="EPSG:27582"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember><gml:surfaceMember><gml:Polygon srsName="EPSG:27562"><gml:exterior><gml:LinearRing><gml:coordinates>400000,5000000 400010,5000010 400020,5000020 400000,5000000</gml:coordinates></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:coordinates>400100,5000100 400110,5000110 400120,5000120 400100,5000100</gml:coordinates></gml:LinearRing></gml:interior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>'));
-- Note, Using ST_AsText with precision due to precision changes in proj
SELECT 'msurface_9', ST_AsText(ST_GeomFromGML('<gml:MultiSurface srsName="EPSG:27582"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember><gml:surfaceMember><gml:Polygon srsName="EPSG:27562"><gml:exterior><gml:LinearRing><gml:coordinates>400000,5000000 400010,5000010 400020,5000020 400000,5000000</gml:coordinates></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:coordinates>400100,5000100 400110,5000110 400120,5000120 400100,5000100</gml:coordinates></gml:LinearRing></gml:interior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>'), 8);
-- 1 surface in surfaceMembers
SELECT 'msurface_10', ST_AsEWKT(ST_GeomFromGML('<gml:MultiSurface><gml:surfaceMembers><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>1 2 3 4 5 6 1 2</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMembers></gml:MultiSurface>'));
@ -590,7 +594,8 @@ SELECT 'collection_12', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry><gml:geomet
SELECT 'collection_13', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry><gml:geometryMember><gml:Point><gml:pos srsDimension="2">1 2</gml:pos></gml:Point></gml:geometryMember><gml:geometryMember><gml:MultiGeometry><gml:geometryMember><gml:MultiGeometry><gml:geometryMember><gml:Point><gml:pos srsDimension="3">3 4 5</gml:pos></gml:Point></gml:geometryMember></gml:MultiGeometry></gml:geometryMember></gml:MultiGeometry></gml:geometryMember></gml:MultiGeometry>'));
-- Mixed srsName
SELECT 'collection_14', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry srsName="EPSG:27582"><gml:geometryMember><gml:Point><gml:coordinates>1,2</gml:coordinates></gml:Point></gml:geometryMember><gml:geometryMember><gml:MultiGeometry><gml:geometryMember><gml:MultiGeometry srsName="EPSG:27562"><gml:geometryMember><gml:Point><gml:coordinates>400000,5000000</gml:coordinates></gml:Point></gml:geometryMember></gml:MultiGeometry></gml:geometryMember></gml:MultiGeometry></gml:geometryMember></gml:MultiGeometry>'));
WITH g AS (SELECT ST_GeomFromGML('<gml:MultiGeometry srsName="EPSG:27582"><gml:geometryMember><gml:Point><gml:coordinates>1,2</gml:coordinates></gml:Point></gml:geometryMember><gml:geometryMember><gml:MultiGeometry><gml:geometryMember><gml:MultiGeometry srsName="EPSG:27562"><gml:geometryMember><gml:Point><gml:coordinates>400000,5000000</gml:coordinates></gml:Point></gml:geometryMember></gml:MultiGeometry></gml:geometryMember></gml:MultiGeometry></gml:geometryMember></gml:MultiGeometry>') AS g)
SELECT 'collection_14', ST_SRID(g.g), ST_AsText(g.g, 8) FROM g;
--
-- srsName

View file

@ -95,7 +95,7 @@ mpoint_3|SRID=4326;MULTIPOINT(1 2)
mpoint_4|MULTIPOINT EMPTY
mpoint_5|MULTIPOINT EMPTY
mpoint_6|MULTIPOINT(1 2,3 4)
mpoint_7|SRID=27582;MULTIPOINT(1 2,400000 7000000)
mpoint_7|27582|MULTIPOINT(1 2,400000 7000000)
mpoint_8|MULTIPOINT(1 2)
mpoint_9|MULTIPOINT(1 2,3 4)
mpoint_10|MULTIPOINT EMPTY
@ -107,7 +107,7 @@ mline_5|MULTILINESTRING EMPTY
mline_6|MULTILINESTRING((1 2,3 4),(5 6,7 8))
mline_7|MULTILINESTRING((1 2,4 5),(7 8,9 10))
mline_8|MULTILINESTRING((1 2,3 4),(5 6,8 9))
mline_9|SRID=27582;MULTILINESTRING((1 2,3 4),(400000 7000000,400010 7000010))
mline_9|27582|MULTILINESTRING((1 2,3 4),(400000 7000000,400010 7000010))
mcurve_1|MULTILINESTRING((1 2,3 4))
mcurve_2|MULTILINESTRING((1 2,3 4),(5 6,7 8))
mcurve_3|SRID=4326;MULTILINESTRING((1 2,3 4))
@ -116,7 +116,7 @@ mcurve_5|MULTILINESTRING EMPTY
mcurve_6|MULTILINESTRING((1 2,3 4),(5 6,7 8))
mcurve_7|MULTILINESTRING((1 2,4 5),(7 8,9 10))
mcurve_8|MULTILINESTRING((1 2,3 4),(5 6,8 9))
mcurve_9|SRID=27582;MULTILINESTRING((1 2,3 4),(400000 7000000,400010 7000010))
mcurve_9|27582|MULTILINESTRING((1 2,3 4),(400000 7000000,400010 7000010))
mcurve_10|MULTILINESTRING((1 2,3 4))
mcurve_11|MULTILINESTRING((1 2,3 4),(5 6,7 8))
mcurve_12|MULTILINESTRING EMPTY
@ -128,7 +128,7 @@ mpoly_5|MULTIPOLYGON EMPTY
mpoly_6|MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((7 8,9 10,11 12,7 8)))
mpoly_7|MULTIPOLYGON(((1 2,4 5,7 8,1 2)),((10 11,12 13,14 15,10 11)))
mpoly_8|MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((7 8,10 11,13 14,7 8)))
mpoly_9|SRID=27582;MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((400000 7000000,400010 7000010,400020 7000020,400000 7000000),(400100 7000100,400110 7000110,400120 7000120,400100 7000100)))
mpoly_9|MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((400000 7000000,400010 7000010,400020 7000020,400000 7000000),(400100 7000100,400110 7000110,400120 7000120,400100 7000100)))
msurface_1|MULTIPOLYGON(((1 2,3 4,5 6,1 2)))
msurface_2|MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((7 8,9 10,11 12,7 8)))
msurface_3|SRID=4326;MULTIPOLYGON(((1 2,3 4,5 6,1 2)))
@ -137,7 +137,7 @@ msurface_5|MULTIPOLYGON EMPTY
msurface_6|MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((7 8,9 10,11 12,7 8)))
msurface_7|MULTIPOLYGON(((1 2,4 5,7 8,1 2)),((10 11,12 13,14 15,10 11)))
msurface_8|MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((7 8,10 11,13 14,7 8)))
msurface_9|SRID=27582;MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((400000 7000000,400010 7000010,400020 7000020,400000 7000000),(400100 7000100,400110 7000110,400120 7000120,400100 7000100)))
msurface_9|MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((400000 7000000,400010 7000010,400020 7000020,400000 7000000),(400100 7000100,400110 7000110,400120 7000120,400100 7000100)))
msurface_10|MULTIPOLYGON(((1 2,3 4,5 6,1 2)))
msurface_11|MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((7 8,9 10,11 12,7 8)))
msurface_12|MULTIPOLYGON EMPTY
@ -197,7 +197,7 @@ collection_10|SRID=4326;GEOMETRYCOLLECTION(POINT(1 2))
collection_11|GEOMETRYCOLLECTION(POINT(1 2),GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4))))
collection_12|GEOMETRYCOLLECTION(POINT(1 2),GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(4 5))))
collection_13|GEOMETRYCOLLECTION(POINT(1 2),GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4))))
collection_14|SRID=27582;GEOMETRYCOLLECTION(POINT(1 2),GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(400000 7000000))))
collection_14|27582|GEOMETRYCOLLECTION(POINT(1 2),GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(400000 7000000))))
srs_1|SRID=4326;POINT(1 2)
srs_2|SRID=4326;POINT(2 1)
srs_3|SRID=4326;POINT(2 1)
@ -432,4 +432,4 @@ ERROR: invalid GML representation
ERROR: invalid GML representation
ERROR: invalid GML representation
ERROR: invalid GML representation
#4652|SRID=28992;LINESTRING(119675.919 526436.120999999,119676.546999998 526439.493000001,119676.443 526439.513,119676.033 526439.622000001,119675.385000002 526439.868999999,119675.155004521 526439.973573522,119674.929225254 526440.086963405,119674.708000001 526440.208999999,119674.013479107 526440.657580108,119673.387488245 526441.197690123)
#4652|SRID=28992;LINESTRING(119675.91899999976 526436.1209999993,119676.54699999839 526439.4930000007,119676.44299999997 526439.5130000003,119676.03299999982 526439.6220000014,119675.38500000164 526439.868999999,119675.15500452081 526439.9735735222,119674.92922525379 526440.0869634049,119674.70800000057 526440.2089999989,119674.01347910661 526440.6575801083,119673.38748824484 526441.1976901226)

View file

@ -24,9 +24,9 @@ BOX3D(0 0.1 -55,11 12 12)
#3069|BOX(1 1,1 1)
#3069|BOX(0 0,1 1)
#2902|GeometryCollection[ZBS] with 3 elements: Polygon[ZS] with 1 ring: ring 0 has 5 points Point[ZS] MultiLineString[ZS] with 1 element: LineString[ZS] with 2 points
BoundingDiagonal1|SRID=4326;LINESTRING(999999986991104 999999986991104,1e+15 1e+15)
BoundingDiagonal1|SRID=4326;LINESTRING(999999986991104 999999986991104,1.000000054099968e+15 1.000000054099968e+15)
BoundingDiagonal2|SRID=4326;LINESTRING(1e+15 1e+15,1e+15 1e+15)
BoundingDiagonal3|SRID=4326;LINESTRING(999999986991104 999999986991104,1e+15 1e+15)
BoundingDiagonal3|SRID=4326;LINESTRING(999999986991104 999999986991104,1.000000054099968e+15 1.000000054099968e+15)
BoundingDiagonal4|SRID=3857;LINESTRING(-1 -2 -8 2,1 2 3 9)
BoundingDiagonal5|SRID=3857;LINESTRINGM(4 4 0,5 4 1)
BoundingDiagonal6|SRID=3857;LINESTRINGM EMPTY

View file

@ -31,7 +31,7 @@ distancepoly5|0|26.172505|LINESTRING(17 12,17 12)|LINESTRING(17 12,17 12)|LINEST
distancepoly6|0|32.526912|LINESTRING(2 2,2 2)|LINESTRING(2 2,2 2)|LINESTRING(2 2,25 25)|LINESTRING(25 25,2 2)
3dDistancetest1|6.403124|6.403124|f|f|LINESTRING(1 1 1,3 2 7)|POINT(1 1 1)|LINESTRING(1 1 1,3 2 7)
3dDistancetest2|0|1.732051|t|t|LINESTRING(1 1 1,1 1 1)|POINT(1 1 1)|LINESTRING(1 1 1,0 0 0)
3dDistancetest3|4.099942|6.480741|t|f|LINESTRING(1 1 1,0.61904761904762 -0.19047619047619 4.90476190476191)|POINT(1 1 1)|LINESTRING(1 1 1,5 2 6)
3dDistancetest3|4.099942|6.480741|t|f|LINESTRING(1 1 1,0.61904761904762 -0.19047619047619 4.904761904761905)|POINT(1 1 1)|LINESTRING(1 1 1,5 2 6)
3dDistancetest4|2|10.049876|t|f|LINESTRING(1 1 3,1 1 1)|POINT(1 1 3)|LINESTRING(5 7 8,1 1 1)
3dDistancetest5|2|10|t|f|LINESTRING(5 0 5,5 2 5)|POINT(5 0 5)|LINESTRING(11 0 5,5 0 13)
3dDistancetest6|0

View file

@ -35,14 +35,14 @@ SELECT 't10b', ST_AsEWKT(ST_SnapToGrid(ST_OffsetCurve(
'SRID=42;LINESTRING(0 0, 10 0, 5 10)', 2,
'quad_segs=2 join=miter miter_limit=1'),
1));
SELECT 't11', ST_AsEWKT(ST_SnapToGrid(ST_OffsetCurve(
SELECT 't11', ST_AsText(ST_SnapToGrid(ST_OffsetCurve(
'LINESTRING(36 38,38 35,41 34,42 33,45 32,47 28,50 28,52 32,57 33)', 2,
'join=mitre'),
0.2));
SELECT 't12', ST_AsEWKT(ST_SnapToGrid(ST_OffsetCurve(
0.2), 1);
SELECT 't12', ST_AsText(ST_SnapToGrid(ST_OffsetCurve(
'LINESTRING(36 38,38 35,41 34,42 33,45 32,47 28,50 28,52 32,57 33)', -2,
'join=mitre'),
0.2));
0.2), 1);
SELECT 't13', ST_AsEWKT(ST_OffsetCurve(
'LINESTRING(0 0,0 20, 10 20, 10 10, 0 10)', 2,
'join=mitre'

View file

@ -265,37 +265,37 @@ select '225', ST_Expand('BOX(-2 3, -1 6'::BOX2D, 4, 2);
select '226', ST_SRID(ST_Expand('SRID=4326;POINT (0 0)'::geometry, 1))=4326;
-- ST_TileEnvelope()
select '227', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(-1, 0, 0) ,0.01));
select '228', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(0, 0, 1), 0.01));
select '229', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(0, 0, 0), 0.01));
select '230', ST_AsText(ST_SnapToGrid(ST_TileEnvelope(4, 8, 8), 0.01));
select '231', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(4, 15, 15),0.01));
select '232', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(4, 8, 8, ST_MakeEnvelope(-100, -100, 100, 100, 0)), 0.01));
select '233', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(4, 15, 15, ST_MakeEnvelope(-100, -100, 100, 100, 0)), 0.01));
select '234', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(4, 0, 0, ST_MakeEnvelope(-100, -100, 100, 100, 0)), 0.01));
select '235', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(4, 8, 8, ST_MakeEnvelope(-200, -100, 200, 100, 0)), 0.01));
select '236', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(0, 0, 0, margin => 0.1), 0.01));
select '237', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(1, 0, 0, margin => 0.1), 0.01));
select '238', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(2, 1, 3, margin => 0.5), 0.01));
select '239', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(0, 0, 0, margin => -0.5), 0.01));
select '240', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(0, 0, 0, margin => -0.51), 0.01));
select '241', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(0, 0, 0, margin => -0.4), 0.01));
select '250', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(10,300,387), 0.01));
select '251', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(10,300,387, margin => 0.1), 0.01));
select '252', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(10,300,387, margin => 0.5), 0.01));
select '253', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(10,300,387, margin => 2), 0.01));
select '254', ST_AsEWKT(ST_SnapToGrid(ST_TileEnvelope(10,300,387, margin => -0.3), 0.01));
select '227', ST_AsText(ST_TileEnvelope(-1, 0, 0), 2);
select '228', ST_AsText(ST_TileEnvelope(0, 0, 1), 2);
select '229', ST_AsText(ST_TileEnvelope(0, 0, 0), 2);
select '230', ST_AsText(ST_TileEnvelope(4, 8, 8), 2);
select '231', ST_AsText(ST_TileEnvelope(4, 15, 15), 2);
select '232', ST_AsText(ST_TileEnvelope(4, 8, 8, ST_MakeEnvelope(-100, -100, 100, 100, 0)), 2);
select '233', ST_AsText(ST_TileEnvelope(4, 15, 15, ST_MakeEnvelope(-100, -100, 100, 100, 0)), 2);
select '234', ST_AsText(ST_TileEnvelope(4, 0, 0, ST_MakeEnvelope(-100, -100, 100, 100, 0)), 2);
select '235', ST_AsText(ST_TileEnvelope(4, 8, 8, ST_MakeEnvelope(-200, -100, 200, 100, 0)), 2);
select '236', ST_AsText(ST_TileEnvelope(0, 0, 0, margin => 0.1), 2);
select '237', ST_AsText(ST_TileEnvelope(1, 0, 0, margin => 0.1), 2);
select '238', ST_AsText(ST_TileEnvelope(2, 1, 3, margin => 0.5), 2);
select '239', ST_AsText(ST_TileEnvelope(0, 0, 0, margin => -0.5), 2);
select '240', ST_AsText(ST_TileEnvelope(0, 0, 0, margin => -0.51), 2);
select '241', ST_AsText(ST_TileEnvelope(0, 0, 0, margin => -0.4), 2);
select '250', ST_AsText(ST_TileEnvelope(10,300,387), 2);
select '251', ST_AsText(ST_TileEnvelope(10,300,387, margin => 0.1), 2);
select '252', ST_AsText(ST_TileEnvelope(10,300,387, margin => 0.5), 2);
select '253', ST_AsText(ST_TileEnvelope(10,300,387, margin => 2), 2);
select '254', ST_AsText(ST_TileEnvelope(10,300,387, margin => -0.3), 2);
-- ST_Hexagon()
select '300', ST_AsEWKT(ST_SnapToGrid(ST_Hexagon(10, 0, 0),0.00001));
select '301', ST_AsEWKT(ST_SnapToGrid(ST_Hexagon(10, 1, 1),0.00001));
select '302', ST_AsEWKT(ST_SnapToGrid(ST_Hexagon(10, -1, -1),0.00001));
select '303', ST_AsEWKT(ST_SnapToGrid(ST_Hexagon(10, 100, -100),0.00001));
select '300', ST_AsText(ST_Hexagon(10, 0, 0), 5);
select '301', ST_AsText(ST_Hexagon(10, 1, 1), 5);
select '302', ST_AsText(ST_Hexagon(10, -1, -1), 5);
select '303', ST_AsText(ST_Hexagon(10, 100, -100), 5);
-- ST_Square()
select '304', ST_AsEWKT(ST_SnapToGrid(ST_Square(10, 0, 0),0.00001));
select '305', ST_AsEWKT(ST_SnapToGrid(ST_Square(10, 1, 1),0.00001));
select '306', ST_AsEWKT(ST_SnapToGrid(ST_Square(10, -1, -1),0.00001));
select '307', ST_AsEWKT(ST_SnapToGrid(ST_Square(10, 100, -100),0.00001));
select '304', ST_AsText(ST_Square(10, 0, 0), 5);
select '305', ST_AsText(ST_Square(10, 1, 1), 5);
select '306', ST_AsText(ST_Square(10, -1, -1), 5);
select '307', ST_AsText(ST_Square(10, 100, -100), 5);
-- ST_HexagonGrid()
select '308', Count(*) FROM ST_HexagonGrid(100000, ST_TileEnvelope(4, 7, 7));
select '309', Count(*) FROM ST_HexagonGrid(100000, ST_TileEnvelope(4, 7, 7)) hex, ST_TileEnvelope(4, 7, 7) tile WHERE NOT ST_Intersects(hex.geom, tile);
@ -322,7 +322,7 @@ j1 AS
SELECT '316',
ST_Intersects(j0.geom, j1.geom),
ST_AsText(ST_Intersection(j0.geom, j1.geom))
FROM j0,j1;
FROM j0, j1;
-- Drop test table
DROP table test;

View file

@ -5,19 +5,19 @@
-- Ouput is snapped to grid to account for small floating numbers
-- differences between architectures
SELECT 'point quadsegs=2', ST_AsText(ST_SnapToGrid(st_buffer('POINT(0 0)', 1, 'quad_segs=2'), 1.0e-6));
SELECT 'line quadsegs=2', ST_AsText(ST_SnapToGrid(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2'), 1.0e-6));
SELECT 'line quadsegs=2 endcap=flat', ST_AsText(ST_SnapToGrid(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2 endcap=flat'), 1.0e-6));
SELECT 'line quadsegs=2 endcap=butt', ST_AsText(ST_SnapToGrid(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2 endcap=butt'), 1.0e-6));
SELECT 'line quadsegs=2 endcap=square', ST_AsText(ST_SnapToGrid(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2 endcap=square'), 1.0e-6));
SELECT 'line join=mitre mitre_limit=1.0 side=both', ST_AsText(ST_SnapToGrid(ST_Buffer('LINESTRING(50 50,150 150,150 50)',10,'join=mitre mitre_limit=1.0 side=both'), 1.0e-6));
SELECT 'line side=left',ST_AsText(ST_SnapToGrid(ST_Buffer('LINESTRING(50 50,150 150,150 50)',10,'side=left'),1.0e-6));
SELECT 'line side=right',ST_AsText(ST_SnapToGrid(ST_Buffer('LINESTRING(50 50,150 150,150 50)',10,'side=right'),1.0e-6));
SELECT 'line side=left join=mitre',ST_AsText(ST_SnapToGrid(ST_Buffer('LINESTRING(50 50,150 150,150 50)',10,'side=left join=mitre'),1.0e-6));
SELECT 'poly quadsegs=2 join=round', ST_AsText(ST_SnapToGrid(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=round'), 1.0e-6));
SELECT 'poly quadsegs=2 join=bevel', ST_AsText(ST_SnapToGrid(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=bevel'), 1.0e-6));
SELECT 'poly quadsegs=2 join=mitre', ST_AsText(ST_SnapToGrid(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=mitre'), 1.0e-6));
SELECT 'poly quadsegs=2 join=mitre mitre_limit=1', ST_AsText(ST_SnapToGrid(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=mitre mitre_limit=1'), 1.0e-6));
SELECT 'poly quadsegs=2 join=miter miter_limit=1', ST_AsText(ST_SnapToGrid(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=miter miter_limit=1'), 1.0e-6));
SELECT 'poly boundary rhr side=left', ST_AsText(ST_SnapToGrid(ST_Buffer(ST_ForceRHR(ST_Boundary('POLYGON ((20 20, 20 40, 40 40, 40 40, 40 20, 20 20))')),10,'join=mitre side=left'),1.0e-6));
SELECT 'point quadsegs=2', ST_AsText(st_buffer('POINT(0 0)', 1, 'quad_segs=2'), 6);
SELECT 'line quadsegs=2', ST_AsText(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2'), 6);
SELECT 'line quadsegs=2 endcap=flat', ST_AsText(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2 endcap=flat'), 6);
SELECT 'line quadsegs=2 endcap=butt', ST_AsText(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2 endcap=butt'), 6);
SELECT 'line quadsegs=2 endcap=square', ST_AsText(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2 endcap=square'), 6);
SELECT 'line join=mitre mitre_limit=1.0 side=both', ST_AsText(ST_Buffer('LINESTRING(50 50,150 150,150 50)',10,'join=mitre mitre_limit=1.0 side=both'), 6);
SELECT 'line side=left',ST_AsText(ST_Buffer('LINESTRING(50 50,150 150,150 50)',10,'side=left'), 6);
SELECT 'line side=right',ST_AsText(ST_Buffer('LINESTRING(50 50,150 150,150 50)',10,'side=right'),6);
SELECT 'line side=left join=mitre',ST_AsText(ST_Buffer('LINESTRING(50 50,150 150,150 50)',10,'side=left join=mitre'),6);
SELECT 'poly quadsegs=2 join=round', ST_AsText(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=round'), 6);
SELECT 'poly quadsegs=2 join=bevel', ST_AsText(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=bevel'), 6);
SELECT 'poly quadsegs=2 join=mitre', ST_AsText(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=mitre'), 6);
SELECT 'poly quadsegs=2 join=mitre mitre_limit=1', ST_AsText(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=mitre mitre_limit=1'), 6);
SELECT 'poly quadsegs=2 join=miter miter_limit=1', ST_AsText(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=miter miter_limit=1'), 6);
SELECT 'poly boundary rhr side=left', ST_AsText(ST_Buffer(ST_ForceRHR(ST_Boundary('POLYGON ((20 20, 20 40, 40 40, 40 40, 40 20, 20 20))')),10,'join=mitre side=left'),6);

View file

@ -1,5 +1,5 @@
point quadsegs=2|POLYGON((1 0,0.707107 -0.707107,0 -1,-0.707107 -0.707107,-1 0,-0.707107 0.707107,0 1,0.707107 0.707107,1 0))
line quadsegs=2|POLYGON((10 2,11.414214 1.414214,12 0,11.414214 -1.414214,10 -2,0 -2,-1.414214 -1.414214,-2 0,-1.414214 1.414214,0 2,10 2))
point quadsegs=2|POLYGON((1 0,0.707107 -0.707107,1.615545e-15 -1,-0.707107 -0.707107,-1 -3.231089e-15,-0.707107 0.707107,-4.624589e-15 1,0.707107 0.707107,1 0))
line quadsegs=2|POLYGON((10 2,11.414214 1.414214,12 0,11.414214 -1.414214,10 -2,0 -2,-1.414214 -1.414214,-2 2.449294e-16,-1.414214 1.414214,0 2,10 2))
line quadsegs=2 endcap=flat|POLYGON((10 2,10 -2,0 -2,0 2,10 2))
line quadsegs=2 endcap=butt|POLYGON((10 2,10 -2,0 -2,0 2,10 2))
line quadsegs=2 endcap=square|POLYGON((10 2,12 2,12 -2,0 -2,-2 -2,-2 2,10 2))

View file

@ -196,24 +196,24 @@ ERROR: geometry contains non-closed rings
226|t
ERROR: ST_TileEnvelope: Invalid tile zoom value, -1
ERROR: ST_TileEnvelope: Invalid tile y value, 1
229|SRID=3857;POLYGON((-20037508.34 -20037508.34,-20037508.34 20037508.34,20037508.34 20037508.34,20037508.34 -20037508.34,-20037508.34 -20037508.34))
229|POLYGON((-20037508.34 -20037508.34,-20037508.34 20037508.34,20037508.34 20037508.34,20037508.34 -20037508.34,-20037508.34 -20037508.34))
230|POLYGON((0 -2504688.54,0 0,2504688.54 0,2504688.54 -2504688.54,0 -2504688.54))
231|SRID=3857;POLYGON((17532819.8 -20037508.34,17532819.8 -17532819.8,20037508.34 -17532819.8,20037508.34 -20037508.34,17532819.8 -20037508.34))
231|POLYGON((17532819.8 -20037508.34,17532819.8 -17532819.8,20037508.34 -17532819.8,20037508.34 -20037508.34,17532819.8 -20037508.34))
232|POLYGON((0 -12.5,0 0,12.5 0,12.5 -12.5,0 -12.5))
233|POLYGON((87.5 -100,87.5 -87.5,100 -87.5,100 -100,87.5 -100))
234|POLYGON((-100 87.5,-100 100,-87.5 100,-87.5 87.5,-100 87.5))
235|POLYGON((0 -12.5,0 0,25 0,25 -12.5,0 -12.5))
236|SRID=3857;POLYGON((-20037508.34 -20037508.34,-20037508.34 20037508.34,20037508.34 20037508.34,20037508.34 -20037508.34,-20037508.34 -20037508.34))
237|SRID=3857;POLYGON((-22041259.18 -2003750.83,-22041259.18 20037508.34,2003750.83 20037508.34,2003750.83 -2003750.83,-22041259.18 -2003750.83))
238|SRID=3857;POLYGON((-15028131.26 -20037508.34,-15028131.26 -5009377.09,5009377.09 -5009377.09,5009377.09 -20037508.34,-15028131.26 -20037508.34))
239|SRID=3857;POLYGON EMPTY
236|POLYGON((-20037508.34 -20037508.34,-20037508.34 20037508.34,20037508.34 20037508.34,20037508.34 -20037508.34,-20037508.34 -20037508.34))
237|POLYGON((-22041259.18 -2003750.83,-22041259.18 20037508.34,2003750.83 20037508.34,2003750.83 -2003750.83,-22041259.18 -2003750.83))
238|POLYGON((-15028131.26 -20037508.34,-15028131.26 -5009377.09,5009377.09 -5009377.09,5009377.09 -20037508.34,-15028131.26 -20037508.34))
239|POLYGON((0 0,0 0,0 0,0 0,0 0))
ERROR: ST_TileEnvelope: Margin must not be less than -50%, margin=-0.510000
241|SRID=3857;POLYGON((-4007501.67 -4007501.67,-4007501.67 4007501.67,4007501.67 4007501.67,4007501.67 -4007501.67,-4007501.67 -4007501.67))
250|SRID=3857;POLYGON((-8296780.8 4852834.05,-8296780.8 4891969.81,-8257645.04 4891969.81,-8257645.04 4852834.05,-8296780.8 4852834.05))
251|SRID=3857;POLYGON((-8300694.37 4848920.48,-8300694.37 4895883.39,-8253731.46 4895883.39,-8253731.46 4848920.48,-8300694.37 4848920.48))
252|SRID=3857;POLYGON((-8316348.68 4833266.17,-8316348.68 4911537.69,-8238077.16 4911537.69,-8238077.16 4833266.17,-8316348.68 4833266.17))
253|SRID=3857;POLYGON((-8375052.32 4774562.53,-8375052.32 4970241.33,-8179373.52 4970241.33,-8179373.52 4774562.53,-8375052.32 4774562.53))
254|SRID=3857;POLYGON((-8285040.07 4864574.78,-8285040.07 4880229.08,-8269385.77 4880229.08,-8269385.77 4864574.78,-8285040.07 4864574.78))
241|POLYGON((-4007501.67 -4007501.67,-4007501.67 4007501.67,4007501.67 4007501.67,4007501.67 -4007501.67,-4007501.67 -4007501.67))
250|POLYGON((-8296780.8 4852834.05,-8296780.8 4891969.81,-8257645.04 4891969.81,-8257645.04 4852834.05,-8296780.8 4852834.05))
251|POLYGON((-8300694.37 4848920.48,-8300694.37 4895883.39,-8253731.46 4895883.39,-8253731.46 4848920.48,-8300694.37 4848920.48))
252|POLYGON((-8316348.68 4833266.17,-8316348.68 4911537.69,-8238077.16 4911537.69,-8238077.16 4833266.17,-8316348.68 4833266.17))
253|POLYGON((-8375052.32 4774562.53,-8375052.32 4970241.33,-8179373.52 4970241.33,-8179373.52 4774562.53,-8375052.32 4774562.53))
254|POLYGON((-8285040.07 4864574.78,-8285040.07 4880229.08,-8269385.77 4880229.08,-8269385.77 4864574.78,-8285040.07 4864574.78))
300|POLYGON((-10 0,-5 -8.66025,5 -8.66025,10 0,5 8.66025,-5 8.66025,-10 0))
301|POLYGON((5 25.98076,10 17.32051,20 17.32051,25 25.98076,20 34.64102,10 34.64102,5 25.98076))
302|POLYGON((-25 -8.66025,-20 -17.32051,-10 -17.32051,-5 -8.66025,-10 0,-20 0,-25 -8.66025))
@ -230,4 +230,4 @@ ERROR: ST_TileEnvelope: Margin must not be less than -50%, margin=-0.510000
313|0
314|676
315|0
316|t|LINESTRING(40 8.66025403784439,35 8.66025403784439)
316|t|LINESTRING(40 8.660254037844387,35 8.660254037844387)

View file

@ -95,7 +95,7 @@ symdifference|GEOMETRYCOLLECTION(LINESTRING(2 2,4 4),LINESTRING(10 10,20 20),POL
issimple|t
equals|t
pointonsurface|t
centroid|POINT(5.08333333333333 5.08333333333333)
centroid|POINT(5.083333333333333 5.083333333333333)
centroid2|POINT(0.5 0.8)
centroid3|POINT(0.5 1)
centroid4|POINT(0.5 1)

View file

@ -20,7 +20,7 @@ ERROR: Splitter line has linear intersection with input
40|SRID=10;GEOMETRYCOLLECTION(LINESTRING(0 0,5 0),LINESTRING(5 0,10 0),LINESTRING(0 5,10 5))
50|SRID=12;GEOMETRYCOLLECTION(POLYGON((5 0,0 0,0 10,5 10,5 8,2 8,2 6,5 6,5 4,2 4,2 2,5 2,5 0)),POLYGON((5 10,10 10,10 0,5 0,5 2,8 2,8 4,5 4,5 6,8 6,8 8,5 8,5 10)),POLYGON((20 0,20 10,30 10,30 0,20 0),(25 5,28 5,25 8,25 5)))
60|SRID=12;GEOMETRYCOLLECTION(POLYGON((5 0,0 0,0 10,5 10,5 8,2 8,2 6,5 6,5 4,2 4,2 2,5 2,5 0)),POLYGON((5 10,10 10,10 0,5 0,5 2,8 2,8 4,5 4,5 6,8 6,8 8,5 8,5 10)),POLYGON((20 0,20 10,30 10,30 0,20 0),(25 5,28 5,25 8,25 5)),LINESTRING(0 0,5 0),LINESTRING(5 0,10 0),LINESTRING(0 5,5 5),LINESTRING(5 5,10 5))
70|SRID=11;GEOMETRYCOLLECTION(LINESTRING(1691983.26 4874594.81 312.24,1691984.86 4874593.69 312.24,1691982 4874589.60428571 312.24),LINESTRING(1691982 4874589.60428571 312.24,1691981.30515131 4874588.61164472 312.24),LINESTRING(1691981.30515131 4874588.61164472 312.24,1691979.54 4874586.09 312.24,1691978.03 4874587.16 298.36))
70|SRID=11;GEOMETRYCOLLECTION(LINESTRING(1691983.26 4874594.81 312.24,1691984.86 4874593.69 312.24,1691982 4874589.604285714 312.24),LINESTRING(1691982 4874589.604285714 312.24,1691981.3051513054 4874588.611644722 312.24),LINESTRING(1691981.3051513054 4874588.611644722 312.24,1691979.54 4874586.09 312.24,1691978.03 4874587.16 298.36))
80|GEOMETRYCOLLECTION(LINESTRING(0 1,0 1,0 1))
81|GEOMETRYCOLLECTION(LINESTRING(0 1,0 1))
82|t

View file

@ -178,20 +178,20 @@ SELECT 'asewkb02', encode(ST_AsEWKB(the_geom_3dm, 'xdr'), 'hex') FROM public.cir
SELECT 'asewkb03', encode(ST_AsEWKB(the_geom_3dz, 'ndr'), 'hex') FROM public.circularstring;
SELECT 'asewkb04', encode(ST_AsEWKB(the_geom_4d, 'xdr'), 'hex') FROM public.circularstring;
SELECT 'ST_CurveToLine-201', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_2d, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine-202', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_3dm, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine-203', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_3dz, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine-204', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_4d, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine-201', ST_AsText(ST_CurveToLine(the_geom_2d, 2), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine-202', ST_AsText(ST_CurveToLine(the_geom_3dm, 2), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine-203', ST_AsText(ST_CurveToLine(the_geom_3dz, 2), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine-204', ST_AsText(ST_CurveToLine(the_geom_4d, 2), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine-401', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_2d, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine-402', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_3dm, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine-403', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_3dz, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine-404', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_4d, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine-401', ST_AsText(ST_CurveToLine(the_geom_2d, 4), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine-402', ST_AsText(ST_CurveToLine(the_geom_3dm, 4), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine-403', ST_AsText(ST_CurveToLine(the_geom_3dz, 4), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine-404', ST_AsText(ST_CurveToLine(the_geom_4d, 4), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine01', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_2d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine02', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_3dm), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine03', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_3dz), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine04', ST_AsEWKT( ST_SnapToGrid(ST_CurveToLine(the_geom_4d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'ST_CurveToLine01', ST_AsText(ST_CurveToLine(the_geom_2d), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine02', ST_AsText(ST_CurveToLine(the_geom_3dm), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine03', ST_AsText(ST_CurveToLine(the_geom_3dz), 8) FROM public.circularstring;
SELECT 'ST_CurveToLine04', ST_AsText(ST_CurveToLine(the_geom_4d), 8) FROM public.circularstring;
-- TODO: ST_SnapToGrid is required to remove platform dependent precision
-- issues. Until ST_SnapToGrid is updated to work against curves, these
@ -221,14 +221,14 @@ SELECT 'accessors02', ST_IsEmpty(the_geom_3dm), ST_IsSimple(the_geom_3dm), ST_Is
SELECT 'accessors03', ST_IsEmpty(the_geom_3dz), ST_IsSimple(the_geom_3dz), ST_IsClosed(the_geom_3dz), ST_IsRing(the_geom_3dz) FROM public.circularstring;
SELECT 'accessors04', ST_IsEmpty(the_geom_4d), ST_IsSimple(the_geom_4d), ST_IsClosed(the_geom_4d), ST_IsRing(the_geom_4d) FROM public.circularstring;
SELECT 'envelope01', ST_AsText(ST_SnapToGrid(ST_Envelope(the_geom_2d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'envelope02', ST_AsText(ST_SnapToGrid(ST_Envelope(the_geom_3dm), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'envelope03', ST_AsText(ST_SnapToGrid(ST_Envelope(the_geom_3dz), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'envelope04', ST_AsText(ST_SnapToGrid(ST_Envelope(the_geom_4d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.circularstring;
SELECT 'envelope01', ST_AsText(ST_Envelope(the_geom_2d), 8) FROM public.circularstring;
SELECT 'envelope02', ST_AsText(ST_Envelope(the_geom_3dm), 8) FROM public.circularstring;
SELECT 'envelope03', ST_AsText(ST_Envelope(the_geom_3dz), 8) FROM public.circularstring;
SELECT 'envelope04', ST_AsText(ST_Envelope(the_geom_4d), 8) FROM public.circularstring;
DROP TABLE public.circularstring;
SELECT ST_AsText(ST_SnapToGrid(box2d('CIRCULARSTRING(220268.439465645 150415.359530563,220227.333322076 150505.561285879,220227.353105332 150406.434743975)'::geometry),0.0001));
SELECT ST_AsText(box2d('CIRCULARSTRING(220268.439465645 150415.359530563,220227.333322076 150505.561285879,220227.353105332 150406.434743975)'::geometry), 4);
SELECT 'npoints_is_five', ST_NumPoints(ST_GeomFromEWKT('CIRCULARSTRING(0 0,2 0, 2 1, 2 3, 4 3)'));
-- See http://trac.osgeo.org/postgis/ticket/2410

View file

@ -12,21 +12,21 @@ isRing01|t
isClosed02|t
isSimple02|f
isRing02|f
astext01|CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.4142135623731)
astext01|CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.414213562373095)
astext01|CIRCULARSTRING(-5 0,0 5,5 0,10 -5,15 0)
astext02|CIRCULARSTRING M (0 0 0,0.267949192431123 1 -2,0.585786437626905 1.4142135623731 2)
astext02|CIRCULARSTRING M (0 0 0,0.267949192431123 1 -2,0.585786437626905 1.414213562373095 2)
astext02|CIRCULARSTRING M (-5 0 4,0 5 3,5 0 2,10 -5 1,15 0 0)
astext03|CIRCULARSTRING Z (0 0 0,0.267949192431123 1 3,0.585786437626905 1.4142135623731 1)
astext03|CIRCULARSTRING Z (0 0 0,0.267949192431123 1 3,0.585786437626905 1.414213562373095 1)
astext03|CIRCULARSTRING Z (-5 0 0,0 5 1,5 0 2,10 -5 3,15 0 4)
astext04|CIRCULARSTRING ZM (0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.4142135623731 1 2)
astext04|CIRCULARSTRING ZM (0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.414213562373095 1 2)
astext04|CIRCULARSTRING ZM (-5 0 0 4,0 5 1 3,5 0 2 2,10 -5 3 1,15 0 4 0)
asewkt01|CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.4142135623731)
asewkt01|CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.414213562373095)
asewkt01|CIRCULARSTRING(-5 0,0 5,5 0,10 -5,15 0)
asewkt02|CIRCULARSTRINGM(0 0 0,0.267949192431123 1 -2,0.585786437626905 1.4142135623731 2)
asewkt02|CIRCULARSTRINGM(0 0 0,0.267949192431123 1 -2,0.585786437626905 1.414213562373095 2)
asewkt02|CIRCULARSTRINGM(-5 0 4,0 5 3,5 0 2,10 -5 1,15 0 0)
asewkt03|CIRCULARSTRING(0 0 0,0.267949192431123 1 3,0.585786437626905 1.4142135623731 1)
asewkt03|CIRCULARSTRING(0 0 0,0.267949192431123 1 3,0.585786437626905 1.414213562373095 1)
asewkt03|CIRCULARSTRING(-5 0 0,0 5 1,5 0 2,10 -5 3,15 0 4)
asewkt04|CIRCULARSTRING(0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.4142135623731 1 2)
asewkt04|CIRCULARSTRING(0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.414213562373095 1 2)
asewkt04|CIRCULARSTRING(-5 0 0 4,0 5 1 3,5 0 2 2,10 -5 3 1,15 0 4 0)
asbinary01|0108000000030000000000000000000000000000000000000056cd9e5e1426d13f000000000000f03f67880133c3bee23fcd3b7f669ea0f63f
asbinary01|01080000000500000000000000000014c000000000000000000000000000000000000000000000144000000000000014400000000000000000000000000000244000000000000014c00000000000002e400000000000000000
@ -45,29 +45,29 @@ asewkb03|01080000800500000000000000000014c00000000000000000000000000000000000000
asewkb04|00c00000080000000300000000000000000000000000000000000000000000000000000000000000003fd126145e9ecd563ff00000000000004008000000000000c0000000000000003fe2bec3330188673ff6a09e667f3bcd3ff00000000000004000000000000000
asewkb04|00c000000800000005c014000000000000000000000000000000000000000000004010000000000000000000000000000040140000000000003ff0000000000000400800000000000040140000000000000000000000000000400000000000000040000000000000004024000000000000c01400000000000040080000000000003ff0000000000000402e000000000000000000000000000040100000000000000000000000000000
ST_CurveToLine-201|LINESTRING(0 0,0.15224093 0.76536686,0.58578644 1.41421356)
ST_CurveToLine-201|LINESTRING(-5 0,-3.53553391 3.53553391,0 5,3.53553391 3.53553391,5 0,6.46446609 -3.53553391,10 -5,13.53553391 -3.53553391,15 0)
ST_CurveToLine-202|LINESTRINGM(0 0 0,0.15224093 0.76536686 -1.5,0.58578644 1.41421356 2)
ST_CurveToLine-202|LINESTRINGM(-5 0 4,-3.53553391 3.53553391 3.5,0 5 3,3.53553391 3.53553391 2.5,5 0 2,6.46446609 -3.53553391 1.5,10 -5 1,13.53553391 -3.53553391 0.5,15 0 0)
ST_CurveToLine-203|LINESTRING(0 0 0,0.15224093 0.76536686 2.25,0.58578644 1.41421356 1)
ST_CurveToLine-203|LINESTRING(-5 0 0,-3.53553391 3.53553391 0.5,0 5 1,3.53553391 3.53553391 1.5,5 0 2,6.46446609 -3.53553391 2.5,10 -5 3,13.53553391 -3.53553391 3.5,15 0 4)
ST_CurveToLine-204|LINESTRING(0 0 0 0,0.15224093 0.76536686 2.25 -1.5,0.58578644 1.41421356 1 2)
ST_CurveToLine-204|LINESTRING(-5 0 0 4,-3.53553391 3.53553391 0.5 3.5,0 5 1 3,3.53553391 3.53553391 1.5 2.5,5 0 2 2,6.46446609 -3.53553391 2.5 1.5,10 -5 3 1,13.53553391 -3.53553391 3.5 0.5,15 0 4 0)
ST_CurveToLine-201|LINESTRING(-5 0,-3.53553391 3.53553391,3.061617e-16 5,3.53553391 3.53553391,5 0,6.46446609 -3.53553391,10 -5,13.53553391 -3.53553391,15 0)
ST_CurveToLine-202|LINESTRING M (0 0 0,0.15224093 0.76536686 -1.5,0.58578644 1.41421356 2)
ST_CurveToLine-202|LINESTRING M (-5 0 4,-3.53553391 3.53553391 3.5,3.061617e-16 5 3,3.53553391 3.53553391 2.5,5 0 2,6.46446609 -3.53553391 1.5,10 -5 1,13.53553391 -3.53553391 0.5,15 0 0)
ST_CurveToLine-203|LINESTRING Z (0 0 0,0.15224093 0.76536686 2.25,0.58578644 1.41421356 1)
ST_CurveToLine-203|LINESTRING Z (-5 0 0,-3.53553391 3.53553391 0.5,3.061617e-16 5 1,3.53553391 3.53553391 1.5,5 0 2,6.46446609 -3.53553391 2.5,10 -5 3,13.53553391 -3.53553391 3.5,15 0 4)
ST_CurveToLine-204|LINESTRING ZM (0 0 0 0,0.15224093 0.76536686 2.25 -1.5,0.58578644 1.41421356 1 2)
ST_CurveToLine-204|LINESTRING ZM (-5 0 0 4,-3.53553391 3.53553391 0.5 3.5,3.061617e-16 5 1 3,3.53553391 3.53553391 1.5 2.5,5 0 2 2,6.46446609 -3.53553391 2.5 1.5,10 -5 3 1,13.53553391 -3.53553391 3.5 0.5,15 0 4 0)
ST_CurveToLine-401|LINESTRING(0 0,0.15224093 0.76536686,0.58578644 1.41421356)
ST_CurveToLine-401|LINESTRING(-5 0,-4.61939766 1.91341716,-3.53553391 3.53553391,-1.91341716 4.61939766,0 5,1.91341716 4.61939766,3.53553391 3.53553391,4.61939766 1.91341716,5 0,5.38060234 -1.91341716,6.46446609 -3.53553391,8.08658284 -4.61939766,10 -5,11.91341716 -4.61939766,13.53553391 -3.53553391,14.61939766 -1.91341716,15 0)
ST_CurveToLine-402|LINESTRINGM(0 0 0,0.15224093 0.76536686 -1.5,0.58578644 1.41421356 2)
ST_CurveToLine-402|LINESTRINGM(-5 0 4,-4.61939766 1.91341716 3.75,-3.53553391 3.53553391 3.5,-1.91341716 4.61939766 3.25,0 5 3,1.91341716 4.61939766 2.75,3.53553391 3.53553391 2.5,4.61939766 1.91341716 2.25,5 0 2,5.38060234 -1.91341716 1.75,6.46446609 -3.53553391 1.5,8.08658284 -4.61939766 1.25,10 -5 1,11.91341716 -4.61939766 0.75,13.53553391 -3.53553391 0.5,14.61939766 -1.91341716 0.25,15 0 0)
ST_CurveToLine-403|LINESTRING(0 0 0,0.15224093 0.76536686 2.25,0.58578644 1.41421356 1)
ST_CurveToLine-403|LINESTRING(-5 0 0,-4.61939766 1.91341716 0.25,-3.53553391 3.53553391 0.5,-1.91341716 4.61939766 0.75,0 5 1,1.91341716 4.61939766 1.25,3.53553391 3.53553391 1.5,4.61939766 1.91341716 1.75,5 0 2,5.38060234 -1.91341716 2.25,6.46446609 -3.53553391 2.5,8.08658284 -4.61939766 2.75,10 -5 3,11.91341716 -4.61939766 3.25,13.53553391 -3.53553391 3.5,14.61939766 -1.91341716 3.75,15 0 4)
ST_CurveToLine-404|LINESTRING(0 0 0 0,0.15224093 0.76536686 2.25 -1.5,0.58578644 1.41421356 1 2)
ST_CurveToLine-404|LINESTRING(-5 0 0 4,-4.61939766 1.91341716 0.25 3.75,-3.53553391 3.53553391 0.5 3.5,-1.91341716 4.61939766 0.75 3.25,0 5 1 3,1.91341716 4.61939766 1.25 2.75,3.53553391 3.53553391 1.5 2.5,4.61939766 1.91341716 1.75 2.25,5 0 2 2,5.38060234 -1.91341716 2.25 1.75,6.46446609 -3.53553391 2.5 1.5,8.08658284 -4.61939766 2.75 1.25,10 -5 3 1,11.91341716 -4.61939766 3.25 0.75,13.53553391 -3.53553391 3.5 0.5,14.61939766 -1.91341716 3.75 0.25,15 0 4 0)
ST_CurveToLine-401|LINESTRING(-5 0,-4.61939766 1.91341716,-3.53553391 3.53553391,-1.91341716 4.61939766,3.061617e-16 5,1.91341716 4.61939766,3.53553391 3.53553391,4.61939766 1.91341716,5 0,5.38060234 -1.91341716,6.46446609 -3.53553391,8.08658284 -4.61939766,10 -5,11.91341716 -4.61939766,13.53553391 -3.53553391,14.61939766 -1.91341716,15 0)
ST_CurveToLine-402|LINESTRING M (0 0 0,0.15224093 0.76536686 -1.5,0.58578644 1.41421356 2)
ST_CurveToLine-402|LINESTRING M (-5 0 4,-4.61939766 1.91341716 3.75,-3.53553391 3.53553391 3.5,-1.91341716 4.61939766 3.25,3.061617e-16 5 3,1.91341716 4.61939766 2.75,3.53553391 3.53553391 2.5,4.61939766 1.91341716 2.25,5 0 2,5.38060234 -1.91341716 1.75,6.46446609 -3.53553391 1.5,8.08658284 -4.61939766 1.25,10 -5 1,11.91341716 -4.61939766 0.75,13.53553391 -3.53553391 0.5,14.61939766 -1.91341716 0.25,15 0 0)
ST_CurveToLine-403|LINESTRING Z (0 0 0,0.15224093 0.76536686 2.25,0.58578644 1.41421356 1)
ST_CurveToLine-403|LINESTRING Z (-5 0 0,-4.61939766 1.91341716 0.25,-3.53553391 3.53553391 0.5,-1.91341716 4.61939766 0.75,3.061617e-16 5 1,1.91341716 4.61939766 1.25,3.53553391 3.53553391 1.5,4.61939766 1.91341716 1.75,5 0 2,5.38060234 -1.91341716 2.25,6.46446609 -3.53553391 2.5,8.08658284 -4.61939766 2.75,10 -5 3,11.91341716 -4.61939766 3.25,13.53553391 -3.53553391 3.5,14.61939766 -1.91341716 3.75,15 0 4)
ST_CurveToLine-404|LINESTRING ZM (0 0 0 0,0.15224093 0.76536686 2.25 -1.5,0.58578644 1.41421356 1 2)
ST_CurveToLine-404|LINESTRING ZM (-5 0 0 4,-4.61939766 1.91341716 0.25 3.75,-3.53553391 3.53553391 0.5 3.5,-1.91341716 4.61939766 0.75 3.25,3.061617e-16 5 1 3,1.91341716 4.61939766 1.25 2.75,3.53553391 3.53553391 1.5 2.5,4.61939766 1.91341716 1.75 2.25,5 0 2 2,5.38060234 -1.91341716 2.25 1.75,6.46446609 -3.53553391 2.5 1.5,8.08658284 -4.61939766 2.75 1.25,10 -5 3 1,11.91341716 -4.61939766 3.25 0.75,13.53553391 -3.53553391 3.5 0.5,14.61939766 -1.91341716 3.75 0.25,15 0 4 0)
ST_CurveToLine01|LINESTRING(0 0,0.00240909 0.09813535,0.00963055 0.19603428,0.02164698 0.29346095,0.03842944 0.39018064,0.05993749 0.48596036,0.08611933 0.58056935,0.11691187 0.67377971,0.15224093 0.76536686,0.19202141 0.85511019,0.23615747 0.94279347,0.28454278 1.02820549,0.33706078 1.11114047,0.39358494 1.19139861,0.45397909 1.26878657,0.51809775 1.34311791,0.58578644 1.41421356)
ST_CurveToLine01|LINESTRING(-5 0,-4.99397728 0.24533837,-4.97592363 0.4900857,-4.94588255 0.73365237,-4.9039264 0.97545161,-4.85015627 1.2149009,-4.78470168 1.45142339,-4.70772033 1.68444927,-4.61939766 1.91341716,-4.51994647 2.13777547,-4.40960632 2.35698368,-4.28864305 2.57051372,-4.15734806 2.77785117,-4.01603766 2.97849652,-3.86505227 3.17196642,-3.70475563 3.35779477,-3.53553391 3.53553391,-3.35779477 3.70475563,-3.17196642 3.86505227,-2.97849652 4.01603766,-2.77785117 4.15734806,-2.57051372 4.28864305,-2.35698368 4.40960632,-2.13777547 4.51994647,-1.91341716 4.61939766,-1.68444927 4.70772033,-1.45142339 4.78470168,-1.2149009 4.85015627,-0.97545161 4.9039264,-0.73365237 4.94588255,-0.4900857 4.97592363,-0.24533837 4.99397728,0 5,0.24533837 4.99397728,0.4900857 4.97592363,0.73365237 4.94588255,0.97545161 4.9039264,1.2149009 4.85015627,1.45142339 4.78470168,1.68444927 4.70772033,1.91341716 4.61939766,2.13777547 4.51994647,2.35698368 4.40960632,2.57051372 4.28864305,2.77785117 4.15734806,2.97849652 4.01603766,3.17196642 3.86505227,3.35779477 3.70475563,3.53553391 3.53553391,3.70475563 3.35779477,3.86505227 3.17196642,4.01603766 2.97849652,4.15734806 2.77785117,4.28864305 2.57051372,4.40960632 2.35698368,4.51994647 2.13777547,4.61939766 1.91341716,4.70772033 1.68444927,4.78470168 1.45142339,4.85015627 1.2149009,4.9039264 0.97545161,4.94588255 0.73365237,4.97592363 0.4900857,4.99397728 0.24533837,5 0,5.00602272 -0.24533837,5.02407637 -0.4900857,5.05411745 -0.73365237,5.0960736 -0.97545161,5.14984373 -1.2149009,5.21529832 -1.45142339,5.29227967 -1.68444927,5.38060234 -1.91341716,5.48005353 -2.13777547,5.59039368 -2.35698368,5.71135695 -2.57051372,5.84265194 -2.77785117,5.98396234 -2.97849652,6.13494773 -3.17196642,6.29524437 -3.35779477,6.46446609 -3.53553391,6.64220523 -3.70475563,6.82803358 -3.86505227,7.02150348 -4.01603766,7.22214883 -4.15734806,7.42948628 -4.28864305,7.64301632 -4.40960632,7.86222453 -4.51994647,8.08658284 -4.61939766,8.31555073 -4.70772033,8.54857661 -4.78470168,8.7850991 -4.85015627,9.02454839 -4.9039264,9.26634763 -4.94588255,9.5099143 -4.97592363,9.75466163 -4.99397728,10 -5,10.24533837 -4.99397728,10.4900857 -4.97592363,10.73365237 -4.94588255,10.97545161 -4.9039264,11.2149009 -4.85015627,11.45142339 -4.78470168,11.68444927 -4.70772033,11.91341716 -4.61939766,12.13777547 -4.51994647,12.35698368 -4.40960632,12.57051372 -4.28864305,12.77785117 -4.15734806,12.97849652 -4.01603766,13.17196642 -3.86505227,13.35779477 -3.70475563,13.53553391 -3.53553391,13.70475563 -3.35779477,13.86505227 -3.17196642,14.01603766 -2.97849652,14.15734806 -2.77785117,14.28864305 -2.57051372,14.40960632 -2.35698368,14.51994647 -2.13777547,14.61939766 -1.91341716,14.70772033 -1.68444927,14.78470168 -1.45142339,14.85015627 -1.2149009,14.9039264 -0.97545161,14.94588255 -0.73365237,14.97592363 -0.4900857,14.99397728 -0.24533837,15 0)
ST_CurveToLine02|LINESTRINGM(0 0 0,0.00240909 0.09813535 -0.1875,0.00963055 0.19603428 -0.375,0.02164698 0.29346095 -0.5625,0.03842944 0.39018064 -0.75,0.05993749 0.48596036 -0.9375,0.08611933 0.58056935 -1.125,0.11691187 0.67377971 -1.3125,0.15224093 0.76536686 -1.5,0.19202141 0.85511019 -1.6875,0.23615747 0.94279347 -1.875,0.28454278 1.02820549 -1.75,0.33706078 1.11114047 -1,0.39358494 1.19139861 -0.25,0.45397909 1.26878657 0.5,0.51809775 1.34311791 1.25,0.58578644 1.41421356 2)
ST_CurveToLine02|LINESTRINGM(-5 0 4,-4.99397728 0.24533837 3.96875,-4.97592363 0.4900857 3.9375,-4.94588255 0.73365237 3.90625,-4.9039264 0.97545161 3.875,-4.85015627 1.2149009 3.84375,-4.78470168 1.45142339 3.8125,-4.70772033 1.68444927 3.78125,-4.61939766 1.91341716 3.75,-4.51994647 2.13777547 3.71875,-4.40960632 2.35698368 3.6875,-4.28864305 2.57051372 3.65625,-4.15734806 2.77785117 3.625,-4.01603766 2.97849652 3.59375,-3.86505227 3.17196642 3.5625,-3.70475563 3.35779477 3.53125,-3.53553391 3.53553391 3.5,-3.35779477 3.70475563 3.46875,-3.17196642 3.86505227 3.4375,-2.97849652 4.01603766 3.40625,-2.77785117 4.15734806 3.375,-2.57051372 4.28864305 3.34375,-2.35698368 4.40960632 3.3125,-2.13777547 4.51994647 3.28125,-1.91341716 4.61939766 3.25,-1.68444927 4.70772033 3.21875,-1.45142339 4.78470168 3.1875,-1.2149009 4.85015627 3.15625,-0.97545161 4.9039264 3.125,-0.73365237 4.94588255 3.09375,-0.4900857 4.97592363 3.0625,-0.24533837 4.99397728 3.03125,0 5 3,0.24533837 4.99397728 2.96875,0.4900857 4.97592363 2.9375,0.73365237 4.94588255 2.90625,0.97545161 4.9039264 2.875,1.2149009 4.85015627 2.84375,1.45142339 4.78470168 2.8125,1.68444927 4.70772033 2.78125,1.91341716 4.61939766 2.75,2.13777547 4.51994647 2.71875,2.35698368 4.40960632 2.6875,2.57051372 4.28864305 2.65625,2.77785117 4.15734806 2.625,2.97849652 4.01603766 2.59375,3.17196642 3.86505227 2.5625,3.35779477 3.70475563 2.53125,3.53553391 3.53553391 2.5,3.70475563 3.35779477 2.46875,3.86505227 3.17196642 2.4375,4.01603766 2.97849652 2.40625,4.15734806 2.77785117 2.375,4.28864305 2.57051372 2.34375,4.40960632 2.35698368 2.3125,4.51994647 2.13777547 2.28125,4.61939766 1.91341716 2.25,4.70772033 1.68444927 2.21875,4.78470168 1.45142339 2.1875,4.85015627 1.2149009 2.15625,4.9039264 0.97545161 2.125,4.94588255 0.73365237 2.09375,4.97592363 0.4900857 2.0625,4.99397728 0.24533837 2.03125,5 0 2,5.00602272 -0.24533837 1.96875,5.02407637 -0.4900857 1.9375,5.05411745 -0.73365237 1.90625,5.0960736 -0.97545161 1.875,5.14984373 -1.2149009 1.84375,5.21529832 -1.45142339 1.8125,5.29227967 -1.68444927 1.78125,5.38060234 -1.91341716 1.75,5.48005353 -2.13777547 1.71875,5.59039368 -2.35698368 1.6875,5.71135695 -2.57051372 1.65625,5.84265194 -2.77785117 1.625,5.98396234 -2.97849652 1.59375,6.13494773 -3.17196642 1.5625,6.29524437 -3.35779477 1.53125,6.46446609 -3.53553391 1.5,6.64220523 -3.70475563 1.46875,6.82803358 -3.86505227 1.4375,7.02150348 -4.01603766 1.40625,7.22214883 -4.15734806 1.375,7.42948628 -4.28864305 1.34375,7.64301632 -4.40960632 1.3125,7.86222453 -4.51994647 1.28125,8.08658284 -4.61939766 1.25,8.31555073 -4.70772033 1.21875,8.54857661 -4.78470168 1.1875,8.7850991 -4.85015627 1.15625,9.02454839 -4.9039264 1.125,9.26634763 -4.94588255 1.09375,9.5099143 -4.97592363 1.0625,9.75466163 -4.99397728 1.03125,10 -5 1,10.24533837 -4.99397728 0.96875,10.4900857 -4.97592363 0.9375,10.73365237 -4.94588255 0.90625,10.97545161 -4.9039264 0.875,11.2149009 -4.85015627 0.84375,11.45142339 -4.78470168 0.8125,11.68444927 -4.70772033 0.78125,11.91341716 -4.61939766 0.75,12.13777547 -4.51994647 0.71875,12.35698368 -4.40960632 0.6875,12.57051372 -4.28864305 0.65625,12.77785117 -4.15734806 0.625,12.97849652 -4.01603766 0.59375,13.17196642 -3.86505227 0.5625,13.35779477 -3.70475563 0.53125,13.53553391 -3.53553391 0.5,13.70475563 -3.35779477 0.46875,13.86505227 -3.17196642 0.4375,14.01603766 -2.97849652 0.40625,14.15734806 -2.77785117 0.375,14.28864305 -2.57051372 0.34375,14.40960632 -2.35698368 0.3125,14.51994647 -2.13777547 0.28125,14.61939766 -1.91341716 0.25,14.70772033 -1.68444927 0.21875,14.78470168 -1.45142339 0.1875,14.85015627 -1.2149009 0.15625,14.9039264 -0.97545161 0.125,14.94588255 -0.73365237 0.09375,14.97592363 -0.4900857 0.0625,14.99397728 -0.24533837 0.03125,15 0 0)
ST_CurveToLine03|LINESTRING(0 0 0,0.00240909 0.09813535 0.28125,0.00963055 0.19603428 0.5625,0.02164698 0.29346095 0.84375,0.03842944 0.39018064 1.125,0.05993749 0.48596036 1.40625,0.08611933 0.58056935 1.6875,0.11691187 0.67377971 1.96875,0.15224093 0.76536686 2.25,0.19202141 0.85511019 2.53125,0.23615747 0.94279347 2.8125,0.28454278 1.02820549 2.875,0.33706078 1.11114047 2.5,0.39358494 1.19139861 2.125,0.45397909 1.26878657 1.75,0.51809775 1.34311791 1.375,0.58578644 1.41421356 1)
ST_CurveToLine03|LINESTRING(-5 0 0,-4.99397728 0.24533837 0.03125,-4.97592363 0.4900857 0.0625,-4.94588255 0.73365237 0.09375,-4.9039264 0.97545161 0.125,-4.85015627 1.2149009 0.15625,-4.78470168 1.45142339 0.1875,-4.70772033 1.68444927 0.21875,-4.61939766 1.91341716 0.25,-4.51994647 2.13777547 0.28125,-4.40960632 2.35698368 0.3125,-4.28864305 2.57051372 0.34375,-4.15734806 2.77785117 0.375,-4.01603766 2.97849652 0.40625,-3.86505227 3.17196642 0.4375,-3.70475563 3.35779477 0.46875,-3.53553391 3.53553391 0.5,-3.35779477 3.70475563 0.53125,-3.17196642 3.86505227 0.5625,-2.97849652 4.01603766 0.59375,-2.77785117 4.15734806 0.625,-2.57051372 4.28864305 0.65625,-2.35698368 4.40960632 0.6875,-2.13777547 4.51994647 0.71875,-1.91341716 4.61939766 0.75,-1.68444927 4.70772033 0.78125,-1.45142339 4.78470168 0.8125,-1.2149009 4.85015627 0.84375,-0.97545161 4.9039264 0.875,-0.73365237 4.94588255 0.90625,-0.4900857 4.97592363 0.9375,-0.24533837 4.99397728 0.96875,0 5 1,0.24533837 4.99397728 1.03125,0.4900857 4.97592363 1.0625,0.73365237 4.94588255 1.09375,0.97545161 4.9039264 1.125,1.2149009 4.85015627 1.15625,1.45142339 4.78470168 1.1875,1.68444927 4.70772033 1.21875,1.91341716 4.61939766 1.25,2.13777547 4.51994647 1.28125,2.35698368 4.40960632 1.3125,2.57051372 4.28864305 1.34375,2.77785117 4.15734806 1.375,2.97849652 4.01603766 1.40625,3.17196642 3.86505227 1.4375,3.35779477 3.70475563 1.46875,3.53553391 3.53553391 1.5,3.70475563 3.35779477 1.53125,3.86505227 3.17196642 1.5625,4.01603766 2.97849652 1.59375,4.15734806 2.77785117 1.625,4.28864305 2.57051372 1.65625,4.40960632 2.35698368 1.6875,4.51994647 2.13777547 1.71875,4.61939766 1.91341716 1.75,4.70772033 1.68444927 1.78125,4.78470168 1.45142339 1.8125,4.85015627 1.2149009 1.84375,4.9039264 0.97545161 1.875,4.94588255 0.73365237 1.90625,4.97592363 0.4900857 1.9375,4.99397728 0.24533837 1.96875,5 0 2,5.00602272 -0.24533837 2.03125,5.02407637 -0.4900857 2.0625,5.05411745 -0.73365237 2.09375,5.0960736 -0.97545161 2.125,5.14984373 -1.2149009 2.15625,5.21529832 -1.45142339 2.1875,5.29227967 -1.68444927 2.21875,5.38060234 -1.91341716 2.25,5.48005353 -2.13777547 2.28125,5.59039368 -2.35698368 2.3125,5.71135695 -2.57051372 2.34375,5.84265194 -2.77785117 2.375,5.98396234 -2.97849652 2.40625,6.13494773 -3.17196642 2.4375,6.29524437 -3.35779477 2.46875,6.46446609 -3.53553391 2.5,6.64220523 -3.70475563 2.53125,6.82803358 -3.86505227 2.5625,7.02150348 -4.01603766 2.59375,7.22214883 -4.15734806 2.625,7.42948628 -4.28864305 2.65625,7.64301632 -4.40960632 2.6875,7.86222453 -4.51994647 2.71875,8.08658284 -4.61939766 2.75,8.31555073 -4.70772033 2.78125,8.54857661 -4.78470168 2.8125,8.7850991 -4.85015627 2.84375,9.02454839 -4.9039264 2.875,9.26634763 -4.94588255 2.90625,9.5099143 -4.97592363 2.9375,9.75466163 -4.99397728 2.96875,10 -5 3,10.24533837 -4.99397728 3.03125,10.4900857 -4.97592363 3.0625,10.73365237 -4.94588255 3.09375,10.97545161 -4.9039264 3.125,11.2149009 -4.85015627 3.15625,11.45142339 -4.78470168 3.1875,11.68444927 -4.70772033 3.21875,11.91341716 -4.61939766 3.25,12.13777547 -4.51994647 3.28125,12.35698368 -4.40960632 3.3125,12.57051372 -4.28864305 3.34375,12.77785117 -4.15734806 3.375,12.97849652 -4.01603766 3.40625,13.17196642 -3.86505227 3.4375,13.35779477 -3.70475563 3.46875,13.53553391 -3.53553391 3.5,13.70475563 -3.35779477 3.53125,13.86505227 -3.17196642 3.5625,14.01603766 -2.97849652 3.59375,14.15734806 -2.77785117 3.625,14.28864305 -2.57051372 3.65625,14.40960632 -2.35698368 3.6875,14.51994647 -2.13777547 3.71875,14.61939766 -1.91341716 3.75,14.70772033 -1.68444927 3.78125,14.78470168 -1.45142339 3.8125,14.85015627 -1.2149009 3.84375,14.9039264 -0.97545161 3.875,14.94588255 -0.73365237 3.90625,14.97592363 -0.4900857 3.9375,14.99397728 -0.24533837 3.96875,15 0 4)
ST_CurveToLine04|LINESTRING(0 0 0 0,0.00240909 0.09813535 0.28125 -0.1875,0.00963055 0.19603428 0.5625 -0.375,0.02164698 0.29346095 0.84375 -0.5625,0.03842944 0.39018064 1.125 -0.75,0.05993749 0.48596036 1.40625 -0.9375,0.08611933 0.58056935 1.6875 -1.125,0.11691187 0.67377971 1.96875 -1.3125,0.15224093 0.76536686 2.25 -1.5,0.19202141 0.85511019 2.53125 -1.6875,0.23615747 0.94279347 2.8125 -1.875,0.28454278 1.02820549 2.875 -1.75,0.33706078 1.11114047 2.5 -1,0.39358494 1.19139861 2.125 -0.25,0.45397909 1.26878657 1.75 0.5,0.51809775 1.34311791 1.375 1.25,0.58578644 1.41421356 1 2)
ST_CurveToLine04|LINESTRING(-5 0 0 4,-4.99397728 0.24533837 0.03125 3.96875,-4.97592363 0.4900857 0.0625 3.9375,-4.94588255 0.73365237 0.09375 3.90625,-4.9039264 0.97545161 0.125 3.875,-4.85015627 1.2149009 0.15625 3.84375,-4.78470168 1.45142339 0.1875 3.8125,-4.70772033 1.68444927 0.21875 3.78125,-4.61939766 1.91341716 0.25 3.75,-4.51994647 2.13777547 0.28125 3.71875,-4.40960632 2.35698368 0.3125 3.6875,-4.28864305 2.57051372 0.34375 3.65625,-4.15734806 2.77785117 0.375 3.625,-4.01603766 2.97849652 0.40625 3.59375,-3.86505227 3.17196642 0.4375 3.5625,-3.70475563 3.35779477 0.46875 3.53125,-3.53553391 3.53553391 0.5 3.5,-3.35779477 3.70475563 0.53125 3.46875,-3.17196642 3.86505227 0.5625 3.4375,-2.97849652 4.01603766 0.59375 3.40625,-2.77785117 4.15734806 0.625 3.375,-2.57051372 4.28864305 0.65625 3.34375,-2.35698368 4.40960632 0.6875 3.3125,-2.13777547 4.51994647 0.71875 3.28125,-1.91341716 4.61939766 0.75 3.25,-1.68444927 4.70772033 0.78125 3.21875,-1.45142339 4.78470168 0.8125 3.1875,-1.2149009 4.85015627 0.84375 3.15625,-0.97545161 4.9039264 0.875 3.125,-0.73365237 4.94588255 0.90625 3.09375,-0.4900857 4.97592363 0.9375 3.0625,-0.24533837 4.99397728 0.96875 3.03125,0 5 1 3,0.24533837 4.99397728 1.03125 2.96875,0.4900857 4.97592363 1.0625 2.9375,0.73365237 4.94588255 1.09375 2.90625,0.97545161 4.9039264 1.125 2.875,1.2149009 4.85015627 1.15625 2.84375,1.45142339 4.78470168 1.1875 2.8125,1.68444927 4.70772033 1.21875 2.78125,1.91341716 4.61939766 1.25 2.75,2.13777547 4.51994647 1.28125 2.71875,2.35698368 4.40960632 1.3125 2.6875,2.57051372 4.28864305 1.34375 2.65625,2.77785117 4.15734806 1.375 2.625,2.97849652 4.01603766 1.40625 2.59375,3.17196642 3.86505227 1.4375 2.5625,3.35779477 3.70475563 1.46875 2.53125,3.53553391 3.53553391 1.5 2.5,3.70475563 3.35779477 1.53125 2.46875,3.86505227 3.17196642 1.5625 2.4375,4.01603766 2.97849652 1.59375 2.40625,4.15734806 2.77785117 1.625 2.375,4.28864305 2.57051372 1.65625 2.34375,4.40960632 2.35698368 1.6875 2.3125,4.51994647 2.13777547 1.71875 2.28125,4.61939766 1.91341716 1.75 2.25,4.70772033 1.68444927 1.78125 2.21875,4.78470168 1.45142339 1.8125 2.1875,4.85015627 1.2149009 1.84375 2.15625,4.9039264 0.97545161 1.875 2.125,4.94588255 0.73365237 1.90625 2.09375,4.97592363 0.4900857 1.9375 2.0625,4.99397728 0.24533837 1.96875 2.03125,5 0 2 2,5.00602272 -0.24533837 2.03125 1.96875,5.02407637 -0.4900857 2.0625 1.9375,5.05411745 -0.73365237 2.09375 1.90625,5.0960736 -0.97545161 2.125 1.875,5.14984373 -1.2149009 2.15625 1.84375,5.21529832 -1.45142339 2.1875 1.8125,5.29227967 -1.68444927 2.21875 1.78125,5.38060234 -1.91341716 2.25 1.75,5.48005353 -2.13777547 2.28125 1.71875,5.59039368 -2.35698368 2.3125 1.6875,5.71135695 -2.57051372 2.34375 1.65625,5.84265194 -2.77785117 2.375 1.625,5.98396234 -2.97849652 2.40625 1.59375,6.13494773 -3.17196642 2.4375 1.5625,6.29524437 -3.35779477 2.46875 1.53125,6.46446609 -3.53553391 2.5 1.5,6.64220523 -3.70475563 2.53125 1.46875,6.82803358 -3.86505227 2.5625 1.4375,7.02150348 -4.01603766 2.59375 1.40625,7.22214883 -4.15734806 2.625 1.375,7.42948628 -4.28864305 2.65625 1.34375,7.64301632 -4.40960632 2.6875 1.3125,7.86222453 -4.51994647 2.71875 1.28125,8.08658284 -4.61939766 2.75 1.25,8.31555073 -4.70772033 2.78125 1.21875,8.54857661 -4.78470168 2.8125 1.1875,8.7850991 -4.85015627 2.84375 1.15625,9.02454839 -4.9039264 2.875 1.125,9.26634763 -4.94588255 2.90625 1.09375,9.5099143 -4.97592363 2.9375 1.0625,9.75466163 -4.99397728 2.96875 1.03125,10 -5 3 1,10.24533837 -4.99397728 3.03125 0.96875,10.4900857 -4.97592363 3.0625 0.9375,10.73365237 -4.94588255 3.09375 0.90625,10.97545161 -4.9039264 3.125 0.875,11.2149009 -4.85015627 3.15625 0.84375,11.45142339 -4.78470168 3.1875 0.8125,11.68444927 -4.70772033 3.21875 0.78125,11.91341716 -4.61939766 3.25 0.75,12.13777547 -4.51994647 3.28125 0.71875,12.35698368 -4.40960632 3.3125 0.6875,12.57051372 -4.28864305 3.34375 0.65625,12.77785117 -4.15734806 3.375 0.625,12.97849652 -4.01603766 3.40625 0.59375,13.17196642 -3.86505227 3.4375 0.5625,13.35779477 -3.70475563 3.46875 0.53125,13.53553391 -3.53553391 3.5 0.5,13.70475563 -3.35779477 3.53125 0.46875,13.86505227 -3.17196642 3.5625 0.4375,14.01603766 -2.97849652 3.59375 0.40625,14.15734806 -2.77785117 3.625 0.375,14.28864305 -2.57051372 3.65625 0.34375,14.40960632 -2.35698368 3.6875 0.3125,14.51994647 -2.13777547 3.71875 0.28125,14.61939766 -1.91341716 3.75 0.25,14.70772033 -1.68444927 3.78125 0.21875,14.78470168 -1.45142339 3.8125 0.1875,14.85015627 -1.2149009 3.84375 0.15625,14.9039264 -0.97545161 3.875 0.125,14.94588255 -0.73365237 3.90625 0.09375,14.97592363 -0.4900857 3.9375 0.0625,14.99397728 -0.24533837 3.96875 0.03125,15 0 4 0)
ST_CurveToLine01|LINESTRING(-5 0,-4.99397728 0.24533837,-4.97592363 0.4900857,-4.94588255 0.73365237,-4.9039264 0.97545161,-4.85015627 1.2149009,-4.78470168 1.45142339,-4.70772033 1.68444927,-4.61939766 1.91341716,-4.51994647 2.13777547,-4.40960632 2.35698368,-4.28864305 2.57051372,-4.15734806 2.77785117,-4.01603766 2.97849652,-3.86505227 3.17196642,-3.70475563 3.35779477,-3.53553391 3.53553391,-3.35779477 3.70475563,-3.17196642 3.86505227,-2.97849652 4.01603766,-2.77785117 4.15734806,-2.57051372 4.28864305,-2.35698368 4.40960632,-2.13777547 4.51994647,-1.91341716 4.61939766,-1.68444927 4.70772033,-1.45142339 4.78470168,-1.2149009 4.85015627,-0.97545161 4.9039264,-0.73365237 4.94588255,-0.4900857 4.97592363,-0.24533837 4.99397728,3.061617e-16 5,0.24533837 4.99397728,0.4900857 4.97592363,0.73365237 4.94588255,0.97545161 4.9039264,1.2149009 4.85015627,1.45142339 4.78470168,1.68444927 4.70772033,1.91341716 4.61939766,2.13777547 4.51994647,2.35698368 4.40960632,2.57051372 4.28864305,2.77785117 4.15734806,2.97849652 4.01603766,3.17196642 3.86505227,3.35779477 3.70475563,3.53553391 3.53553391,3.70475563 3.35779477,3.86505227 3.17196642,4.01603766 2.97849652,4.15734806 2.77785117,4.28864305 2.57051372,4.40960632 2.35698368,4.51994647 2.13777547,4.61939766 1.91341716,4.70772033 1.68444927,4.78470168 1.45142339,4.85015627 1.2149009,4.9039264 0.97545161,4.94588255 0.73365237,4.97592363 0.4900857,4.99397728 0.24533837,5 0,5.00602272 -0.24533837,5.02407637 -0.4900857,5.05411745 -0.73365237,5.0960736 -0.97545161,5.14984373 -1.2149009,5.21529832 -1.45142339,5.29227967 -1.68444927,5.38060234 -1.91341716,5.48005353 -2.13777547,5.59039368 -2.35698368,5.71135695 -2.57051372,5.84265194 -2.77785117,5.98396234 -2.97849652,6.13494773 -3.17196642,6.29524437 -3.35779477,6.46446609 -3.53553391,6.64220523 -3.70475563,6.82803358 -3.86505227,7.02150348 -4.01603766,7.22214883 -4.15734806,7.42948628 -4.28864305,7.64301632 -4.40960632,7.86222453 -4.51994647,8.08658284 -4.61939766,8.31555073 -4.70772033,8.54857661 -4.78470168,8.7850991 -4.85015627,9.02454839 -4.9039264,9.26634763 -4.94588255,9.5099143 -4.97592363,9.75466163 -4.99397728,10 -5,10.24533837 -4.99397728,10.4900857 -4.97592363,10.73365237 -4.94588255,10.97545161 -4.9039264,11.2149009 -4.85015627,11.45142339 -4.78470168,11.68444927 -4.70772033,11.91341716 -4.61939766,12.13777547 -4.51994647,12.35698368 -4.40960632,12.57051372 -4.28864305,12.77785117 -4.15734806,12.97849652 -4.01603766,13.17196642 -3.86505227,13.35779477 -3.70475563,13.53553391 -3.53553391,13.70475563 -3.35779477,13.86505227 -3.17196642,14.01603766 -2.97849652,14.15734806 -2.77785117,14.28864305 -2.57051372,14.40960632 -2.35698368,14.51994647 -2.13777547,14.61939766 -1.91341716,14.70772033 -1.68444927,14.78470168 -1.45142339,14.85015627 -1.2149009,14.9039264 -0.97545161,14.94588255 -0.73365237,14.97592363 -0.4900857,14.99397728 -0.24533837,15 0)
ST_CurveToLine02|LINESTRING M (0 0 0,0.00240909 0.09813535 -0.1875,0.00963055 0.19603428 -0.375,0.02164698 0.29346095 -0.5625,0.03842944 0.39018064 -0.75,0.05993749 0.48596036 -0.9375,0.08611933 0.58056935 -1.125,0.11691187 0.67377971 -1.3125,0.15224093 0.76536686 -1.5,0.19202141 0.85511019 -1.6875,0.23615747 0.94279347 -1.875,0.28454278 1.02820549 -1.75,0.33706078 1.11114047 -1,0.39358494 1.19139861 -0.25,0.45397909 1.26878657 0.5,0.51809775 1.34311791 1.25,0.58578644 1.41421356 2)
ST_CurveToLine02|LINESTRING M (-5 0 4,-4.99397728 0.24533837 3.96875,-4.97592363 0.4900857 3.9375,-4.94588255 0.73365237 3.90625,-4.9039264 0.97545161 3.875,-4.85015627 1.2149009 3.84375,-4.78470168 1.45142339 3.8125,-4.70772033 1.68444927 3.78125,-4.61939766 1.91341716 3.75,-4.51994647 2.13777547 3.71875,-4.40960632 2.35698368 3.6875,-4.28864305 2.57051372 3.65625,-4.15734806 2.77785117 3.625,-4.01603766 2.97849652 3.59375,-3.86505227 3.17196642 3.5625,-3.70475563 3.35779477 3.53125,-3.53553391 3.53553391 3.5,-3.35779477 3.70475563 3.46875,-3.17196642 3.86505227 3.4375,-2.97849652 4.01603766 3.40625,-2.77785117 4.15734806 3.375,-2.57051372 4.28864305 3.34375,-2.35698368 4.40960632 3.3125,-2.13777547 4.51994647 3.28125,-1.91341716 4.61939766 3.25,-1.68444927 4.70772033 3.21875,-1.45142339 4.78470168 3.1875,-1.2149009 4.85015627 3.15625,-0.97545161 4.9039264 3.125,-0.73365237 4.94588255 3.09375,-0.4900857 4.97592363 3.0625,-0.24533837 4.99397728 3.03125,3.061617e-16 5 3,0.24533837 4.99397728 2.96875,0.4900857 4.97592363 2.9375,0.73365237 4.94588255 2.90625,0.97545161 4.9039264 2.875,1.2149009 4.85015627 2.84375,1.45142339 4.78470168 2.8125,1.68444927 4.70772033 2.78125,1.91341716 4.61939766 2.75,2.13777547 4.51994647 2.71875,2.35698368 4.40960632 2.6875,2.57051372 4.28864305 2.65625,2.77785117 4.15734806 2.625,2.97849652 4.01603766 2.59375,3.17196642 3.86505227 2.5625,3.35779477 3.70475563 2.53125,3.53553391 3.53553391 2.5,3.70475563 3.35779477 2.46875,3.86505227 3.17196642 2.4375,4.01603766 2.97849652 2.40625,4.15734806 2.77785117 2.375,4.28864305 2.57051372 2.34375,4.40960632 2.35698368 2.3125,4.51994647 2.13777547 2.28125,4.61939766 1.91341716 2.25,4.70772033 1.68444927 2.21875,4.78470168 1.45142339 2.1875,4.85015627 1.2149009 2.15625,4.9039264 0.97545161 2.125,4.94588255 0.73365237 2.09375,4.97592363 0.4900857 2.0625,4.99397728 0.24533837 2.03125,5 0 2,5.00602272 -0.24533837 1.96875,5.02407637 -0.4900857 1.9375,5.05411745 -0.73365237 1.90625,5.0960736 -0.97545161 1.875,5.14984373 -1.2149009 1.84375,5.21529832 -1.45142339 1.8125,5.29227967 -1.68444927 1.78125,5.38060234 -1.91341716 1.75,5.48005353 -2.13777547 1.71875,5.59039368 -2.35698368 1.6875,5.71135695 -2.57051372 1.65625,5.84265194 -2.77785117 1.625,5.98396234 -2.97849652 1.59375,6.13494773 -3.17196642 1.5625,6.29524437 -3.35779477 1.53125,6.46446609 -3.53553391 1.5,6.64220523 -3.70475563 1.46875,6.82803358 -3.86505227 1.4375,7.02150348 -4.01603766 1.40625,7.22214883 -4.15734806 1.375,7.42948628 -4.28864305 1.34375,7.64301632 -4.40960632 1.3125,7.86222453 -4.51994647 1.28125,8.08658284 -4.61939766 1.25,8.31555073 -4.70772033 1.21875,8.54857661 -4.78470168 1.1875,8.7850991 -4.85015627 1.15625,9.02454839 -4.9039264 1.125,9.26634763 -4.94588255 1.09375,9.5099143 -4.97592363 1.0625,9.75466163 -4.99397728 1.03125,10 -5 1,10.24533837 -4.99397728 0.96875,10.4900857 -4.97592363 0.9375,10.73365237 -4.94588255 0.90625,10.97545161 -4.9039264 0.875,11.2149009 -4.85015627 0.84375,11.45142339 -4.78470168 0.8125,11.68444927 -4.70772033 0.78125,11.91341716 -4.61939766 0.75,12.13777547 -4.51994647 0.71875,12.35698368 -4.40960632 0.6875,12.57051372 -4.28864305 0.65625,12.77785117 -4.15734806 0.625,12.97849652 -4.01603766 0.59375,13.17196642 -3.86505227 0.5625,13.35779477 -3.70475563 0.53125,13.53553391 -3.53553391 0.5,13.70475563 -3.35779477 0.46875,13.86505227 -3.17196642 0.4375,14.01603766 -2.97849652 0.40625,14.15734806 -2.77785117 0.375,14.28864305 -2.57051372 0.34375,14.40960632 -2.35698368 0.3125,14.51994647 -2.13777547 0.28125,14.61939766 -1.91341716 0.25,14.70772033 -1.68444927 0.21875,14.78470168 -1.45142339 0.1875,14.85015627 -1.2149009 0.15625,14.9039264 -0.97545161 0.125,14.94588255 -0.73365237 0.09375,14.97592363 -0.4900857 0.0625,14.99397728 -0.24533837 0.03125,15 0 0)
ST_CurveToLine03|LINESTRING Z (0 0 0,0.00240909 0.09813535 0.28125,0.00963055 0.19603428 0.5625,0.02164698 0.29346095 0.84375,0.03842944 0.39018064 1.125,0.05993749 0.48596036 1.40625,0.08611933 0.58056935 1.6875,0.11691187 0.67377971 1.96875,0.15224093 0.76536686 2.25,0.19202141 0.85511019 2.53125,0.23615747 0.94279347 2.8125,0.28454278 1.02820549 2.875,0.33706078 1.11114047 2.5,0.39358494 1.19139861 2.125,0.45397909 1.26878657 1.75,0.51809775 1.34311791 1.375,0.58578644 1.41421356 1)
ST_CurveToLine03|LINESTRING Z (-5 0 0,-4.99397728 0.24533837 0.03125,-4.97592363 0.4900857 0.0625,-4.94588255 0.73365237 0.09375,-4.9039264 0.97545161 0.125,-4.85015627 1.2149009 0.15625,-4.78470168 1.45142339 0.1875,-4.70772033 1.68444927 0.21875,-4.61939766 1.91341716 0.25,-4.51994647 2.13777547 0.28125,-4.40960632 2.35698368 0.3125,-4.28864305 2.57051372 0.34375,-4.15734806 2.77785117 0.375,-4.01603766 2.97849652 0.40625,-3.86505227 3.17196642 0.4375,-3.70475563 3.35779477 0.46875,-3.53553391 3.53553391 0.5,-3.35779477 3.70475563 0.53125,-3.17196642 3.86505227 0.5625,-2.97849652 4.01603766 0.59375,-2.77785117 4.15734806 0.625,-2.57051372 4.28864305 0.65625,-2.35698368 4.40960632 0.6875,-2.13777547 4.51994647 0.71875,-1.91341716 4.61939766 0.75,-1.68444927 4.70772033 0.78125,-1.45142339 4.78470168 0.8125,-1.2149009 4.85015627 0.84375,-0.97545161 4.9039264 0.875,-0.73365237 4.94588255 0.90625,-0.4900857 4.97592363 0.9375,-0.24533837 4.99397728 0.96875,3.061617e-16 5 1,0.24533837 4.99397728 1.03125,0.4900857 4.97592363 1.0625,0.73365237 4.94588255 1.09375,0.97545161 4.9039264 1.125,1.2149009 4.85015627 1.15625,1.45142339 4.78470168 1.1875,1.68444927 4.70772033 1.21875,1.91341716 4.61939766 1.25,2.13777547 4.51994647 1.28125,2.35698368 4.40960632 1.3125,2.57051372 4.28864305 1.34375,2.77785117 4.15734806 1.375,2.97849652 4.01603766 1.40625,3.17196642 3.86505227 1.4375,3.35779477 3.70475563 1.46875,3.53553391 3.53553391 1.5,3.70475563 3.35779477 1.53125,3.86505227 3.17196642 1.5625,4.01603766 2.97849652 1.59375,4.15734806 2.77785117 1.625,4.28864305 2.57051372 1.65625,4.40960632 2.35698368 1.6875,4.51994647 2.13777547 1.71875,4.61939766 1.91341716 1.75,4.70772033 1.68444927 1.78125,4.78470168 1.45142339 1.8125,4.85015627 1.2149009 1.84375,4.9039264 0.97545161 1.875,4.94588255 0.73365237 1.90625,4.97592363 0.4900857 1.9375,4.99397728 0.24533837 1.96875,5 0 2,5.00602272 -0.24533837 2.03125,5.02407637 -0.4900857 2.0625,5.05411745 -0.73365237 2.09375,5.0960736 -0.97545161 2.125,5.14984373 -1.2149009 2.15625,5.21529832 -1.45142339 2.1875,5.29227967 -1.68444927 2.21875,5.38060234 -1.91341716 2.25,5.48005353 -2.13777547 2.28125,5.59039368 -2.35698368 2.3125,5.71135695 -2.57051372 2.34375,5.84265194 -2.77785117 2.375,5.98396234 -2.97849652 2.40625,6.13494773 -3.17196642 2.4375,6.29524437 -3.35779477 2.46875,6.46446609 -3.53553391 2.5,6.64220523 -3.70475563 2.53125,6.82803358 -3.86505227 2.5625,7.02150348 -4.01603766 2.59375,7.22214883 -4.15734806 2.625,7.42948628 -4.28864305 2.65625,7.64301632 -4.40960632 2.6875,7.86222453 -4.51994647 2.71875,8.08658284 -4.61939766 2.75,8.31555073 -4.70772033 2.78125,8.54857661 -4.78470168 2.8125,8.7850991 -4.85015627 2.84375,9.02454839 -4.9039264 2.875,9.26634763 -4.94588255 2.90625,9.5099143 -4.97592363 2.9375,9.75466163 -4.99397728 2.96875,10 -5 3,10.24533837 -4.99397728 3.03125,10.4900857 -4.97592363 3.0625,10.73365237 -4.94588255 3.09375,10.97545161 -4.9039264 3.125,11.2149009 -4.85015627 3.15625,11.45142339 -4.78470168 3.1875,11.68444927 -4.70772033 3.21875,11.91341716 -4.61939766 3.25,12.13777547 -4.51994647 3.28125,12.35698368 -4.40960632 3.3125,12.57051372 -4.28864305 3.34375,12.77785117 -4.15734806 3.375,12.97849652 -4.01603766 3.40625,13.17196642 -3.86505227 3.4375,13.35779477 -3.70475563 3.46875,13.53553391 -3.53553391 3.5,13.70475563 -3.35779477 3.53125,13.86505227 -3.17196642 3.5625,14.01603766 -2.97849652 3.59375,14.15734806 -2.77785117 3.625,14.28864305 -2.57051372 3.65625,14.40960632 -2.35698368 3.6875,14.51994647 -2.13777547 3.71875,14.61939766 -1.91341716 3.75,14.70772033 -1.68444927 3.78125,14.78470168 -1.45142339 3.8125,14.85015627 -1.2149009 3.84375,14.9039264 -0.97545161 3.875,14.94588255 -0.73365237 3.90625,14.97592363 -0.4900857 3.9375,14.99397728 -0.24533837 3.96875,15 0 4)
ST_CurveToLine04|LINESTRING ZM (0 0 0 0,0.00240909 0.09813535 0.28125 -0.1875,0.00963055 0.19603428 0.5625 -0.375,0.02164698 0.29346095 0.84375 -0.5625,0.03842944 0.39018064 1.125 -0.75,0.05993749 0.48596036 1.40625 -0.9375,0.08611933 0.58056935 1.6875 -1.125,0.11691187 0.67377971 1.96875 -1.3125,0.15224093 0.76536686 2.25 -1.5,0.19202141 0.85511019 2.53125 -1.6875,0.23615747 0.94279347 2.8125 -1.875,0.28454278 1.02820549 2.875 -1.75,0.33706078 1.11114047 2.5 -1,0.39358494 1.19139861 2.125 -0.25,0.45397909 1.26878657 1.75 0.5,0.51809775 1.34311791 1.375 1.25,0.58578644 1.41421356 1 2)
ST_CurveToLine04|LINESTRING ZM (-5 0 0 4,-4.99397728 0.24533837 0.03125 3.96875,-4.97592363 0.4900857 0.0625 3.9375,-4.94588255 0.73365237 0.09375 3.90625,-4.9039264 0.97545161 0.125 3.875,-4.85015627 1.2149009 0.15625 3.84375,-4.78470168 1.45142339 0.1875 3.8125,-4.70772033 1.68444927 0.21875 3.78125,-4.61939766 1.91341716 0.25 3.75,-4.51994647 2.13777547 0.28125 3.71875,-4.40960632 2.35698368 0.3125 3.6875,-4.28864305 2.57051372 0.34375 3.65625,-4.15734806 2.77785117 0.375 3.625,-4.01603766 2.97849652 0.40625 3.59375,-3.86505227 3.17196642 0.4375 3.5625,-3.70475563 3.35779477 0.46875 3.53125,-3.53553391 3.53553391 0.5 3.5,-3.35779477 3.70475563 0.53125 3.46875,-3.17196642 3.86505227 0.5625 3.4375,-2.97849652 4.01603766 0.59375 3.40625,-2.77785117 4.15734806 0.625 3.375,-2.57051372 4.28864305 0.65625 3.34375,-2.35698368 4.40960632 0.6875 3.3125,-2.13777547 4.51994647 0.71875 3.28125,-1.91341716 4.61939766 0.75 3.25,-1.68444927 4.70772033 0.78125 3.21875,-1.45142339 4.78470168 0.8125 3.1875,-1.2149009 4.85015627 0.84375 3.15625,-0.97545161 4.9039264 0.875 3.125,-0.73365237 4.94588255 0.90625 3.09375,-0.4900857 4.97592363 0.9375 3.0625,-0.24533837 4.99397728 0.96875 3.03125,3.061617e-16 5 1 3,0.24533837 4.99397728 1.03125 2.96875,0.4900857 4.97592363 1.0625 2.9375,0.73365237 4.94588255 1.09375 2.90625,0.97545161 4.9039264 1.125 2.875,1.2149009 4.85015627 1.15625 2.84375,1.45142339 4.78470168 1.1875 2.8125,1.68444927 4.70772033 1.21875 2.78125,1.91341716 4.61939766 1.25 2.75,2.13777547 4.51994647 1.28125 2.71875,2.35698368 4.40960632 1.3125 2.6875,2.57051372 4.28864305 1.34375 2.65625,2.77785117 4.15734806 1.375 2.625,2.97849652 4.01603766 1.40625 2.59375,3.17196642 3.86505227 1.4375 2.5625,3.35779477 3.70475563 1.46875 2.53125,3.53553391 3.53553391 1.5 2.5,3.70475563 3.35779477 1.53125 2.46875,3.86505227 3.17196642 1.5625 2.4375,4.01603766 2.97849652 1.59375 2.40625,4.15734806 2.77785117 1.625 2.375,4.28864305 2.57051372 1.65625 2.34375,4.40960632 2.35698368 1.6875 2.3125,4.51994647 2.13777547 1.71875 2.28125,4.61939766 1.91341716 1.75 2.25,4.70772033 1.68444927 1.78125 2.21875,4.78470168 1.45142339 1.8125 2.1875,4.85015627 1.2149009 1.84375 2.15625,4.9039264 0.97545161 1.875 2.125,4.94588255 0.73365237 1.90625 2.09375,4.97592363 0.4900857 1.9375 2.0625,4.99397728 0.24533837 1.96875 2.03125,5 0 2 2,5.00602272 -0.24533837 2.03125 1.96875,5.02407637 -0.4900857 2.0625 1.9375,5.05411745 -0.73365237 2.09375 1.90625,5.0960736 -0.97545161 2.125 1.875,5.14984373 -1.2149009 2.15625 1.84375,5.21529832 -1.45142339 2.1875 1.8125,5.29227967 -1.68444927 2.21875 1.78125,5.38060234 -1.91341716 2.25 1.75,5.48005353 -2.13777547 2.28125 1.71875,5.59039368 -2.35698368 2.3125 1.6875,5.71135695 -2.57051372 2.34375 1.65625,5.84265194 -2.77785117 2.375 1.625,5.98396234 -2.97849652 2.40625 1.59375,6.13494773 -3.17196642 2.4375 1.5625,6.29524437 -3.35779477 2.46875 1.53125,6.46446609 -3.53553391 2.5 1.5,6.64220523 -3.70475563 2.53125 1.46875,6.82803358 -3.86505227 2.5625 1.4375,7.02150348 -4.01603766 2.59375 1.40625,7.22214883 -4.15734806 2.625 1.375,7.42948628 -4.28864305 2.65625 1.34375,7.64301632 -4.40960632 2.6875 1.3125,7.86222453 -4.51994647 2.71875 1.28125,8.08658284 -4.61939766 2.75 1.25,8.31555073 -4.70772033 2.78125 1.21875,8.54857661 -4.78470168 2.8125 1.1875,8.7850991 -4.85015627 2.84375 1.15625,9.02454839 -4.9039264 2.875 1.125,9.26634763 -4.94588255 2.90625 1.09375,9.5099143 -4.97592363 2.9375 1.0625,9.75466163 -4.99397728 2.96875 1.03125,10 -5 3 1,10.24533837 -4.99397728 3.03125 0.96875,10.4900857 -4.97592363 3.0625 0.9375,10.73365237 -4.94588255 3.09375 0.90625,10.97545161 -4.9039264 3.125 0.875,11.2149009 -4.85015627 3.15625 0.84375,11.45142339 -4.78470168 3.1875 0.8125,11.68444927 -4.70772033 3.21875 0.78125,11.91341716 -4.61939766 3.25 0.75,12.13777547 -4.51994647 3.28125 0.71875,12.35698368 -4.40960632 3.3125 0.6875,12.57051372 -4.28864305 3.34375 0.65625,12.77785117 -4.15734806 3.375 0.625,12.97849652 -4.01603766 3.40625 0.59375,13.17196642 -3.86505227 3.4375 0.5625,13.35779477 -3.70475563 3.46875 0.53125,13.53553391 -3.53553391 3.5 0.5,13.70475563 -3.35779477 3.53125 0.46875,13.86505227 -3.17196642 3.5625 0.4375,14.01603766 -2.97849652 3.59375 0.40625,14.15734806 -2.77785117 3.625 0.375,14.28864305 -2.57051372 3.65625 0.34375,14.40960632 -2.35698368 3.6875 0.3125,14.51994647 -2.13777547 3.71875 0.28125,14.61939766 -1.91341716 3.75 0.25,14.70772033 -1.68444927 3.78125 0.21875,14.78470168 -1.45142339 3.8125 0.1875,14.85015627 -1.2149009 3.84375 0.15625,14.9039264 -0.97545161 3.875 0.125,14.94588255 -0.73365237 3.90625 0.09375,14.97592363 -0.4900857 3.9375 0.0625,14.99397728 -0.24533837 3.96875 0.03125,15 0 4 0)
isValid01|t
isValid01|t
isValid02|t

View file

@ -14,14 +14,14 @@ ndims03|3
geometrytype03|COMPOUNDCURVEM
ndims04|2
geometrytype04|COMPOUNDCURVE
astext01|COMPOUNDCURVE(CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.4142135623731),(0.585786437626905 1.4142135623731,2 0,0 0))
astext02|COMPOUNDCURVE M (CIRCULARSTRING M (0 0 0,0.267949192431123 1 -2,0.585786437626905 1.4142135623731 2),(0.585786437626905 1.4142135623731 2,2 0 0,0 0 0))
astext03|COMPOUNDCURVE Z (CIRCULARSTRING Z (0 0 0,0.267949192431123 1 3,0.585786437626905 1.4142135623731 1),(0.585786437626905 1.4142135623731 1,2 0 0,0 0 0))
astext04|COMPOUNDCURVE ZM (CIRCULARSTRING ZM (0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.4142135623731 1 2),(0.585786437626905 1.4142135623731 1 2,2 0 0 0,0 0 0 0))
asewkt01|COMPOUNDCURVE(CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.4142135623731),(0.585786437626905 1.4142135623731,2 0,0 0))
asewkt02|COMPOUNDCURVEM(CIRCULARSTRINGM(0 0 0,0.267949192431123 1 -2,0.585786437626905 1.4142135623731 2),(0.585786437626905 1.4142135623731 2,2 0 0,0 0 0))
asewkt03|COMPOUNDCURVE(CIRCULARSTRING(0 0 0,0.267949192431123 1 3,0.585786437626905 1.4142135623731 1),(0.585786437626905 1.4142135623731 1,2 0 0,0 0 0))
asewkt04|COMPOUNDCURVE(CIRCULARSTRING(0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.4142135623731 1 2),(0.585786437626905 1.4142135623731 1 2,2 0 0 0,0 0 0 0))
astext01|COMPOUNDCURVE(CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.414213562373095),(0.585786437626905 1.414213562373095,2 0,0 0))
astext02|COMPOUNDCURVE M (CIRCULARSTRING M (0 0 0,0.267949192431123 1 -2,0.585786437626905 1.414213562373095 2),(0.585786437626905 1.414213562373095 2,2 0 0,0 0 0))
astext03|COMPOUNDCURVE Z (CIRCULARSTRING Z (0 0 0,0.267949192431123 1 3,0.585786437626905 1.414213562373095 1),(0.585786437626905 1.414213562373095 1,2 0 0,0 0 0))
astext04|COMPOUNDCURVE ZM (CIRCULARSTRING ZM (0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.414213562373095 1 2),(0.585786437626905 1.414213562373095 1 2,2 0 0 0,0 0 0 0))
asewkt01|COMPOUNDCURVE(CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.414213562373095),(0.585786437626905 1.414213562373095,2 0,0 0))
asewkt02|COMPOUNDCURVEM(CIRCULARSTRINGM(0 0 0,0.267949192431123 1 -2,0.585786437626905 1.414213562373095 2),(0.585786437626905 1.414213562373095 2,2 0 0,0 0 0))
asewkt03|COMPOUNDCURVE(CIRCULARSTRING(0 0 0,0.267949192431123 1 3,0.585786437626905 1.414213562373095 1),(0.585786437626905 1.414213562373095 1,2 0 0,0 0 0))
asewkt04|COMPOUNDCURVE(CIRCULARSTRING(0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.414213562373095 1 2),(0.585786437626905 1.414213562373095 1 2,2 0 0 0,0 0 0 0))
asbinary01|0109000000020000000108000000030000000000000000000000000000000000000056cd9e5e1426d13f000000000000f03f67880133c3bee23fcd3b7f669ea0f63f01020000000300000067880133c3bee23fcd3b7f669ea0f63f0000000000000040000000000000000000000000000000000000000000000000
asbinary02|01d90700000200000001d80700000300000000000000000000000000000000000000000000000000000056cd9e5e1426d13f000000000000f03f00000000000000c067880133c3bee23fcd3b7f669ea0f63f000000000000004001d20700000300000067880133c3bee23fcd3b7f669ea0f63f0000000000000040000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000
asbinary03|01f10300000200000001f00300000300000000000000000000000000000000000000000000000000000056cd9e5e1426d13f000000000000f03f000000000000084067880133c3bee23fcd3b7f669ea0f63f000000000000f03f01ea0300000300000067880133c3bee23fcd3b7f669ea0f63f000000000000f03f000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000

View file

@ -88,11 +88,11 @@ ERROR: geometry must have an odd number of points
ERROR: incontinuous compound curve
ERROR: geometry contains non-closed rings
ERROR: geometry requires more points
valid ewkb curve polygon 1|CURVEPOLYGON((143.620251668383 -30.0374973560768,142.928571472997 -32.751011968744,145.961323098919 -34.9856710615288,149.575653076172 -33.4115333557129,149.419724075848 -29.8246726805735,146.120941605547 -30.1971158627043,143.620251668383 -30.0374973560768))
valid ewkb curve polygon 2|CURVEPOLYGON((143.620251668383 -30.0374973560768,142.928571472997 -32.751011968744,145.961323098919 -34.9856710615288,149.575653076172 -33.4115333557129,149.419724075848 -29.8246726805735,146.120941605547 -30.1971158627043,143.620251668383 -30.0374973560768),(144.843993552527 -31.2612392402209,144.205519526017 -32.2721564488616,145.552307128906 -33.4920387268066,147.970809936523 -32.0361862182617,146.386972449926 -31.4740639157242,144.843993552527 -31.2612392402209))
valid ewkb curve polygon 3|CURVEPOLYGON(CIRCULARSTRING(143.620251668383 -30.0374973560768,142.928571472997 -32.751011968744,145.961323098919 -34.9856710615288,149.575653076172 -33.4115333557129,149.419724075848 -29.8246726805735,146.120941605547 -30.1971158627043,143.620251668383 -30.0374973560768))
valid ewkb curve polygon 4|CURVEPOLYGON(CIRCULARSTRING(143.620251668383 -30.0374973560768,142.928571472997 -32.751011968744,145.961323098919 -34.9856710615288,149.575653076172 -33.4115333557129,149.419724075848 -29.8246726805735,146.120941605547 -30.1971158627043,143.620251668383 -30.0374973560768),(144.843993552527 -31.2612392402209,144.205519526017 -32.2721564488616,145.552307128906 -33.4920387268066,147.970809936523 -32.0361862182617,146.386972449926 -31.4740639157242,144.843993552527 -31.2612392402209))
valid ewkb curve polygon 5|CURVEPOLYGON((143.620251668383 -30.0374973560768,142.928571472997 -32.751011968744,145.961323098919 -34.9856710615288,149.575653076172 -33.4115333557129,149.419724075848 -29.8246726805735,146.120941605547 -30.1971158627043,143.620251668383 -30.0374973560768),COMPOUNDCURVE(CIRCULARSTRING(144.843993552527 -31.2612392402209,144.205519526017 -32.2721564488616,145.552307128906 -33.4920387268066),(145.552307128906 -33.4920387268066,147.970809936523 -32.0361862182617),CIRCULARSTRING(147.970809936523 -32.0361862182617,146.386972449926 -31.4740639157242,144.843993552527 -31.2612392402209)))
valid ewkb curve polygon 1|CURVEPOLYGON((143.62025166838282 -30.037497356076827,142.92857147299705 -32.75101196874403,145.96132309891922 -34.985671061528784,149.57565307617188 -33.41153335571289,149.41972407584802 -29.824672680573517,146.1209416055467 -30.19711586270431,143.62025166838282 -30.037497356076827))
valid ewkb curve polygon 2|CURVEPOLYGON((143.62025166838282 -30.037497356076827,142.92857147299705 -32.75101196874403,145.96132309891922 -34.985671061528784,149.57565307617188 -33.41153335571289,149.41972407584802 -29.824672680573517,146.1209416055467 -30.19711586270431,143.62025166838282 -30.037497356076827),(144.84399355252685 -31.26123924022086,144.20551952601693 -32.27215644886158,145.55230712890625 -33.49203872680664,147.97080993652344 -32.03618621826172,146.38697244992585 -31.47406391572417,144.84399355252685 -31.26123924022086))
valid ewkb curve polygon 3|CURVEPOLYGON(CIRCULARSTRING(143.62025166838282 -30.037497356076827,142.92857147299705 -32.75101196874403,145.96132309891922 -34.985671061528784,149.57565307617188 -33.41153335571289,149.41972407584802 -29.824672680573517,146.1209416055467 -30.19711586270431,143.62025166838282 -30.037497356076827))
valid ewkb curve polygon 4|CURVEPOLYGON(CIRCULARSTRING(143.62025166838282 -30.037497356076827,142.92857147299705 -32.75101196874403,145.96132309891922 -34.985671061528784,149.57565307617188 -33.41153335571289,149.41972407584802 -29.824672680573517,146.1209416055467 -30.19711586270431,143.62025166838282 -30.037497356076827),(144.84399355252685 -31.26123924022086,144.20551952601693 -32.27215644886158,145.55230712890625 -33.49203872680664,147.97080993652344 -32.03618621826172,146.38697244992585 -31.47406391572417,144.84399355252685 -31.26123924022086))
valid ewkb curve polygon 5|CURVEPOLYGON((143.62025166838282 -30.037497356076827,142.92857147299705 -32.75101196874403,145.96132309891922 -34.985671061528784,149.57565307617188 -33.41153335571289,149.41972407584802 -29.824672680573517,146.1209416055467 -30.19711586270431,143.62025166838282 -30.037497356076827),COMPOUNDCURVE(CIRCULARSTRING(144.84399355252685 -31.26123924022086,144.20551952601693 -32.27215644886158,145.55230712890625 -33.49203872680664),(145.55230712890625 -33.49203872680664,147.97080993652344 -32.03618621826172),CIRCULARSTRING(147.97080993652344 -32.03618621826172,146.38697244992585 -31.47406391572417,144.84399355252685 -31.26123924022086)))
valid curve 6|010a0000000200000001090000000200000001080000000500000000000000000000000000000000000000000000000000004000000000000000000000000000000040000000000000f03f00000000000000400000000000000840000000000000104000000000000008400102000000040000000000000000001040000000000000084000000000000010400000000000001440000000000000f03f000000000000104000000000000000000000000000000000010800000003000000333333333333fb3f000000000000f03f666666666666f63f9a9999999999d93f333333333333fb3f000000000000f03f
ERROR: geometry requires more points
valid curve 8|010a0000000200000001090000000200000001080000000500000000000000000000000000000000000000000000000000004000000000000000000000000000000040000000000000f03f00000000000000400000000000000840000000000000104000000000000008400102000000020000000000000000001040000000000000084000000000000000000000000000000000010800000003000000333333333333fb3f000000000000f03f666666666666f63f9a9999999999d93f333333333333fb3f000000000000f03f

View file

@ -134,20 +134,20 @@ SELECT 'asewkb02', encode(ST_AsEWKB(the_geom_3dm, 'xdr'), 'hex') FROM public.mul
SELECT 'asewkb03', encode(ST_AsEWKB(the_geom_3dz, 'ndr'), 'hex') FROM public.multicurve;
SELECT 'asewkb04', encode(ST_AsEWKB(the_geom_4d, 'xdr'), 'hex') FROM public.multicurve;
SELECT 'ST_CurveToLine-201', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_2d, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine-202', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_3dm, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine-203', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_3dz, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine-204', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_4d, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine-201', ST_AsText(ST_CurveToLine(the_geom_2d, 2), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine-202', ST_AsText(ST_CurveToLine(the_geom_3dm, 2), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine-203', ST_AsText(ST_CurveToLine(the_geom_3dz, 2), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine-204', ST_AsText(ST_CurveToLine(the_geom_4d, 2), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine-401', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_2d, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine-402', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_3dm, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine-403', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_3dz, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine-404', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_4d, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine-401', ST_AsText(ST_CurveToLine(the_geom_2d, 4), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine-402', ST_AsText(ST_CurveToLine(the_geom_3dm, 4), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine-403', ST_AsText(ST_CurveToLine(the_geom_3dz, 4), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine-404', ST_AsText(ST_CurveToLine(the_geom_4d, 4), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine01', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_2d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine02', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_3dm), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine03', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_3dz), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine04', ST_AsEWKT(ST_SnapToGrid(ST_CurveToLine(the_geom_4d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.multicurve;
SELECT 'ST_CurveToLine01', ST_AsText(ST_CurveToLine(the_geom_2d), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine02', ST_AsText(ST_CurveToLine(the_geom_3dm), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine03', ST_AsText(ST_CurveToLine(the_geom_3dz), 8) FROM public.multicurve;
SELECT 'ST_CurveToLine04', ST_AsText(ST_CurveToLine(the_geom_4d), 8) FROM public.multicurve;
-- TODO: ST_SnapToGrid is required to remove platform dependent precision
-- issues. Until ST_SnapToGrid is updated to work against curves, these

View file

@ -15,25 +15,25 @@ asewkb02|004000000b0000000200400000020000000440140000000000004014000000000000400
asewkb03|010b0000800200000001020000800400000000000000000014400000000000001440000000000000f03f00000000000008400000000000001440000000000000004000000000000008400000000000000840000000000000084000000000000000000000000000000840000000000000f03f01080000800300000000000000000000000000000000000000000000000000000056cd9e5e1426d13f000000000000f03f000000000000084067880133c3bee23fcd3b7f669ea0f63f000000000000f03f
asewkb04|00c000000b0000000200c000000200000004401400000000000040140000000000003ff0000000000000400800000000000040080000000000004014000000000000400000000000000040000000000000004008000000000000400800000000000040080000000000003ff0000000000000000000000000000040080000000000003ff00000000000003ff000000000000000c00000080000000300000000000000000000000000000000000000000000000000000000000000003fd126145e9ecd563ff00000000000004008000000000000c0000000000000003fe2bec3330188673ff6a09e667f3bcd3ff00000000000004000000000000000
ST_CurveToLine-201|MULTILINESTRING((5 5,3 5,3 3,0 3),(0 0,0.15224093 0.76536686,0.58578644 1.41421356))
ST_CurveToLine-202|MULTILINESTRINGM((5 5 3,3 5 2,3 3 1,0 3 1),(0 0 0,0.15224093 0.76536686 -1.5,0.58578644 1.41421356 2))
ST_CurveToLine-203|MULTILINESTRING((5 5 1,3 5 2,3 3 3,0 3 1),(0 0 0,0.15224093 0.76536686 2.25,0.58578644 1.41421356 1))
ST_CurveToLine-204|MULTILINESTRING((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),(0 0 0 0,0.15224093 0.76536686 2.25 -1.5,0.58578644 1.41421356 1 2))
ST_CurveToLine-202|MULTILINESTRING M ((5 5 3,3 5 2,3 3 1,0 3 1),(0 0 0,0.15224093 0.76536686 -1.5,0.58578644 1.41421356 2))
ST_CurveToLine-203|MULTILINESTRING Z ((5 5 1,3 5 2,3 3 3,0 3 1),(0 0 0,0.15224093 0.76536686 2.25,0.58578644 1.41421356 1))
ST_CurveToLine-204|MULTILINESTRING ZM ((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),(0 0 0 0,0.15224093 0.76536686 2.25 -1.5,0.58578644 1.41421356 1 2))
ST_CurveToLine-401|MULTILINESTRING((5 5,3 5,3 3,0 3),(0 0,0.15224093 0.76536686,0.58578644 1.41421356))
ST_CurveToLine-402|MULTILINESTRINGM((5 5 3,3 5 2,3 3 1,0 3 1),(0 0 0,0.15224093 0.76536686 -1.5,0.58578644 1.41421356 2))
ST_CurveToLine-403|MULTILINESTRING((5 5 1,3 5 2,3 3 3,0 3 1),(0 0 0,0.15224093 0.76536686 2.25,0.58578644 1.41421356 1))
ST_CurveToLine-404|MULTILINESTRING((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),(0 0 0 0,0.15224093 0.76536686 2.25 -1.5,0.58578644 1.41421356 1 2))
ST_CurveToLine-402|MULTILINESTRING M ((5 5 3,3 5 2,3 3 1,0 3 1),(0 0 0,0.15224093 0.76536686 -1.5,0.58578644 1.41421356 2))
ST_CurveToLine-403|MULTILINESTRING Z ((5 5 1,3 5 2,3 3 3,0 3 1),(0 0 0,0.15224093 0.76536686 2.25,0.58578644 1.41421356 1))
ST_CurveToLine-404|MULTILINESTRING ZM ((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),(0 0 0 0,0.15224093 0.76536686 2.25 -1.5,0.58578644 1.41421356 1 2))
ST_CurveToLine01|MULTILINESTRING((5 5,3 5,3 3,0 3),(0 0,0.00240909 0.09813535,0.00963055 0.19603428,0.02164698 0.29346095,0.03842944 0.39018064,0.05993749 0.48596036,0.08611933 0.58056935,0.11691187 0.67377971,0.15224093 0.76536686,0.19202141 0.85511019,0.23615747 0.94279347,0.28454278 1.02820549,0.33706078 1.11114047,0.39358494 1.19139861,0.45397909 1.26878657,0.51809775 1.34311791,0.58578644 1.41421356))
ST_CurveToLine02|MULTILINESTRINGM((5 5 3,3 5 2,3 3 1,0 3 1),(0 0 0,0.00240909 0.09813535 -0.1875,0.00963055 0.19603428 -0.375,0.02164698 0.29346095 -0.5625,0.03842944 0.39018064 -0.75,0.05993749 0.48596036 -0.9375,0.08611933 0.58056935 -1.125,0.11691187 0.67377971 -1.3125,0.15224093 0.76536686 -1.5,0.19202141 0.85511019 -1.6875,0.23615747 0.94279347 -1.875,0.28454278 1.02820549 -1.75,0.33706078 1.11114047 -1,0.39358494 1.19139861 -0.25,0.45397909 1.26878657 0.5,0.51809775 1.34311791 1.25,0.58578644 1.41421356 2))
ST_CurveToLine03|MULTILINESTRING((5 5 1,3 5 2,3 3 3,0 3 1),(0 0 0,0.00240909 0.09813535 0.28125,0.00963055 0.19603428 0.5625,0.02164698 0.29346095 0.84375,0.03842944 0.39018064 1.125,0.05993749 0.48596036 1.40625,0.08611933 0.58056935 1.6875,0.11691187 0.67377971 1.96875,0.15224093 0.76536686 2.25,0.19202141 0.85511019 2.53125,0.23615747 0.94279347 2.8125,0.28454278 1.02820549 2.875,0.33706078 1.11114047 2.5,0.39358494 1.19139861 2.125,0.45397909 1.26878657 1.75,0.51809775 1.34311791 1.375,0.58578644 1.41421356 1))
ST_CurveToLine04|MULTILINESTRING((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),(0 0 0 0,0.00240909 0.09813535 0.28125 -0.1875,0.00963055 0.19603428 0.5625 -0.375,0.02164698 0.29346095 0.84375 -0.5625,0.03842944 0.39018064 1.125 -0.75,0.05993749 0.48596036 1.40625 -0.9375,0.08611933 0.58056935 1.6875 -1.125,0.11691187 0.67377971 1.96875 -1.3125,0.15224093 0.76536686 2.25 -1.5,0.19202141 0.85511019 2.53125 -1.6875,0.23615747 0.94279347 2.8125 -1.875,0.28454278 1.02820549 2.875 -1.75,0.33706078 1.11114047 2.5 -1,0.39358494 1.19139861 2.125 -0.25,0.45397909 1.26878657 1.75 0.5,0.51809775 1.34311791 1.375 1.25,0.58578644 1.41421356 1 2))
astext01|MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.4142135623731))
astext02|MULTICURVE M ((5 5 3,3 5 2,3 3 1,0 3 1),CIRCULARSTRING M (0 0 0,0.267949192431123 1 -2,0.585786437626905 1.4142135623731 2))
astext03|MULTICURVE Z ((5 5 1,3 5 2,3 3 3,0 3 1),CIRCULARSTRING Z (0 0 0,0.267949192431123 1 3,0.585786437626905 1.4142135623731 1))
astext04|MULTICURVE ZM ((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),CIRCULARSTRING ZM (0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.4142135623731 1 2))
asewkt01|MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.4142135623731))
asewkt02|MULTICURVEM((5 5 3,3 5 2,3 3 1,0 3 1),CIRCULARSTRINGM(0 0 0,0.267949192431123 1 -2,0.585786437626905 1.4142135623731 2))
asewkt03|MULTICURVE((5 5 1,3 5 2,3 3 3,0 3 1),CIRCULARSTRING(0 0 0,0.267949192431123 1 3,0.585786437626905 1.4142135623731 1))
asewkt04|MULTICURVE((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),CIRCULARSTRING(0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.4142135623731 1 2))
ST_CurveToLine02|MULTILINESTRING M ((5 5 3,3 5 2,3 3 1,0 3 1),(0 0 0,0.00240909 0.09813535 -0.1875,0.00963055 0.19603428 -0.375,0.02164698 0.29346095 -0.5625,0.03842944 0.39018064 -0.75,0.05993749 0.48596036 -0.9375,0.08611933 0.58056935 -1.125,0.11691187 0.67377971 -1.3125,0.15224093 0.76536686 -1.5,0.19202141 0.85511019 -1.6875,0.23615747 0.94279347 -1.875,0.28454278 1.02820549 -1.75,0.33706078 1.11114047 -1,0.39358494 1.19139861 -0.25,0.45397909 1.26878657 0.5,0.51809775 1.34311791 1.25,0.58578644 1.41421356 2))
ST_CurveToLine03|MULTILINESTRING Z ((5 5 1,3 5 2,3 3 3,0 3 1),(0 0 0,0.00240909 0.09813535 0.28125,0.00963055 0.19603428 0.5625,0.02164698 0.29346095 0.84375,0.03842944 0.39018064 1.125,0.05993749 0.48596036 1.40625,0.08611933 0.58056935 1.6875,0.11691187 0.67377971 1.96875,0.15224093 0.76536686 2.25,0.19202141 0.85511019 2.53125,0.23615747 0.94279347 2.8125,0.28454278 1.02820549 2.875,0.33706078 1.11114047 2.5,0.39358494 1.19139861 2.125,0.45397909 1.26878657 1.75,0.51809775 1.34311791 1.375,0.58578644 1.41421356 1))
ST_CurveToLine04|MULTILINESTRING ZM ((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),(0 0 0 0,0.00240909 0.09813535 0.28125 -0.1875,0.00963055 0.19603428 0.5625 -0.375,0.02164698 0.29346095 0.84375 -0.5625,0.03842944 0.39018064 1.125 -0.75,0.05993749 0.48596036 1.40625 -0.9375,0.08611933 0.58056935 1.6875 -1.125,0.11691187 0.67377971 1.96875 -1.3125,0.15224093 0.76536686 2.25 -1.5,0.19202141 0.85511019 2.53125 -1.6875,0.23615747 0.94279347 2.8125 -1.875,0.28454278 1.02820549 2.875 -1.75,0.33706078 1.11114047 2.5 -1,0.39358494 1.19139861 2.125 -0.25,0.45397909 1.26878657 1.75 0.5,0.51809775 1.34311791 1.375 1.25,0.58578644 1.41421356 1 2))
astext01|MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.414213562373095))
astext02|MULTICURVE M ((5 5 3,3 5 2,3 3 1,0 3 1),CIRCULARSTRING M (0 0 0,0.267949192431123 1 -2,0.585786437626905 1.414213562373095 2))
astext03|MULTICURVE Z ((5 5 1,3 5 2,3 3 3,0 3 1),CIRCULARSTRING Z (0 0 0,0.267949192431123 1 3,0.585786437626905 1.414213562373095 1))
astext04|MULTICURVE ZM ((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),CIRCULARSTRING ZM (0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.414213562373095 1 2))
asewkt01|MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.414213562373095))
asewkt02|MULTICURVEM((5 5 3,3 5 2,3 3 1,0 3 1),CIRCULARSTRINGM(0 0 0,0.267949192431123 1 -2,0.585786437626905 1.414213562373095 2))
asewkt03|MULTICURVE((5 5 1,3 5 2,3 3 3,0 3 1),CIRCULARSTRING(0 0 0,0.267949192431123 1 3,0.585786437626905 1.414213562373095 1))
asewkt04|MULTICURVE((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),CIRCULARSTRING(0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.414213562373095 1 2))
isValid01|t
isValid02|t
isValid03|t
@ -46,10 +46,10 @@ numGeometries01|2
numGeometries02|2
numGeometries03|2
numGeometries04|2
geometryN-201|CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.4142135623731)
geometryN-202|CIRCULARSTRINGM(0 0 0,0.267949192431123 1 -2,0.585786437626905 1.4142135623731 2)
geometryN-203|CIRCULARSTRING(0 0 0,0.267949192431123 1 3,0.585786437626905 1.4142135623731 1)
geometryN-204|CIRCULARSTRING(0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.4142135623731 1 2)
geometryN-201|CIRCULARSTRING(0 0,0.267949192431123 1,0.585786437626905 1.414213562373095)
geometryN-202|CIRCULARSTRINGM(0 0 0,0.267949192431123 1 -2,0.585786437626905 1.414213562373095 2)
geometryN-203|CIRCULARSTRING(0 0 0,0.267949192431123 1 3,0.585786437626905 1.414213562373095 1)
geometryN-204|CIRCULARSTRING(0 0 0 0,0.267949192431123 1 3 -2,0.585786437626905 1.414213562373095 1 2)
geometryN-301|t
geometryN-302|t
geometryN-303|t

View file

@ -776,7 +776,7 @@ round(ST_Length(St_Segmentize(ST_GeographyFromText('LINESTRING(-89.3000030518 28
SELECT '#2232', ST_AsSVG('LINESTRING(0 0, 0.4 0, 0.8 0, 1.2 0,1.6 0, 2 0)'::geometry,1,0);
-- #2307 --
SELECT '#2307', ST_AsText(ST_SnapToGrid(ST_MakeValid('0106000020E6100000010000000103000000010000000A0000004B7DA956B99844C0DB0790FE8B4D1DC010BA74A9AF9444C049AFFC5B8C4D1DC03FC6CC690D9844C0DD67E5628C4D1DC07117B56B0D9844C0C80ABA67C45E1DC0839166ABAF9444C0387D4568C45E1DC010BA74A9AF9444C049AFFC5B8C4D1DC040C3CD74169444C0362EC0608C4D1DC07C1A3B77169444C0DC3ADB40B2641DC03AAE5F68B99844C0242948DEB1641DC04B7DA956B99844C0DB0790FE8B4D1DC0'::geometry),0.0001));
SELECT '#2307', ST_AsText(ST_MakeValid('0106000020E6100000010000000103000000010000000A0000004B7DA956B99844C0DB0790FE8B4D1DC010BA74A9AF9444C049AFFC5B8C4D1DC03FC6CC690D9844C0DD67E5628C4D1DC07117B56B0D9844C0C80ABA67C45E1DC0839166ABAF9444C0387D4568C45E1DC010BA74A9AF9444C049AFFC5B8C4D1DC040C3CD74169444C0362EC0608C4D1DC07C1A3B77169444C0DC3ADB40B2641DC03AAE5F68B99844C0242948DEB1641DC04B7DA956B99844C0DB0790FE8B4D1DC0'::geometry),4);
SELECT '#2409', ST_Summary('GEOMETRYCOLLECTION(MULTISURFACE(POLYGON((0 0, 0 1, 1 1, 1 0, 0 0)),CURVEPOLYGON(COMPOUNDCURVE((0 0, 0 1, 1 1, 1 0, 0 0),CIRCULARSTRING(0 0, 0 1, 1 1, 1 2, 0 0)))),TIN(((0 0, 0 1, 1 1, 0 0))))'::geometry);
@ -792,9 +792,9 @@ SELECT '#2412', ST_AsText(ST_LineToCurve('LINESTRING(0 0,10 0,20 0)'));
SELECT '#2420.1', ST_AsText(ST_LineToCurve('LINESTRING(0 0,10 0,10 10,0 10,0 0)'));
SELECT '#2420.2', ST_AsText(ST_LineToCurve('LINESTRING(0 0,10 0,10 10,0 10)'));
SELECT '#2423', ST_AsText(ST_SnapToGrid(ST_CurveToLine(ST_LineToCurve(
SELECT '#2423', ST_AsText(ST_CurveToLine(ST_LineToCurve(
ST_Intersection(ST_Buffer(ST_Point(0,0),10),ST_MakeEnvelope(-10,0,10,10))
), 4), 1e-5));
), 4), 5);
SELECT '#2424', ST_AsText(ST_SnapToGrid(ST_CurveToLine(
'MULTICURVE(COMPOUNDCURVE((0 0, 10 0),CIRCULARSTRING(10 0, 20 1, 30 10)))',

View file

@ -30,7 +30,7 @@ ERROR: Invalid hex string, length (267) has to be a multiple of two!
#157|ST_Polygon|POLYGON
#157|ST_CurvePolygon|CURVEPOLYGON
#157|ST_CircularString|CIRCULARSTRING
#168|3|MULTIPOLYGON ZM (((4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308)))|IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
#168|3|MULTIPOLYGON ZM (((4275341.969778511 259186.96699306098 1323.762958283311 -1.797693134862316e+308,4275341.969778511 259186.96699306098 1323.762958283311 -1.797693134862316e+308,4275341.969778511 259186.96699306098 1323.762958283311 -1.797693134862316e+308)))|IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
#175|SRID=26915;POINT(482020 4984378)
#178a|0
#178b|5
@ -93,7 +93,7 @@ NOTICE: IllegalArgumentException: Invalid number of points in LinearRing found
#835.11|MULTILINESTRING EMPTY
#835.12|MULTIPOLYGON EMPTY
#650|MULTIPOINT(0 0,1 1,2 2)
#667|SRID=4326;CURVEPOLYGON(CIRCULARSTRING(30 40,-50 39.9999999999999,30 40))
#667|SRID=4326;CURVEPOLYGON(CIRCULARSTRING(30 40,-50 39.99999999999987,30 40))
#677.deprecated|1121395
#677|1121395
#680|01d107000000000000000024c000000000000049400000000000000040
@ -142,7 +142,7 @@ ERROR: First argument must be a LINESTRING
#1060|FFFFFFFF2
#1273|t
#1273.1|t
#1292|GEOMETRYCOLLECTION(POINT(180 90),POLYGON((140 50,150 50,180 50,140 50),(140 60,150 60,180 60,140 60)))
#1292|GEOMETRYCOLLECTION(POINT(180 90),POLYGON((140 50.00000000000001,150 50.00000000000001,180 50.00000000000001,140 50.00000000000001),(140 60.00000000000001,150 60.00000000000001,180 60.00000000000001,140 60.00000000000001)))
NOTICE: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY
NOTICE: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY
#1292.1|POINT(180 85)|POINT(-175 90)
@ -252,7 +252,7 @@ ERROR: invalid GML representation
#2412|LINESTRING(0 0,10 0,20 0)
#2420.1|LINESTRING(0 0,10 0,10 10,0 10,0 0)
#2420.2|LINESTRING(0 0,10 0,10 10,0 10)
#2423|POLYGON((-10 0,-9.2388 3.82683,-7.07107 7.07107,-3.82683 9.2388,0 10,3.82683 9.2388,7.07107 7.07107,9.2388 3.82683,10 0,-10 0))
#2423|POLYGON((-10 0,-9.2388 3.82683,-7.07107 7.07107,-3.82683 9.2388,1.71574e-15 10,3.82683 9.2388,7.07107 7.07107,9.2388 3.82683,10 0,-10 0))
#2424|MULTILINESTRING((0 0,10 0,24 3,30 10))
#2427|POINT(-1 0)
#2168|5340.76237395|5340.76237395|0
@ -267,7 +267,7 @@ ERROR: invalid GML representation
#2788|f|Self-intersection|POINT(1 1)
#2870|Point[GS]
#2956|t
#2985|LINESTRING(20.9511664253809 52.3984560730436)
#2985|LINESTRING(20.951166425380894 52.398456073043555)
#2996|247.44|247.44
#3119a|121
#3119b|291

View file

@ -1,2 +1,2 @@
select ST_Asewkt(ST_SnapToGrid(the_geom,0.00001)) from loadedshp;
select ST_AsText(ST_SnapToGrid(the_geom,0.00001), 5) from loadedshp;

View file

@ -1,2 +1,2 @@
select ST_Asewkt(ST_SnapToGrid(the_geom,0.00001)) from loadedshp;
select ST_AsText(ST_SnapToGrid(the_geom,0.00001), 5) from loadedshp;

View file

@ -1,66 +1,66 @@
SRID=4269;POINT(-74.17782492 41.08263361)
SRID=4269;POINT(-74.44881286 40.50133744)
SRID=4269;POINT(-74.00376358 40.28149688)
SRID=4269;POINT(-75.12863742 39.7797389)
SRID=4269;POINT(-74.57629014 40.85597595)
SRID=4269;POINT(-74.47160401 40.52369066)
SRID=4269;POINT(-75.46891683 39.69688334)
SRID=4269;POINT(-75.11458618 39.70739231)
SRID=4269;POINT(-74.22643701 40.09726563)
SRID=4269;POINT(-74.26766926 40.83522615)
SRID=4269;POINT(-74.42152037 40.76232181)
SRID=4269;POINT(-74.18666598 40.89980341)
SRID=4269;POINT(-74.20201874 40.94448827)
SRID=4269;POINT(-74.31866663 40.6680465)
SRID=4269;POINT(-74.83205963 40.84912898)
SRID=4269;POINT(-74.64402101 39.96633708)
SRID=4269;POINT(-74.22194028 40.09559148)
SRID=4269;POINT(-74.60375255 40.75504208)
SRID=4269;POINT(-74.09376018 40.86569336)
SRID=4269;POINT(-74.4430374 40.77797967)
SRID=4269;POINT(-74.76841703 40.22038455)
SRID=4269;POINT(-74.19078182 40.73914574)
SRID=4269;POINT(-74.19628444 40.79591416)
SRID=4269;POINT(-74.19130306 40.74330253)
SRID=4269;POINT(-74.17636308 40.73783123)
SRID=4269;POINT(-74.53148731 39.49029456)
SRID=4269;POINT(-74.16618054 40.73634864)
SRID=4269;POINT(-74.35732607 40.80076793)
SRID=4269;POINT(-74.17573811 40.73901418)
SRID=4269;POINT(-74.66491581 40.34572735)
SRID=4269;POINT(-74.36625323 40.51061374)
SRID=4269;POINT(-74.17631876 40.74329159)
SRID=4269;POINT(-74.4544664 40.52427239)
SRID=4269;POINT(-74.02836656 40.89756584)
SRID=4269;POINT(-75.00833975 39.82895026)
SRID=4269;POINT(-74.13132221 40.33161528)
SRID=4269;POINT(-74.67999522 39.46203859)
SRID=4269;POINT(-74.08904806 40.9515804)
SRID=4269;POINT(-75.12091068 39.94826917)
SRID=4269;POINT(-74.08628025 40.70929009)
SRID=4269;POINT(-74.73270242 40.27825159)
SRID=4269;POINT(-74.16625303 40.01000431)
SRID=4269;POINT(-75.01837982 40.74472398)
SRID=4269;POINT(-74.65920653 40.34951097)
SRID=4269;POINT(-74.24751143 40.74434122)
SRID=4269;POINT(-74.65122484 40.25151634)
SRID=4269;POINT(-74.43880205 40.4659008)
SRID=4269;POINT(-74.2355417 40.68231466)
SRID=4269;POINT(-74.49892935 40.80763833)
SRID=4269;POINT(-74.0625762 40.73086062)
SRID=4269;POINT(-75.03600164 39.78659251)
SRID=4269;POINT(-75.05591643 39.44084942)
SRID=4269;POINT(-74.39804333 40.50086907)
SRID=4269;POINT(-74.07131567 40.72720191)
SRID=4269;POINT(-74.19117919 40.74196293)
SRID=4269;POINT(-74.02494262 40.74676479)
SRID=4269;POINT(-74.68894668 40.6094749)
SRID=4269;POINT(-74.44600226 40.49825884)
SRID=4269;POINT(-74.19898991 40.85779571)
SRID=4269;POINT(-74.7828046 40.27094999)
SRID=4269;POINT(-74.25017536 40.217432)
SRID=4269;POINT(-74.16960551 40.91844326)
SRID=4269;POINT(-74.75788852 41.06754763)
SRID=4269;POINT(-74.03363729 40.72689071)
SRID=4269;POINT(-74.5760699 40.53743164)
SRID=4269;POINT(-74.43925667 40.77359187)
POINT(-74.17782492 41.08263361)
POINT(-74.44881286 40.50133744)
POINT(-74.00376358 40.28149688)
POINT(-75.12863742 39.7797389)
POINT(-74.57629014 40.85597595)
POINT(-74.47160401 40.52369066)
POINT(-75.46891683 39.69688334)
POINT(-75.11458618 39.70739231)
POINT(-74.22643701 40.09726563)
POINT(-74.26766926 40.83522615)
POINT(-74.42152037 40.76232181)
POINT(-74.18666598 40.89980341)
POINT(-74.20201874 40.94448827)
POINT(-74.31866663 40.6680465)
POINT(-74.83205963 40.84912898)
POINT(-74.64402101 39.96633708)
POINT(-74.22194028 40.09559148)
POINT(-74.60375255 40.75504208)
POINT(-74.09376018 40.86569336)
POINT(-74.4430374 40.77797967)
POINT(-74.76841703 40.22038455)
POINT(-74.19078182 40.73914574)
POINT(-74.19628444 40.79591416)
POINT(-74.19130306 40.74330253)
POINT(-74.17636308 40.73783123)
POINT(-74.53148731 39.49029456)
POINT(-74.16618054 40.73634864)
POINT(-74.35732607 40.80076793)
POINT(-74.17573811 40.73901418)
POINT(-74.66491581 40.34572735)
POINT(-74.36625323 40.51061374)
POINT(-74.17631876 40.74329159)
POINT(-74.4544664 40.52427239)
POINT(-74.02836656 40.89756584)
POINT(-75.00833975 39.82895026)
POINT(-74.13132221 40.33161528)
POINT(-74.67999522 39.46203859)
POINT(-74.08904806 40.9515804)
POINT(-75.12091068 39.94826917)
POINT(-74.08628025 40.70929009)
POINT(-74.73270242 40.27825159)
POINT(-74.16625303 40.01000431)
POINT(-75.01837982 40.74472398)
POINT(-74.65920653 40.34951097)
POINT(-74.24751143 40.74434122)
POINT(-74.65122484 40.25151634)
POINT(-74.43880205 40.4659008)
POINT(-74.2355417 40.68231466)
POINT(-74.49892935 40.80763833)
POINT(-74.0625762 40.73086062)
POINT(-75.03600164 39.78659251)
POINT(-75.05591643 39.44084942)
POINT(-74.39804333 40.50086907)
POINT(-74.07131567 40.72720191)
POINT(-74.19117919 40.74196293)
POINT(-74.02494262 40.74676479)
POINT(-74.68894668 40.6094749)
POINT(-74.44600226 40.49825884)
POINT(-74.19898991 40.85779571)
POINT(-74.7828046 40.27094999)
POINT(-74.25017536 40.217432)
POINT(-74.16960551 40.91844326)
POINT(-74.75788852 41.06754763)
POINT(-74.03363729 40.72689071)
POINT(-74.5760699 40.53743164)
POINT(-74.43925667 40.77359187)

View file

@ -1,66 +1,66 @@
SRID=4269;POINT(-74.17782492 41.08263361)
SRID=4269;POINT(-74.44881286 40.50133744)
SRID=4269;POINT(-74.00376358 40.28149688)
SRID=4269;POINT(-75.12863742 39.7797389)
SRID=4269;POINT(-74.57629014 40.85597595)
SRID=4269;POINT(-74.47160401 40.52369066)
SRID=4269;POINT(-75.46891683 39.69688334)
SRID=4269;POINT(-75.11458618 39.70739231)
SRID=4269;POINT(-74.22643701 40.09726563)
SRID=4269;POINT(-74.26766926 40.83522615)
SRID=4269;POINT(-74.42152037 40.76232181)
SRID=4269;POINT(-74.18666598 40.89980341)
SRID=4269;POINT(-74.20201874 40.94448827)
SRID=4269;POINT(-74.31866663 40.6680465)
SRID=4269;POINT(-74.83205963 40.84912898)
SRID=4269;POINT(-74.64402101 39.96633708)
SRID=4269;POINT(-74.22194028 40.09559148)
SRID=4269;POINT(-74.60375255 40.75504208)
SRID=4269;POINT(-74.09376018 40.86569336)
SRID=4269;POINT(-74.4430374 40.77797967)
SRID=4269;POINT(-74.76841703 40.22038455)
SRID=4269;POINT(-74.19078182 40.73914574)
SRID=4269;POINT(-74.19628444 40.79591416)
SRID=4269;POINT(-74.19130306 40.74330253)
SRID=4269;POINT(-74.17636308 40.73783123)
SRID=4269;POINT(-74.53148731 39.49029456)
SRID=4269;POINT(-74.16618054 40.73634864)
SRID=4269;POINT(-74.35732607 40.80076793)
SRID=4269;POINT(-74.17573811 40.73901418)
SRID=4269;POINT(-74.66491581 40.34572735)
SRID=4269;POINT(-74.36625323 40.51061374)
SRID=4269;POINT(-74.17631876 40.74329159)
SRID=4269;POINT(-74.4544664 40.52427239)
SRID=4269;POINT(-74.02836656 40.89756584)
SRID=4269;POINT(-75.00833975 39.82895026)
SRID=4269;POINT(-74.13132221 40.33161528)
SRID=4269;POINT(-74.67999522 39.46203859)
SRID=4269;POINT(-74.08904806 40.9515804)
SRID=4269;POINT(-75.12091068 39.94826917)
SRID=4269;POINT(-74.08628025 40.70929009)
SRID=4269;POINT(-74.73270242 40.27825159)
SRID=4269;POINT(-74.16625303 40.01000431)
SRID=4269;POINT(-75.01837982 40.74472398)
SRID=4269;POINT(-74.65920653 40.34951097)
SRID=4269;POINT(-74.24751143 40.74434122)
SRID=4269;POINT(-74.65122484 40.25151634)
SRID=4269;POINT(-74.43880205 40.4659008)
SRID=4269;POINT(-74.2355417 40.68231466)
SRID=4269;POINT(-74.49892935 40.80763833)
SRID=4269;POINT(-74.0625762 40.73086062)
SRID=4269;POINT(-75.03600164 39.78659251)
SRID=4269;POINT(-75.05591643 39.44084942)
SRID=4269;POINT(-74.39804333 40.50086907)
SRID=4269;POINT(-74.07131567 40.72720191)
SRID=4269;POINT(-74.19117919 40.74196293)
SRID=4269;POINT(-74.02494262 40.74676479)
SRID=4269;POINT(-74.68894668 40.6094749)
SRID=4269;POINT(-74.44600226 40.49825884)
SRID=4269;POINT(-74.19898991 40.85779571)
SRID=4269;POINT(-74.7828046 40.27094999)
SRID=4269;POINT(-74.25017536 40.217432)
SRID=4269;POINT(-74.16960551 40.91844326)
SRID=4269;POINT(-74.75788852 41.06754763)
SRID=4269;POINT(-74.03363729 40.72689071)
SRID=4269;POINT(-74.5760699 40.53743164)
SRID=4269;POINT(-74.43925667 40.77359187)
POINT(-74.17782492 41.08263361)
POINT(-74.44881286 40.50133744)
POINT(-74.00376358 40.28149688)
POINT(-75.12863742 39.7797389)
POINT(-74.57629014 40.85597595)
POINT(-74.47160401 40.52369066)
POINT(-75.46891683 39.69688334)
POINT(-75.11458618 39.70739231)
POINT(-74.22643701 40.09726563)
POINT(-74.26766926 40.83522615)
POINT(-74.42152037 40.76232181)
POINT(-74.18666598 40.89980341)
POINT(-74.20201874 40.94448827)
POINT(-74.31866663 40.6680465)
POINT(-74.83205963 40.84912898)
POINT(-74.64402101 39.96633708)
POINT(-74.22194028 40.09559148)
POINT(-74.60375255 40.75504208)
POINT(-74.09376018 40.86569336)
POINT(-74.4430374 40.77797967)
POINT(-74.76841703 40.22038455)
POINT(-74.19078182 40.73914574)
POINT(-74.19628444 40.79591416)
POINT(-74.19130306 40.74330253)
POINT(-74.17636308 40.73783123)
POINT(-74.53148731 39.49029456)
POINT(-74.16618054 40.73634864)
POINT(-74.35732607 40.80076793)
POINT(-74.17573811 40.73901418)
POINT(-74.66491581 40.34572735)
POINT(-74.36625323 40.51061374)
POINT(-74.17631876 40.74329159)
POINT(-74.4544664 40.52427239)
POINT(-74.02836656 40.89756584)
POINT(-75.00833975 39.82895026)
POINT(-74.13132221 40.33161528)
POINT(-74.67999522 39.46203859)
POINT(-74.08904806 40.9515804)
POINT(-75.12091068 39.94826917)
POINT(-74.08628025 40.70929009)
POINT(-74.73270242 40.27825159)
POINT(-74.16625303 40.01000431)
POINT(-75.01837982 40.74472398)
POINT(-74.65920653 40.34951097)
POINT(-74.24751143 40.74434122)
POINT(-74.65122484 40.25151634)
POINT(-74.43880205 40.4659008)
POINT(-74.2355417 40.68231466)
POINT(-74.49892935 40.80763833)
POINT(-74.0625762 40.73086062)
POINT(-75.03600164 39.78659251)
POINT(-75.05591643 39.44084942)
POINT(-74.39804333 40.50086907)
POINT(-74.07131567 40.72720191)
POINT(-74.19117919 40.74196293)
POINT(-74.02494262 40.74676479)
POINT(-74.68894668 40.6094749)
POINT(-74.44600226 40.49825884)
POINT(-74.19898991 40.85779571)
POINT(-74.7828046 40.27094999)
POINT(-74.25017536 40.217432)
POINT(-74.16960551 40.91844326)
POINT(-74.75788852 41.06754763)
POINT(-74.03363729 40.72689071)
POINT(-74.5760699 40.53743164)
POINT(-74.43925667 40.77359187)

View file

@ -1,2 +1,2 @@
select ST_Asewkt(ST_SnapToGrid(the_geom,0.00000001)) from loadedshp;
select ST_AsText(ST_SnapToGrid(the_geom,0.00000001), 8) from loadedshp;

View file

@ -1,66 +1,66 @@
SRID=4269;POINT(-74.17782492 41.08263361)
SRID=4269;POINT(-74.44881286 40.50133744)
SRID=4269;POINT(-74.00376358 40.28149688)
SRID=4269;POINT(-75.12863742 39.7797389)
SRID=4269;POINT(-74.57629014 40.85597595)
SRID=4269;POINT(-74.47160401 40.52369066)
SRID=4269;POINT(-75.46891683 39.69688334)
SRID=4269;POINT(-75.11458618 39.70739231)
SRID=4269;POINT(-74.22643701 40.09726563)
SRID=4269;POINT(-74.26766926 40.83522615)
SRID=4269;POINT(-74.42152037 40.76232181)
SRID=4269;POINT(-74.18666598 40.89980341)
SRID=4269;POINT(-74.20201874 40.94448827)
SRID=4269;POINT(-74.31866663 40.6680465)
SRID=4269;POINT(-74.83205963 40.84912898)
SRID=4269;POINT(-74.64402101 39.96633708)
SRID=4269;POINT(-74.22194028 40.09559148)
SRID=4269;POINT(-74.60375255 40.75504208)
SRID=4269;POINT(-74.09376018 40.86569336)
SRID=4269;POINT(-74.4430374 40.77797967)
SRID=4269;POINT(-74.76841703 40.22038455)
SRID=4269;POINT(-74.19078182 40.73914574)
SRID=4269;POINT(-74.19628444 40.79591416)
SRID=4269;POINT(-74.19130306 40.74330253)
SRID=4269;POINT(-74.17636308 40.73783123)
SRID=4269;POINT(-74.53148731 39.49029456)
SRID=4269;POINT(-74.16618054 40.73634864)
SRID=4269;POINT(-74.35732607 40.80076793)
SRID=4269;POINT(-74.17573811 40.73901418)
SRID=4269;POINT(-74.66491581 40.34572735)
SRID=4269;POINT(-74.36625323 40.51061374)
SRID=4269;POINT(-74.17631876 40.74329159)
SRID=4269;POINT(-74.4544664 40.52427239)
SRID=4269;POINT(-74.02836656 40.89756584)
SRID=4269;POINT(-75.00833975 39.82895026)
SRID=4269;POINT(-74.13132221 40.33161528)
SRID=4269;POINT(-74.67999522 39.46203859)
SRID=4269;POINT(-74.08904806 40.9515804)
SRID=4269;POINT(-75.12091068 39.94826917)
SRID=4269;POINT(-74.08628025 40.70929009)
SRID=4269;POINT(-74.73270242 40.27825159)
SRID=4269;POINT(-74.16625303 40.01000431)
SRID=4269;POINT(-75.01837982 40.74472398)
SRID=4269;POINT(-74.65920653 40.34951097)
SRID=4269;POINT(-74.24751143 40.74434122)
SRID=4269;POINT(-74.65122484 40.25151634)
SRID=4269;POINT(-74.43880205 40.4659008)
SRID=4269;POINT(-74.2355417 40.68231466)
SRID=4269;POINT(-74.49892935 40.80763833)
SRID=4269;POINT(-74.0625762 40.73086062)
SRID=4269;POINT(-75.03600164 39.78659251)
SRID=4269;POINT(-75.05591643 39.44084942)
SRID=4269;POINT(-74.39804333 40.50086907)
SRID=4269;POINT(-74.07131567 40.72720191)
SRID=4269;POINT(-74.19117919 40.74196293)
SRID=4269;POINT(-74.02494262 40.74676479)
SRID=4269;POINT(-74.68894668 40.6094749)
SRID=4269;POINT(-74.44600226 40.49825884)
SRID=4269;POINT(-74.19898991 40.85779571)
SRID=4269;POINT(-74.7828046 40.27094999)
SRID=4269;POINT(-74.25017536 40.217432)
SRID=4269;POINT(-74.16960551 40.91844326)
SRID=4269;POINT(-74.75788852 41.06754763)
SRID=4269;POINT(-74.03363729 40.72689071)
SRID=4269;POINT(-74.5760699 40.53743164)
SRID=4269;POINT(-74.43925667 40.77359187)
POINT(-74.17782492 41.08263361)
POINT(-74.44881286 40.50133744)
POINT(-74.00376358 40.28149688)
POINT(-75.12863742 39.7797389)
POINT(-74.57629014 40.85597595)
POINT(-74.47160401 40.52369066)
POINT(-75.46891683 39.69688334)
POINT(-75.11458618 39.70739231)
POINT(-74.22643701 40.09726563)
POINT(-74.26766926 40.83522615)
POINT(-74.42152037 40.76232181)
POINT(-74.18666598 40.89980341)
POINT(-74.20201874 40.94448827)
POINT(-74.31866663 40.6680465)
POINT(-74.83205963 40.84912898)
POINT(-74.64402101 39.96633708)
POINT(-74.22194028 40.09559148)
POINT(-74.60375255 40.75504208)
POINT(-74.09376018 40.86569336)
POINT(-74.4430374 40.77797967)
POINT(-74.76841703 40.22038455)
POINT(-74.19078182 40.73914574)
POINT(-74.19628444 40.79591416)
POINT(-74.19130306 40.74330253)
POINT(-74.17636308 40.73783123)
POINT(-74.53148731 39.49029456)
POINT(-74.16618054 40.73634864)
POINT(-74.35732607 40.80076793)
POINT(-74.17573811 40.73901418)
POINT(-74.66491581 40.34572735)
POINT(-74.36625323 40.51061374)
POINT(-74.17631876 40.74329159)
POINT(-74.4544664 40.52427239)
POINT(-74.02836656 40.89756584)
POINT(-75.00833975 39.82895026)
POINT(-74.13132221 40.33161528)
POINT(-74.67999522 39.46203859)
POINT(-74.08904806 40.9515804)
POINT(-75.12091068 39.94826917)
POINT(-74.08628025 40.70929009)
POINT(-74.73270242 40.27825159)
POINT(-74.16625303 40.01000431)
POINT(-75.01837982 40.74472398)
POINT(-74.65920653 40.34951097)
POINT(-74.24751143 40.74434122)
POINT(-74.65122484 40.25151634)
POINT(-74.43880205 40.4659008)
POINT(-74.2355417 40.68231466)
POINT(-74.49892935 40.80763833)
POINT(-74.0625762 40.73086062)
POINT(-75.03600164 39.78659251)
POINT(-75.05591643 39.44084942)
POINT(-74.39804333 40.50086907)
POINT(-74.07131567 40.72720191)
POINT(-74.19117919 40.74196293)
POINT(-74.02494262 40.74676479)
POINT(-74.68894668 40.6094749)
POINT(-74.44600226 40.49825884)
POINT(-74.19898991 40.85779571)
POINT(-74.7828046 40.27094999)
POINT(-74.25017536 40.217432)
POINT(-74.16960551 40.91844326)
POINT(-74.75788852 41.06754763)
POINT(-74.03363729 40.72689071)
POINT(-74.5760699 40.53743164)
POINT(-74.43925667 40.77359187)

View file

@ -1,2 +1,2 @@
select ST_Asewkt(ST_SnapToGrid(the_geom,0.00000001)) from loadedshp;
select ST_AsText(ST_SnapToGrid(the_geom,0.00000001), 8) from loadedshp;

View file

@ -1,66 +1,66 @@
SRID=4269;POINT(-74.17782492 41.08263361)
SRID=4269;POINT(-74.44881286 40.50133744)
SRID=4269;POINT(-74.00376358 40.28149688)
SRID=4269;POINT(-75.12863742 39.7797389)
SRID=4269;POINT(-74.57629014 40.85597595)
SRID=4269;POINT(-74.47160401 40.52369066)
SRID=4269;POINT(-75.46891683 39.69688334)
SRID=4269;POINT(-75.11458618 39.70739231)
SRID=4269;POINT(-74.22643701 40.09726563)
SRID=4269;POINT(-74.26766926 40.83522615)
SRID=4269;POINT(-74.42152037 40.76232181)
SRID=4269;POINT(-74.18666598 40.89980341)
SRID=4269;POINT(-74.20201874 40.94448827)
SRID=4269;POINT(-74.31866663 40.6680465)
SRID=4269;POINT(-74.83205963 40.84912898)
SRID=4269;POINT(-74.64402101 39.96633708)
SRID=4269;POINT(-74.22194028 40.09559148)
SRID=4269;POINT(-74.60375255 40.75504208)
SRID=4269;POINT(-74.09376018 40.86569336)
SRID=4269;POINT(-74.4430374 40.77797967)
SRID=4269;POINT(-74.76841703 40.22038455)
SRID=4269;POINT(-74.19078182 40.73914574)
SRID=4269;POINT(-74.19628444 40.79591416)
SRID=4269;POINT(-74.19130306 40.74330253)
SRID=4269;POINT(-74.17636308 40.73783123)
SRID=4269;POINT(-74.53148731 39.49029456)
SRID=4269;POINT(-74.16618054 40.73634864)
SRID=4269;POINT(-74.35732607 40.80076793)
SRID=4269;POINT(-74.17573811 40.73901418)
SRID=4269;POINT(-74.66491581 40.34572735)
SRID=4269;POINT(-74.36625323 40.51061374)
SRID=4269;POINT(-74.17631876 40.74329159)
SRID=4269;POINT(-74.4544664 40.52427239)
SRID=4269;POINT(-74.02836656 40.89756584)
SRID=4269;POINT(-75.00833975 39.82895026)
SRID=4269;POINT(-74.13132221 40.33161528)
SRID=4269;POINT(-74.67999522 39.46203859)
SRID=4269;POINT(-74.08904806 40.9515804)
SRID=4269;POINT(-75.12091068 39.94826917)
SRID=4269;POINT(-74.08628025 40.70929009)
SRID=4269;POINT(-74.73270242 40.27825159)
SRID=4269;POINT(-74.16625303 40.01000431)
SRID=4269;POINT(-75.01837982 40.74472398)
SRID=4269;POINT(-74.65920653 40.34951097)
SRID=4269;POINT(-74.24751143 40.74434122)
SRID=4269;POINT(-74.65122484 40.25151634)
SRID=4269;POINT(-74.43880205 40.4659008)
SRID=4269;POINT(-74.2355417 40.68231466)
SRID=4269;POINT(-74.49892935 40.80763833)
SRID=4269;POINT(-74.0625762 40.73086062)
SRID=4269;POINT(-75.03600164 39.78659251)
SRID=4269;POINT(-75.05591643 39.44084942)
SRID=4269;POINT(-74.39804333 40.50086907)
SRID=4269;POINT(-74.07131567 40.72720191)
SRID=4269;POINT(-74.19117919 40.74196293)
SRID=4269;POINT(-74.02494262 40.74676479)
SRID=4269;POINT(-74.68894668 40.6094749)
SRID=4269;POINT(-74.44600226 40.49825884)
SRID=4269;POINT(-74.19898991 40.85779571)
SRID=4269;POINT(-74.7828046 40.27094999)
SRID=4269;POINT(-74.25017536 40.217432)
SRID=4269;POINT(-74.16960551 40.91844326)
SRID=4269;POINT(-74.75788852 41.06754763)
SRID=4269;POINT(-74.03363729 40.72689071)
SRID=4269;POINT(-74.5760699 40.53743164)
SRID=4269;POINT(-74.43925667 40.77359187)
POINT(-74.17782492 41.08263361)
POINT(-74.44881286 40.50133744)
POINT(-74.00376358 40.28149688)
POINT(-75.12863742 39.7797389)
POINT(-74.57629014 40.85597595)
POINT(-74.47160401 40.52369066)
POINT(-75.46891683 39.69688334)
POINT(-75.11458618 39.70739231)
POINT(-74.22643701 40.09726563)
POINT(-74.26766926 40.83522615)
POINT(-74.42152037 40.76232181)
POINT(-74.18666598 40.89980341)
POINT(-74.20201874 40.94448827)
POINT(-74.31866663 40.6680465)
POINT(-74.83205963 40.84912898)
POINT(-74.64402101 39.96633708)
POINT(-74.22194028 40.09559148)
POINT(-74.60375255 40.75504208)
POINT(-74.09376018 40.86569336)
POINT(-74.4430374 40.77797967)
POINT(-74.76841703 40.22038455)
POINT(-74.19078182 40.73914574)
POINT(-74.19628444 40.79591416)
POINT(-74.19130306 40.74330253)
POINT(-74.17636308 40.73783123)
POINT(-74.53148731 39.49029456)
POINT(-74.16618054 40.73634864)
POINT(-74.35732607 40.80076793)
POINT(-74.17573811 40.73901418)
POINT(-74.66491581 40.34572735)
POINT(-74.36625323 40.51061374)
POINT(-74.17631876 40.74329159)
POINT(-74.4544664 40.52427239)
POINT(-74.02836656 40.89756584)
POINT(-75.00833975 39.82895026)
POINT(-74.13132221 40.33161528)
POINT(-74.67999522 39.46203859)
POINT(-74.08904806 40.9515804)
POINT(-75.12091068 39.94826917)
POINT(-74.08628025 40.70929009)
POINT(-74.73270242 40.27825159)
POINT(-74.16625303 40.01000431)
POINT(-75.01837982 40.74472398)
POINT(-74.65920653 40.34951097)
POINT(-74.24751143 40.74434122)
POINT(-74.65122484 40.25151634)
POINT(-74.43880205 40.4659008)
POINT(-74.2355417 40.68231466)
POINT(-74.49892935 40.80763833)
POINT(-74.0625762 40.73086062)
POINT(-75.03600164 39.78659251)
POINT(-75.05591643 39.44084942)
POINT(-74.39804333 40.50086907)
POINT(-74.07131567 40.72720191)
POINT(-74.19117919 40.74196293)
POINT(-74.02494262 40.74676479)
POINT(-74.68894668 40.6094749)
POINT(-74.44600226 40.49825884)
POINT(-74.19898991 40.85779571)
POINT(-74.7828046 40.27094999)
POINT(-74.25017536 40.217432)
POINT(-74.16960551 40.91844326)
POINT(-74.75788852 41.06754763)
POINT(-74.03363729 40.72689071)
POINT(-74.5760699 40.53743164)
POINT(-74.43925667 40.77359187)

View file

@ -1,66 +1,66 @@
SRID=4269;POINT(-74.17782492 41.08263361)
SRID=4269;POINT(-74.44881286 40.50133744)
SRID=4269;POINT(-74.00376358 40.28149688)
SRID=4269;POINT(-75.12863742 39.7797389)
SRID=4269;POINT(-74.57629014 40.85597595)
SRID=4269;POINT(-74.47160401 40.52369066)
SRID=4269;POINT(-75.46891683 39.69688334)
SRID=4269;POINT(-75.11458618 39.70739231)
SRID=4269;POINT(-74.22643701 40.09726563)
SRID=4269;POINT(-74.26766926 40.83522615)
SRID=4269;POINT(-74.42152037 40.76232181)
SRID=4269;POINT(-74.18666598 40.89980341)
SRID=4269;POINT(-74.20201874 40.94448827)
SRID=4269;POINT(-74.31866663 40.6680465)
SRID=4269;POINT(-74.83205963 40.84912898)
SRID=4269;POINT(-74.64402101 39.96633708)
SRID=4269;POINT(-74.22194028 40.09559148)
SRID=4269;POINT(-74.60375255 40.75504208)
SRID=4269;POINT(-74.09376018 40.86569336)
SRID=4269;POINT(-74.4430374 40.77797967)
SRID=4269;POINT(-74.76841703 40.22038455)
SRID=4269;POINT(-74.19078182 40.73914574)
SRID=4269;POINT(-74.19628444 40.79591416)
SRID=4269;POINT(-74.19130306 40.74330253)
SRID=4269;POINT(-74.17636308 40.73783123)
SRID=4269;POINT(-74.53148731 39.49029456)
SRID=4269;POINT(-74.16618054 40.73634864)
SRID=4269;POINT(-74.35732607 40.80076793)
SRID=4269;POINT(-74.17573811 40.73901418)
SRID=4269;POINT(-74.66491581 40.34572735)
SRID=4269;POINT(-74.36625323 40.51061374)
SRID=4269;POINT(-74.17631876 40.74329159)
SRID=4269;POINT(-74.4544664 40.52427239)
SRID=4269;POINT(-74.02836656 40.89756584)
SRID=4269;POINT(-75.00833975 39.82895026)
SRID=4269;POINT(-74.13132221 40.33161528)
SRID=4269;POINT(-74.67999522 39.46203859)
SRID=4269;POINT(-74.08904806 40.9515804)
SRID=4269;POINT(-75.12091068 39.94826917)
SRID=4269;POINT(-74.08628025 40.70929009)
SRID=4269;POINT(-74.73270242 40.27825159)
SRID=4269;POINT(-74.16625303 40.01000431)
SRID=4269;POINT(-75.01837982 40.74472398)
SRID=4269;POINT(-74.65920653 40.34951097)
SRID=4269;POINT(-74.24751143 40.74434122)
SRID=4269;POINT(-74.65122484 40.25151634)
SRID=4269;POINT(-74.43880205 40.4659008)
SRID=4269;POINT(-74.2355417 40.68231466)
SRID=4269;POINT(-74.49892935 40.80763833)
SRID=4269;POINT(-74.0625762 40.73086062)
SRID=4269;POINT(-75.03600164 39.78659251)
SRID=4269;POINT(-75.05591643 39.44084942)
SRID=4269;POINT(-74.39804333 40.50086907)
SRID=4269;POINT(-74.07131567 40.72720191)
SRID=4269;POINT(-74.19117919 40.74196293)
SRID=4269;POINT(-74.02494262 40.74676479)
SRID=4269;POINT(-74.68894668 40.6094749)
SRID=4269;POINT(-74.44600226 40.49825884)
SRID=4269;POINT(-74.19898991 40.85779571)
SRID=4269;POINT(-74.7828046 40.27094999)
SRID=4269;POINT(-74.25017536 40.217432)
SRID=4269;POINT(-74.16960551 40.91844326)
SRID=4269;POINT(-74.75788852 41.06754763)
SRID=4269;POINT(-74.03363729 40.72689071)
SRID=4269;POINT(-74.5760699 40.53743164)
SRID=4269;POINT(-74.43925667 40.77359187)
POINT(-74.17782492 41.08263361)
POINT(-74.44881286 40.50133744)
POINT(-74.00376358 40.28149688)
POINT(-75.12863742 39.7797389)
POINT(-74.57629014 40.85597595)
POINT(-74.47160401 40.52369066)
POINT(-75.46891683 39.69688334)
POINT(-75.11458618 39.70739231)
POINT(-74.22643701 40.09726563)
POINT(-74.26766926 40.83522615)
POINT(-74.42152037 40.76232181)
POINT(-74.18666598 40.89980341)
POINT(-74.20201874 40.94448827)
POINT(-74.31866663 40.6680465)
POINT(-74.83205963 40.84912898)
POINT(-74.64402101 39.96633708)
POINT(-74.22194028 40.09559148)
POINT(-74.60375255 40.75504208)
POINT(-74.09376018 40.86569336)
POINT(-74.4430374 40.77797967)
POINT(-74.76841703 40.22038455)
POINT(-74.19078182 40.73914574)
POINT(-74.19628444 40.79591416)
POINT(-74.19130306 40.74330253)
POINT(-74.17636308 40.73783123)
POINT(-74.53148731 39.49029456)
POINT(-74.16618054 40.73634864)
POINT(-74.35732607 40.80076793)
POINT(-74.17573811 40.73901418)
POINT(-74.66491581 40.34572735)
POINT(-74.36625323 40.51061374)
POINT(-74.17631876 40.74329159)
POINT(-74.4544664 40.52427239)
POINT(-74.02836656 40.89756584)
POINT(-75.00833975 39.82895026)
POINT(-74.13132221 40.33161528)
POINT(-74.67999522 39.46203859)
POINT(-74.08904806 40.9515804)
POINT(-75.12091068 39.94826917)
POINT(-74.08628025 40.70929009)
POINT(-74.73270242 40.27825159)
POINT(-74.16625303 40.01000431)
POINT(-75.01837982 40.74472398)
POINT(-74.65920653 40.34951097)
POINT(-74.24751143 40.74434122)
POINT(-74.65122484 40.25151634)
POINT(-74.43880205 40.4659008)
POINT(-74.2355417 40.68231466)
POINT(-74.49892935 40.80763833)
POINT(-74.0625762 40.73086062)
POINT(-75.03600164 39.78659251)
POINT(-75.05591643 39.44084942)
POINT(-74.39804333 40.50086907)
POINT(-74.07131567 40.72720191)
POINT(-74.19117919 40.74196293)
POINT(-74.02494262 40.74676479)
POINT(-74.68894668 40.6094749)
POINT(-74.44600226 40.49825884)
POINT(-74.19898991 40.85779571)
POINT(-74.7828046 40.27094999)
POINT(-74.25017536 40.217432)
POINT(-74.16960551 40.91844326)
POINT(-74.75788852 41.06754763)
POINT(-74.03363729 40.72689071)
POINT(-74.5760699 40.53743164)
POINT(-74.43925667 40.77359187)

View file

@ -1,2 +1,2 @@
select ST_Asewkt(ST_SnapToGrid(the_geom::geometry,0.00000001)) from loadedshp;
select ST_AsText(ST_SnapToGrid(the_geom::geometry,0.00000001), 8) from loadedshp;

View file

@ -1,66 +1,66 @@
SRID=4269;POINT(-74.17782492 41.08263361)
SRID=4269;POINT(-74.44881286 40.50133744)
SRID=4269;POINT(-74.00376358 40.28149688)
SRID=4269;POINT(-75.12863742 39.7797389)
SRID=4269;POINT(-74.57629014 40.85597595)
SRID=4269;POINT(-74.47160401 40.52369066)
SRID=4269;POINT(-75.46891683 39.69688334)
SRID=4269;POINT(-75.11458618 39.70739231)
SRID=4269;POINT(-74.22643701 40.09726563)
SRID=4269;POINT(-74.26766926 40.83522615)
SRID=4269;POINT(-74.42152037 40.76232181)
SRID=4269;POINT(-74.18666598 40.89980341)
SRID=4269;POINT(-74.20201874 40.94448827)
SRID=4269;POINT(-74.31866663 40.6680465)
SRID=4269;POINT(-74.83205963 40.84912898)
SRID=4269;POINT(-74.64402101 39.96633708)
SRID=4269;POINT(-74.22194028 40.09559148)
SRID=4269;POINT(-74.60375255 40.75504208)
SRID=4269;POINT(-74.09376018 40.86569336)
SRID=4269;POINT(-74.4430374 40.77797967)
SRID=4269;POINT(-74.76841703 40.22038455)
SRID=4269;POINT(-74.19078182 40.73914574)
SRID=4269;POINT(-74.19628444 40.79591416)
SRID=4269;POINT(-74.19130306 40.74330253)
SRID=4269;POINT(-74.17636308 40.73783123)
SRID=4269;POINT(-74.53148731 39.49029456)
SRID=4269;POINT(-74.16618054 40.73634864)
SRID=4269;POINT(-74.35732607 40.80076793)
SRID=4269;POINT(-74.17573811 40.73901418)
SRID=4269;POINT(-74.66491581 40.34572735)
SRID=4269;POINT(-74.36625323 40.51061374)
SRID=4269;POINT(-74.17631876 40.74329159)
SRID=4269;POINT(-74.4544664 40.52427239)
SRID=4269;POINT(-74.02836656 40.89756584)
SRID=4269;POINT(-75.00833975 39.82895026)
SRID=4269;POINT(-74.13132221 40.33161528)
SRID=4269;POINT(-74.67999522 39.46203859)
SRID=4269;POINT(-74.08904806 40.9515804)
SRID=4269;POINT(-75.12091068 39.94826917)
SRID=4269;POINT(-74.08628025 40.70929009)
SRID=4269;POINT(-74.73270242 40.27825159)
SRID=4269;POINT(-74.16625303 40.01000431)
SRID=4269;POINT(-75.01837982 40.74472398)
SRID=4269;POINT(-74.65920653 40.34951097)
SRID=4269;POINT(-74.24751143 40.74434122)
SRID=4269;POINT(-74.65122484 40.25151634)
SRID=4269;POINT(-74.43880205 40.4659008)
SRID=4269;POINT(-74.2355417 40.68231466)
SRID=4269;POINT(-74.49892935 40.80763833)
SRID=4269;POINT(-74.0625762 40.73086062)
SRID=4269;POINT(-75.03600164 39.78659251)
SRID=4269;POINT(-75.05591643 39.44084942)
SRID=4269;POINT(-74.39804333 40.50086907)
SRID=4269;POINT(-74.07131567 40.72720191)
SRID=4269;POINT(-74.19117919 40.74196293)
SRID=4269;POINT(-74.02494262 40.74676479)
SRID=4269;POINT(-74.68894668 40.6094749)
SRID=4269;POINT(-74.44600226 40.49825884)
SRID=4269;POINT(-74.19898991 40.85779571)
SRID=4269;POINT(-74.7828046 40.27094999)
SRID=4269;POINT(-74.25017536 40.217432)
SRID=4269;POINT(-74.16960551 40.91844326)
SRID=4269;POINT(-74.75788852 41.06754763)
SRID=4269;POINT(-74.03363729 40.72689071)
SRID=4269;POINT(-74.5760699 40.53743164)
SRID=4269;POINT(-74.43925667 40.77359187)
POINT(-74.17782492 41.08263361)
POINT(-74.44881286 40.50133744)
POINT(-74.00376358 40.28149688)
POINT(-75.12863742 39.7797389)
POINT(-74.57629014 40.85597595)
POINT(-74.47160401 40.52369066)
POINT(-75.46891683 39.69688334)
POINT(-75.11458618 39.70739231)
POINT(-74.22643701 40.09726563)
POINT(-74.26766926 40.83522615)
POINT(-74.42152037 40.76232181)
POINT(-74.18666598 40.89980341)
POINT(-74.20201874 40.94448827)
POINT(-74.31866663 40.6680465)
POINT(-74.83205963 40.84912898)
POINT(-74.64402101 39.96633708)
POINT(-74.22194028 40.09559148)
POINT(-74.60375255 40.75504208)
POINT(-74.09376018 40.86569336)
POINT(-74.4430374 40.77797967)
POINT(-74.76841703 40.22038455)
POINT(-74.19078182 40.73914574)
POINT(-74.19628444 40.79591416)
POINT(-74.19130306 40.74330253)
POINT(-74.17636308 40.73783123)
POINT(-74.53148731 39.49029456)
POINT(-74.16618054 40.73634864)
POINT(-74.35732607 40.80076793)
POINT(-74.17573811 40.73901418)
POINT(-74.66491581 40.34572735)
POINT(-74.36625323 40.51061374)
POINT(-74.17631876 40.74329159)
POINT(-74.4544664 40.52427239)
POINT(-74.02836656 40.89756584)
POINT(-75.00833975 39.82895026)
POINT(-74.13132221 40.33161528)
POINT(-74.67999522 39.46203859)
POINT(-74.08904806 40.9515804)
POINT(-75.12091068 39.94826917)
POINT(-74.08628025 40.70929009)
POINT(-74.73270242 40.27825159)
POINT(-74.16625303 40.01000431)
POINT(-75.01837982 40.74472398)
POINT(-74.65920653 40.34951097)
POINT(-74.24751143 40.74434122)
POINT(-74.65122484 40.25151634)
POINT(-74.43880205 40.4659008)
POINT(-74.2355417 40.68231466)
POINT(-74.49892935 40.80763833)
POINT(-74.0625762 40.73086062)
POINT(-75.03600164 39.78659251)
POINT(-75.05591643 39.44084942)
POINT(-74.39804333 40.50086907)
POINT(-74.07131567 40.72720191)
POINT(-74.19117919 40.74196293)
POINT(-74.02494262 40.74676479)
POINT(-74.68894668 40.6094749)
POINT(-74.44600226 40.49825884)
POINT(-74.19898991 40.85779571)
POINT(-74.7828046 40.27094999)
POINT(-74.25017536 40.217432)
POINT(-74.16960551 40.91844326)
POINT(-74.75788852 41.06754763)
POINT(-74.03363729 40.72689071)
POINT(-74.5760699 40.53743164)
POINT(-74.43925667 40.77359187)

View file

@ -1,66 +1,66 @@
SRID=4269;POINT(-74.17782492 41.08263361)
SRID=4269;POINT(-74.44881286 40.50133744)
SRID=4269;POINT(-74.00376358 40.28149688)
SRID=4269;POINT(-75.12863742 39.7797389)
SRID=4269;POINT(-74.57629014 40.85597595)
SRID=4269;POINT(-74.47160401 40.52369066)
SRID=4269;POINT(-75.46891683 39.69688334)
SRID=4269;POINT(-75.11458618 39.70739231)
SRID=4269;POINT(-74.22643701 40.09726563)
SRID=4269;POINT(-74.26766926 40.83522615)
SRID=4269;POINT(-74.42152037 40.76232181)
SRID=4269;POINT(-74.18666598 40.89980341)
SRID=4269;POINT(-74.20201874 40.94448827)
SRID=4269;POINT(-74.31866663 40.6680465)
SRID=4269;POINT(-74.83205963 40.84912898)
SRID=4269;POINT(-74.64402101 39.96633708)
SRID=4269;POINT(-74.22194028 40.09559148)
SRID=4269;POINT(-74.60375255 40.75504208)
SRID=4269;POINT(-74.09376018 40.86569336)
SRID=4269;POINT(-74.4430374 40.77797967)
SRID=4269;POINT(-74.76841703 40.22038455)
SRID=4269;POINT(-74.19078182 40.73914574)
SRID=4269;POINT(-74.19628444 40.79591416)
SRID=4269;POINT(-74.19130306 40.74330253)
SRID=4269;POINT(-74.17636308 40.73783123)
SRID=4269;POINT(-74.53148731 39.49029456)
SRID=4269;POINT(-74.16618054 40.73634864)
SRID=4269;POINT(-74.35732607 40.80076793)
SRID=4269;POINT(-74.17573811 40.73901418)
SRID=4269;POINT(-74.66491581 40.34572735)
SRID=4269;POINT(-74.36625323 40.51061374)
SRID=4269;POINT(-74.17631876 40.74329159)
SRID=4269;POINT(-74.4544664 40.52427239)
SRID=4269;POINT(-74.02836656 40.89756584)
SRID=4269;POINT(-75.00833975 39.82895026)
SRID=4269;POINT(-74.13132221 40.33161528)
SRID=4269;POINT(-74.67999522 39.46203859)
SRID=4269;POINT(-74.08904806 40.9515804)
SRID=4269;POINT(-75.12091068 39.94826917)
SRID=4269;POINT(-74.08628025 40.70929009)
SRID=4269;POINT(-74.73270242 40.27825159)
SRID=4269;POINT(-74.16625303 40.01000431)
SRID=4269;POINT(-75.01837982 40.74472398)
SRID=4269;POINT(-74.65920653 40.34951097)
SRID=4269;POINT(-74.24751143 40.74434122)
SRID=4269;POINT(-74.65122484 40.25151634)
SRID=4269;POINT(-74.43880205 40.4659008)
SRID=4269;POINT(-74.2355417 40.68231466)
SRID=4269;POINT(-74.49892935 40.80763833)
SRID=4269;POINT(-74.0625762 40.73086062)
SRID=4269;POINT(-75.03600164 39.78659251)
SRID=4269;POINT(-75.05591643 39.44084942)
SRID=4269;POINT(-74.39804333 40.50086907)
SRID=4269;POINT(-74.07131567 40.72720191)
SRID=4269;POINT(-74.19117919 40.74196293)
SRID=4269;POINT(-74.02494262 40.74676479)
SRID=4269;POINT(-74.68894668 40.6094749)
SRID=4269;POINT(-74.44600226 40.49825884)
SRID=4269;POINT(-74.19898991 40.85779571)
SRID=4269;POINT(-74.7828046 40.27094999)
SRID=4269;POINT(-74.25017536 40.217432)
SRID=4269;POINT(-74.16960551 40.91844326)
SRID=4269;POINT(-74.75788852 41.06754763)
SRID=4269;POINT(-74.03363729 40.72689071)
SRID=4269;POINT(-74.5760699 40.53743164)
SRID=4269;POINT(-74.43925667 40.77359187)
POINT(-74.17782492 41.08263361)
POINT(-74.44881286 40.50133744)
POINT(-74.00376358 40.28149688)
POINT(-75.12863742 39.7797389)
POINT(-74.57629014 40.85597595)
POINT(-74.47160401 40.52369066)
POINT(-75.46891683 39.69688334)
POINT(-75.11458618 39.70739231)
POINT(-74.22643701 40.09726563)
POINT(-74.26766926 40.83522615)
POINT(-74.42152037 40.76232181)
POINT(-74.18666598 40.89980341)
POINT(-74.20201874 40.94448827)
POINT(-74.31866663 40.6680465)
POINT(-74.83205963 40.84912898)
POINT(-74.64402101 39.96633708)
POINT(-74.22194028 40.09559148)
POINT(-74.60375255 40.75504208)
POINT(-74.09376018 40.86569336)
POINT(-74.4430374 40.77797967)
POINT(-74.76841703 40.22038455)
POINT(-74.19078182 40.73914574)
POINT(-74.19628444 40.79591416)
POINT(-74.19130306 40.74330253)
POINT(-74.17636308 40.73783123)
POINT(-74.53148731 39.49029456)
POINT(-74.16618054 40.73634864)
POINT(-74.35732607 40.80076793)
POINT(-74.17573811 40.73901418)
POINT(-74.66491581 40.34572735)
POINT(-74.36625323 40.51061374)
POINT(-74.17631876 40.74329159)
POINT(-74.4544664 40.52427239)
POINT(-74.02836656 40.89756584)
POINT(-75.00833975 39.82895026)
POINT(-74.13132221 40.33161528)
POINT(-74.67999522 39.46203859)
POINT(-74.08904806 40.9515804)
POINT(-75.12091068 39.94826917)
POINT(-74.08628025 40.70929009)
POINT(-74.73270242 40.27825159)
POINT(-74.16625303 40.01000431)
POINT(-75.01837982 40.74472398)
POINT(-74.65920653 40.34951097)
POINT(-74.24751143 40.74434122)
POINT(-74.65122484 40.25151634)
POINT(-74.43880205 40.4659008)
POINT(-74.2355417 40.68231466)
POINT(-74.49892935 40.80763833)
POINT(-74.0625762 40.73086062)
POINT(-75.03600164 39.78659251)
POINT(-75.05591643 39.44084942)
POINT(-74.39804333 40.50086907)
POINT(-74.07131567 40.72720191)
POINT(-74.19117919 40.74196293)
POINT(-74.02494262 40.74676479)
POINT(-74.68894668 40.6094749)
POINT(-74.44600226 40.49825884)
POINT(-74.19898991 40.85779571)
POINT(-74.7828046 40.27094999)
POINT(-74.25017536 40.217432)
POINT(-74.16960551 40.91844326)
POINT(-74.75788852 41.06754763)
POINT(-74.03363729 40.72689071)
POINT(-74.5760699 40.53743164)
POINT(-74.43925667 40.77359187)

View file

@ -1,2 +1,2 @@
select ST_Asewkt(ST_SnapToGrid(the_geom::geometry,0.00000001)) from loadedshp;
select ST_AsText(ST_SnapToGrid(the_geom::geometry,0.00000001), 8) from loadedshp;

View file

@ -44,9 +44,9 @@ cross|E|35|sn32|en33
snap|7
snap|36
snap|38
snap|N|34||POINT(18 22.2)
snap|N|35||POINT(22.4 22)
snap|N|36||POINT(21.2 20.4)
snap|N|34||POINT(18 22.200000000000003)
snap|N|35||POINT(22.400000000000002 22)
snap|N|36||POINT(21.200000000000003 20.400000000000002)
snap|E|7|sn17|en35
snap|E|36|sn34|en17
snap|E|37|sn35|en18