office-gobmx/sal/Library_sal.mk
Mike Kaganski 9eb9083ff2 Use Dragonbox to implement doubleTo*String*
This header-only library is accurate in decimal representation of
doubles; provides API that allows to create custom representation
- so it's possible to use custom decimal separators and grouping.

This allows to unify all corner cases: integers, numbers close to
DBL_MAX, up-rounding to the next decade.

Note that Dragonbox creates the shortest decimal representation
of the number, that is unambiguously convertible back to the same
number; thus it may hide trailing digits that are unneeded for
such conversion.

The functional changes are minimal, and beneficial:
1. Rounding numbers close to DBL_MAX now takes into account the
bEraseTrailingDecZeros argument, as it should, allowing to have
"1.8E+308" for rounding DBL_MAX to 2 decimals without trailing
zeroes, instead of previous "1.80E+308".
2. Incorrect rounding is fixed in some cases, e.g. 9.9999999999999929
rounded to 10 previously using rtl_math_DecimalPlaces_Max.
3. Representing the number in the shortest way may change display
of some printed numbers. E.g., 5th greatest double is represented
as "1.797693134862315E+308" instead of a bit longer, but giving
the same double on roundtrip, "1.7976931348623149E+308". This would
generally look better for some numbers similar to the famous 0.1,
where users would likely expect more "round" representation where
it's unambiguous (but we still truncate to 15 significant decimals
anyway - so there's no point in pretending to provide exact digits
for actual binary representation).

These are reflected in the unit tests affected by the change.

Change-Id: I05e20274a30eec499593ee3e9ec070e1269232a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129948
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-02-17 21:46:58 +01:00

259 lines
5.6 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Library_Library,sal))
$(eval $(call gb_Library_set_soversion_script,sal,$(SRCDIR)/sal/util/sal.map))
$(eval $(call gb_Library_set_precompiled_header,sal,sal/inc/pch/precompiled_sal))
$(eval $(call gb_Library_set_is_ure_library_or_dependency,sal))
$(eval $(call gb_Library_set_include,sal,\
$$(INCLUDE) \
-I$(SRCDIR)/sal/inc \
$(BACKTRACE_CFLAGS) \
))
$(eval $(call gb_Library_add_defs,sal,\
$(if $(filter FUZZERS,$(BUILD_TYPE)), \
-DFORCE_DEFAULT_SIGNAL \
) \
$(if $(filter iOS,$(OS)), \
-DNO_CHILD_PROCESSES \
) \
-DSAL_DLLIMPLEMENTATION \
-DRTL_OS="\"$(RTL_OS)\"" \
-DRTL_ARCH="\"$(RTL_ARCH)\"" \
-DSRCDIR="\"$(SRCDIR)\"" \
$(call gb_CondLibSalTextenc,-DCOND_LIB_SAL_TEXTENC) \
))
$(eval $(call gb_Library_use_libraries,sal,\
$(if $(filter ANDROID,$(OS)), \
lo-bootstrap \
) \
))
$(eval $(call gb_Library_use_externals,sal,\
dragonbox \
dtoa \
valgrind \
zlib \
))
$(eval $(call gb_Library_use_system_win32_libs,sal,\
advapi32 \
comdlg32 \
dbghelp \
mpr \
ole32 \
shell32 \
user32 \
userenv \
wer \
ws2_32 \
))
$(eval $(call gb_Library_add_libs,sal,\
$(if $(filter LINUX,$(OS)), \
-ldl \
-lrt \
) \
$(if $(filter SOLARIS,$(OS)), \
-lnsl \
-lsocket \
) \
$(if $(filter HAIKU,$(OS)), \
-lnetwork \
) \
$(BACKTRACE_LIBS) \
))
ifeq ($(OS),MACOSX)
$(eval $(call gb_Library_use_system_darwin_frameworks,sal,\
Carbon \
CoreFoundation \
Foundation \
$(if $(ENABLE_MACOSX_SANDBOX),Security) \
))
endif
$(eval $(call gb_Library_add_exception_objects,sal,\
sal/osl/all/compat \
sal/osl/all/debugbase \
sal/osl/all/filepath \
sal/osl/all/loadmodulerelative \
sal/osl/all/log \
sal/osl/all/mutexshared \
sal/osl/all/signalshared \
sal/osl/all/utility \
sal/rtl/alloc_arena \
sal/rtl/alloc_cache \
sal/rtl/alloc_fini \
sal/rtl/alloc_global \
sal/rtl/bootstrap \
sal/rtl/byteseq \
sal/rtl/cipher \
sal/rtl/cmdargs \
sal/rtl/crc \
sal/rtl/digest \
sal/rtl/hash \
sal/rtl/locale \
sal/rtl/math \
sal/rtl/random \
sal/rtl/rtl_process \
sal/rtl/strbuf \
sal/rtl/strimp \
sal/rtl/string \
sal/rtl/unload \
sal/rtl/uri \
sal/rtl/ustrbuf \
sal/rtl/ustring \
sal/rtl/uuid \
sal/textenc/converter \
sal/textenc/convertsimple \
sal/textenc/handleundefinedunicodetotextchar \
sal/textenc/tcvtutf8 \
sal/textenc/tencinfo \
sal/textenc/textcvt \
sal/textenc/textenc \
sal/textenc/unichars \
))
ifeq ($(OS),iOS)
$(eval $(call gb_Library_add_cxxflags,sal,\
$(gb_OBJCXXFLAGS) \
))
endif
ifeq (,$(call gb_CondLibSalTextenc,$(true)))
$(eval $(call gb_Library_add_exception_objects,sal,\
sal/textenc/context \
sal/textenc/convertbig5hkscs \
sal/textenc/converteuctw \
sal/textenc/convertgb18030 \
sal/textenc/convertisciidevangari \
sal/textenc/convertiso2022cn \
sal/textenc/convertiso2022jp \
sal/textenc/convertiso2022kr \
sal/textenc/convertsinglebytetobmpunicode \
sal/textenc/tables \
sal/textenc/tcvtbyte \
sal/textenc/tcvtmb \
sal/textenc/tcvtutf7 \
))
endif
ifneq ($(OS),WNT)
$(eval $(call gb_Library_add_exception_objects,sal,\
sal/osl/unx/backtraceapi \
sal/osl/unx/conditn \
sal/osl/unx/file \
sal/osl/unx/file_error_transl \
sal/osl/unx/file_misc \
sal/osl/unx/file_path_helper \
sal/osl/unx/file_stat \
sal/osl/unx/file_url \
sal/osl/unx/file_volume \
sal/osl/unx/memory \
sal/osl/unx/module \
sal/osl/unx/mutex \
sal/osl/unx/nlsupport \
sal/osl/unx/pipe \
sal/osl/unx/process \
sal/osl/unx/process_impl \
sal/osl/unx/profile \
sal/osl/unx/random \
sal/osl/unx/readwrite_helper \
sal/osl/unx/salinit \
sal/osl/unx/security \
sal/osl/unx/signal \
sal/osl/unx/socket \
sal/osl/unx/soffice \
sal/osl/unx/tempfile \
sal/osl/unx/thread \
sal/osl/unx/time \
))
# Note that the uunxapi.mm file just includes the uunxapi.cxx one. Ditto for system.mm
ifeq ($(OS),MACOSX)
$(eval $(call gb_Library_add_objcxxobjects,sal,\
sal/osl/unx/uunxapi \
sal/osl/unx/system \
))
else
$(eval $(call gb_Library_add_exception_objects,sal,\
sal/osl/unx/uunxapi \
sal/osl/unx/system \
))
endif
ifneq ($(filter MACOSX iOS,$(OS)),)
$(eval $(call gb_Library_add_exception_objects,sal,\
sal/osl/unx/osxlocale \
))
endif
ifneq ($(OS),WNT)
$(eval $(call gb_Library_add_cobjects,sal,\
sal/osl/unx/backtrace \
))
endif
ifneq ($(filter SPARC64 SPARC,$(CPUNAME)),)
$(eval $(call gb_Library_add_asmobjects,sal,\
sal/osl/unx/asm/interlck_sparc \
))
else
$(eval $(call gb_Library_add_exception_objects,sal,\
sal/osl/unx/interlck \
))
endif
else # $(OS) == WNT
$(eval $(call gb_Library_add_exception_objects,sal,\
sal/osl/w32/backtrace \
sal/osl/w32/conditn \
sal/osl/w32/dllentry \
sal/osl/w32/file \
sal/osl/w32/file_dirvol \
sal/osl/w32/file_error \
sal/osl/w32/file_url \
sal/osl/w32/interlck \
sal/osl/w32/memory \
sal/osl/w32/module \
sal/osl/w32/mutex \
sal/osl/w32/nlsupport \
sal/osl/w32/path_helper \
sal/osl/w32/pipe \
sal/osl/w32/process \
sal/osl/w32/procimpl \
sal/osl/w32/profile \
sal/osl/w32/random \
sal/osl/w32/salinit \
sal/osl/w32/security \
sal/osl/w32/signal \
sal/osl/w32/socket \
sal/osl/w32/tempfile \
sal/osl/w32/thread \
sal/osl/w32/time \
))
endif # ifneq ($(OS),WNT)
ifeq ($(ENABLE_CIPHER_OPENSSL_BACKEND),TRUE)
$(eval $(call gb_Library_add_defs,sal,-DLIBO_CIPHER_OPENSSL_BACKEND))
$(eval $(call gb_Library_use_externals,sal, \
openssl \
openssl_headers \
))
endif
# vim: set noet sw=4 ts=4: