From cfb8711e504f4005dfe65f2dc6419553d194205c Mon Sep 17 00:00:00 2001 From: Serg Creevanose Date: Sat, 2 Dec 2023 10:52:55 -0800 Subject: [PATCH] Unlimit floating point decimals parsing --- .devcontainer/Dockerfile | 44 ++++++++++++++++++++++------------------ .vscode/settings.json | 2 +- omnn/math/Valuable.cpp | 9 +++++--- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 89acf9983..d9ee9c39b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -45,16 +45,16 @@ RUN echo "sci-libs/fftw threads" >> /etc/portage/package.use/julia RUN echo "dev-cpp/tbb -udev" > /etc/portage/package.use/tbb -RUN emerge --update dev-cpp/tbb -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +RUN emerge --update dev-cpp/tbb -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* -RUN emerge --update dev-vcs/git -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +RUN emerge --update dev-vcs/git -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* -RUN emerge --update -1o dev-util/cmake -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +RUN emerge --update -1o dev-util/cmake -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* -RUN emerge --update dev-util/cmake -j1 && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +RUN emerge --update dev-util/cmake -j1 && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* -RUN emerge --update kde-frameworks/extra-cmake-modules -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* -RUN emerge -j`nproc` leveldb && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +RUN emerge --update kde-frameworks/extra-cmake-modules -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* +RUN emerge -j`nproc` leveldb && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* RUN emerge --update \ app-arch/lz4 \ @@ -66,44 +66,48 @@ RUN emerge --update \ x11-libs/libXScrnSaver \ -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* -#RUN emerge --update dev-lang/julia -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +#RUN emerge --update dev-lang/julia -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* -#RUN emerge -j`nproc` sys-devel/gcc && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +RUN emerge -j`nproc` sys-devel/gcc && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* -RUN (emerge --update sys-devel/clang:18 -j`nproc` || MAKEOPTS=-j1 emerge --update sys-devel/clang:18 -j1) && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +RUN emerge -v --onlydeps sys-devel/llvm:18 -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* +RUN emerge -1 sys-devel/llvm:18 -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* +RUN emerge -1u --onlydeps sys-devel/clang:18 -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* +RUN emerge --update sys-devel/clang:18 -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* +#RUN (emerge --update sys-devel/clang:18 -j`nproc` || MAKEOPTS=-j1 emerge --update sys-devel/clang:18 -j1) && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* -RUN emerge --update =dev-libs/boost-1.82.0-r1 -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +RUN emerge --update =dev-libs/boost-1.82.0-r1 -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* RUN emerge --update \ lld \ - -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* + -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* #RUN emerge --update =dev-libs/boost-1.81.0 -j`nproc` # FoundationDB deps -RUN emerge --update dev-cpp/benchmark dev-cpp/gtest -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* -RUN emerge --update dev-lang/mono -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +RUN emerge --update dev-cpp/benchmark dev-cpp/gtest -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* +RUN emerge --update dev-lang/mono -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* RUN emerge --update \ dev-util/intel-ocl-sdk \ - -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* + -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* RUN emerge --update \ dev-util/vulkan-headers \ media-libs/vulkan-loader \ - -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* + -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* RUN eix-update -RUN emerge --update gdb -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* -#RUN emerge --update dev-util/lldb -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +RUN emerge --update gdb -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* +#RUN emerge --update dev-util/lldb -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* -#RUN emerge --update =dev-lang/julia-1.8.3-r4 -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* -RUN emerge --update =dev-lang/julia-1.8.5-r1 -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* +#RUN emerge --update =dev-lang/julia-1.8.3-r4 -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* +RUN emerge --update =dev-lang/julia-1.8.5-r1 -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* # RUN emerge --update \ app-misc/mc \ bash-completion \ eix \ sys-process/htop \ - -j`nproc` && rm -rf /var/cache/distfiles && rm -rf /var/tmp/portage/* + -j`nproc` && rm -rf /var/cache/distfiles/* && rm -rf /var/tmp/portage/* diff --git a/.vscode/settings.json b/.vscode/settings.json index fa7296131..60ba5d5fa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,7 +8,7 @@ // "cmake.configureSettings": { // "CMAKE_BUILD_PARALLEL_LEVEL": "${nproc}", // }, - "cmake.generator": "Ninja", + "cmake.generator": "Ninja Multi-Config", "extensions": [ "codeium.codeium", "github.copilot", diff --git a/omnn/math/Valuable.cpp b/omnn/math/Valuable.cpp index 0d1644c05..b7529ff06 100644 --- a/omnn/math/Valuable.cpp +++ b/omnn/math/Valuable.cpp @@ -659,15 +659,18 @@ std::string Solid(std::string s) { auto ss = s.substr(i, next - i); Trim(ss); auto hasSpace = ss.find(' ') != std::string::npos; - if (ss.find('.') != std::string::npos) { + auto dot = ss.find('.'); + if (dot != std::string::npos) { std::string s; if(hasSpace){ s = ss; s = Solid(s); ss = s; } - boost::multiprecision::cpp_dec_float_100 fp(ss); - o(Fraction(fp)); + auto beforedot = ss.substr(0, dot); + auto afterdot = ss.substr(dot + 1); + auto f = Integer(beforedot) + Integer(afterdot) / (10_v ^ Integer(afterdot.length())); + o(std::move(f)); } else { Valuable integer = hasSpace ? Integer(Solid(std::string(ss)))