Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readonly name="DoubleConversion"
readonly ownership="Google double-conversion Maintainers <floitsch@google.com>"
readonly subtree="Modules/ThirdParty/DoubleConversion/src/double-conversion"
readonly repo="https://github.com/google/double-conversion"
readonly tag="v3.3.0"
readonly tag="v3.4.0"
readonly exact_tree_match=false
readonly paths="
double-conversion/*.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ if("${DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS}" MATCHES "^${DOUBLE_CONVERSIO
message(STATUS "Double correction test returned: ${_double_correction_out}")
endif()
configure_file(double-conversion-configure.h.in double-conversion-configure.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

set(headers
bignum-dtoa.h
Expand Down Expand Up @@ -49,6 +48,12 @@ add_library(itkdouble-conversion
strtod.cc
${headers}
)
target_link_directories(itkdouble-conversion
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:${ITKDoubleConversion_INSTALL_INCLUDE_DIR}>
)

if(ITK_LIBRARY_PROPERTIES)
set_target_properties(itkdouble-conversion PROPERTIES ${ITK_LIBRARY_PROPERTIES})
Expand All @@ -58,8 +63,6 @@ itk_module_target(itkdouble-conversion NO_INSTALL)

#
# install command to set up library install
# given the above PUBLIC_HEADER property set, this
# pulls along all the header files with the library.
install(TARGETS itkdouble-conversion
EXPORT ${ITKDoubleConversion-targets}
RUNTIME DESTINATION "${ITKDoubleConversion_INSTALL_RUNTIME_DIR}" COMPONENT Applications
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ bool DoubleToStringConverter::ToShortestIeeeNumber(
return HandleSpecialValues(value, result_builder);
}

int decimal_point;
int decimal_point = 0;
bool sign;
const int kDecimalRepCapacity = kBase10MaximalLength + 1;
char decimal_rep[kDecimalRepCapacity];
Expand Down Expand Up @@ -405,6 +405,7 @@ void DoubleToStringConverter::DoubleToAscii(double v,
if (mode == PRECISION && requested_digits == 0) {
vector[0] = '\0';
*length = 0;
*point = 0;
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,24 @@ class DoubleToStringConverter {
// kBase10MaximalLength significant digits).
// "-1.7976931348623157e+308", "-1.7976931348623157E308"
// In addition, the buffer must be able to hold the trailing '\0' character.
//
// Since the algorithm finds the shortest number of significant digits, it
// can produce an output that isn't the shortest possible if the
// decimal_in_shortest_high is high enough. For example, the number
// 1e23 could be written as 99999999999999991611392 with 23
// digits, however, it only needs one significant digit 1, and thus the
// result is 100000000000000000000000, which has 24 digits.
bool ToShortest(double value, StringBuilder* result_builder) const {
return ToShortestIeeeNumber(value, result_builder, SHORTEST);
}

// Same as ToShortest, but for single-precision floats.
//
// Since the algorithm finds the shortest number of significant digits, it
// can, in very rare cases, produce an output that isn't the shortest possible.
// For example, the number 1e11f could be written as 99999997952 with 11
// digits, however, it only needs one significant digit 1, and thus the
// result is 100000000000, which has 12 digits.
bool ToShortestSingle(float value, StringBuilder* result_builder) const {
return ToShortestIeeeNumber(value, result_builder, SHORTEST_SINGLE);
}
Expand Down
Loading