From 9ee6a443b71a536f23fe3a8a0cde705085d7ba4d Mon Sep 17 00:00:00 2001 From: Gautam Dhar Date: Wed, 25 Sep 2024 19:46:29 +0530 Subject: [PATCH] 11. testing floating-point changes for macos pre and post arm64 --- .../{linux.yml.disabled => linux.yml} | 0 .github/workflows/macos.yml | 10 +++--- .../{windows.yml.disabled => windows.yml} | 0 README.md | 32 +++++++++---------- ...estUserDefinedConverter_lowerPrecision.cpp | 4 +-- 5 files changed, 23 insertions(+), 23 deletions(-) rename .github/workflows/{linux.yml.disabled => linux.yml} (100%) rename .github/workflows/{windows.yml.disabled => windows.yml} (100%) diff --git a/.github/workflows/linux.yml.disabled b/.github/workflows/linux.yml similarity index 100% rename from .github/workflows/linux.yml.disabled rename to .github/workflows/linux.yml diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 1e4dc92..1a060f9 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -45,11 +45,11 @@ jobs: # macos-13 -> AppleClang-15 , # macos-14 -> AppleClang-15 ] compiler: [ default, g++-14, g++-13, g++-12 ] - exclude: - - os: macos-12 - compiler : g++-13 # https://github.com/panchaBhuta/converter/actions/runs/10863394822/job/30147499006 - - os: macos-13 - compiler : g++-13 # https://github.com/panchaBhuta/converter/actions/runs/10863394822/job/30147499604 + #exclude: + # - os: macos-12 + # compiler : g++-13 # https://github.com/panchaBhuta/converter/actions/runs/10863394822/job/30147499006 + # - os: macos-13 + # compiler : g++-13 # https://github.com/panchaBhuta/converter/actions/runs/10863394822/job/30147499604 runs-on: ${{matrix.os}} steps: - name: Checkout Repo diff --git a/.github/workflows/windows.yml.disabled b/.github/workflows/windows.yml similarity index 100% rename from .github/workflows/windows.yml.disabled rename to .github/workflows/windows.yml diff --git a/README.md b/README.md index f6b6e5d..6f41043 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Converter |--------------|---------|-------------| | [![Linux](https://github.com/panchaBhuta/converter/actions/workflows/linux.yml/badge.svg)](https://github.com/panchaBhuta/converter/actions/workflows/linux.yml) | [![macOS](https://github.com/panchaBhuta/converter/actions/workflows/macos.yml/badge.svg)](https://github.com/panchaBhuta/converter/actions/workflows/macos.yml) | [![Windows](https://github.com/panchaBhuta/converter/actions/workflows/windows.yml/badge.svg)](https://github.com/panchaBhuta/converter/actions/workflows/windows.yml) | -Converter is an easy-to-use C++ `text<->type` conversion library. It supports C++20 (and +Converter is an easy-to-use C++ `text ↔ type` conversion library. It supports C++20 (and later), is header-only and comes with a basic test suite. @@ -19,15 +19,15 @@ Supported Platforms/Compilers Converter is implemented using C++20 with code portable across OS and it's supported compiler's.
Results of last run: -| 🖥️ OS ➡️
🤖 Compiler ⬇️ | **Ubuntu 24.04** | **Ubuntu 22.04** | **macOS-14** | **macOS-13** | **macOS-12** | **Windows 10
VS 17 - 2022** | **Windows 10
VS 16 - 2019** | +| 🖥️ OS ➡️
🤖 Compiler ⬇️ | **Ubuntu 24.04** | **Ubuntu 22.04** | **macOS-14**
(ARM64) | **macOS-13** | **macOS-12** | **Windows 10
VS 17 - 2022** | **Windows 10
VS 16 - 2019** | |------------|------------|------------------|--------------|--------------|--------------|-------------------------------|-------------------------------| -| **g++ 14** | ✅ | - | ❌ | ✅ | ✅ | - | - | -| **g++ 13** | ✅ (default) | ⚠ | ❌ | ❌ | ❌ | - | - | -| **g++ 12** | ✅ | ✅ | ❌ | ✅ | ✅ | - | - | +| **g++ 14** | ✅ | - | ✅ | ✅ | ✅ | - | - | +| **g++ 13** | ✅ (default) | ⚠ | ✅ | ❌ | ❌ | - | - | +| **g++ 12** | ✅ | ✅ | ✅ | ✅ | ✅ | - | - | | **g++ 11** | - | ✅ (default) | - | - | ⚠ | - | - | | **clang++ (18,17,16)** | ✅ (clang++:18) | - | - | - | - | - | - | | **clang++ (15,14,13)** | - | ✅ (clang++:14) | - | - | - | - | - | -| **AppleClang** | - | - | ❌ (15) | ✅ (15) | ✅ (14) | - | - | +| **AppleClang (default)** | - | - | ✅ (15) | ✅ (15) | ✅ (14) | - | - | | **msvc 19** | - | - | - | - | - | ✅ (default) | ❌ (default) | | **clangCL** | - | - | - | - | - | ✅ (v17) | ✅ (v12) | | default Compiler | g++13 | g++11 | AppleClang 15 | AppleClang 15 | AppleClang 14 | msvc 19 | msvc 19 | @@ -95,19 +95,19 @@ Function Nomenclature:
⚔️ : uses `std::from_chars()` and `std::to_chars()` for data conversion.
🛠️ : uses `std::from_string()` and `std::operator<<` workarounds, for data conversion. As complier doesn't support `std::*_chars()` functions. Precision is less compared to above approach.
-Precision Nomenclature ( for roundtrip conversions :: **string -> data-type -> string**):
+Precision Nomenclature ( for roundtrip conversions :: **string ↣ data-type ↣ string**):
✅ : Good. Minimal precision loss, best of the lot.
☑️ : Average. Precision loss is non-uniform, loss can be high for some FP values. -| 🖥️ OS ➡️
🤖 Compiler ⬇️ | **Ubuntu 24.04** | **Ubuntu 22.04** | **macOS-14** | **macOS-13** | **macOS-12** | **macOS-11** | **Windows 10
VS 17 - 2022** | **Windows 10
VS 16 - 2019** | +| 🖥️ OS ➡️
🤖 Compiler ⬇️ | **Ubuntu 24.04** | **Ubuntu 22.04** | **macOS-14**
(ARM64) | **macOS-13** | **macOS-12** | **macOS-11** | **Windows 10
VS 17 - 2022** | **Windows 10
VS 16 - 2019** | |------------|--------------|--------------|--------------|--------------|--------------|--------------|-------------------------------|-------------------------------| -| **g++ 14** | ⚔️ ✅ | - | ❌ | ⚔️ ✅ | ⚔️ ✅ | - | - | - | -| **g++ 13** | ⚔️ ✅ | ⚠ | ❌ | ❌ | ❌ | - | - | - | -| **g++ 12** | ⚔️ ✅ | ⚔️ ✅ | ❌ | ⚔️ ✅ | ⚔️ ✅ | ⚔️ ✅ | - | - | +| **g++ 14** | ⚔️ ✅ | - | ⚔️ ☑️ | ⚔️ ✅ | ⚔️ ✅ | - | - | - | +| **g++ 13** | ⚔️ ✅ | ⚠ | ⚔️ ☑️ | ❌ | ❌ | - | - | - | +| **g++ 12** | ⚔️ ✅ | ⚔️ ✅ | ⚔️ ☑️ | ⚔️ ✅ | ⚔️ ✅ | ⚔️ ✅ | - | - | | **g++ 11** | - | ⚔️ ✅ | - | - | ⚠ | ⚔️ ✅ | - | - | | **clang++ (18,17,16)** | ⚔️ ✅ | - | - | - | - | - | - | - | | **clang++ (15,14,13)** | - | ⚔️ ✅ | - | - | - | - | - | - | -| **AppleClang** | - | - | ❌ | 🛠️ ☑️ (15) | 🛠️ ☑️ (14) | - | - | - | +| **AppleClang (default)** | - | - | 🛠️ ☑️ (15) | 🛠️ ☑️ (15) | 🛠️ ☑️ (14) | - | - | - | | **msvc 19** | - | - | - | - | - | - | ⚔️ ☑️ | ❌ | | **clangCL** | - | - | - | - | - | - | ⚔️ ☑️ (17) | ⚔️ ☑️ (12) | @@ -144,7 +144,7 @@ precision loss happening at steps (2) and (3). The repeatability or read-write accuracy can only be achieved by using higher precision of that specified by precision accuracy for float. -Refer [testFloatingPointPrecision.cpp](tests/testFloatingPointPrecision.cpp) for data-loss in **text -> data-type -> text**, conversion cycle. +Refer [testFloatingPointPrecision.cpp](tests/testFloatingPointPrecision.cpp) for data-loss in **text ↣ data-type ↣ text**, conversion cycle. Refer [testUserDefinedConverter_lowerPrecision.cpp](tests/testUserDefinedConverter_lowerPrecision.cpp), to see the effect of lowered Decimal-Precision when writing the data and then retriving it back. @@ -161,9 +161,9 @@ Date types As of writing this code, `std::chrono` is not fully supported by various OS's, in that case `converter` lib, calls [date](https://github.com/HowardHinnant/date) lib for conversions.
Below table shows, the underlying conversion function(i.e between `std::chrono::*_stream()` or `date::*_stream()`) used across different OS's. Different compilers on a particular OS doesn't have any impact on this selection.
-For _string -> year_month_day_ conversion, refers to call to ...
+For _string ↣ year_month_day_ conversion, refers to call to ...
`std::chrono::year_month_day ConverterFromStr::ToVal(const std::string&)`.
-For _year_month_day -> string_ conversion, refers to call to ...
+For _year_month_day ↣ string_ conversion, refers to call to ...
`std::string ConverterFromVal::ToStr(const std::chrono::year_month_day&)`.
⚔️ : `std::chrono::from_stream()` and `std::chrono::to_stream` are preffered.
@@ -285,7 +285,7 @@ using ConvertFromVal_lDP = converter::ConvertFromVal >; Reading a String with Invalid Numbers (e.g. Empty string) as Numeric Data ========================================================================= -There are four ways to handle error during _string -> type_ conversion. This is achieved by enum `FailureS2Tprocess` and template `OnError`. Refer below. +There are four ways to handle error during _string ↣ type_ conversion. This is achieved by enum `FailureS2Tprocess` and template `OnError`. Refer below. ```c++ enum FailureS2Tprocess { THROW_ERROR = 0, SIGNAL_NAN = 1, QUIET_NAN = 2, VARIANT_NAN = 3 }; diff --git a/tests/testUserDefinedConverter_lowerPrecision.cpp b/tests/testUserDefinedConverter_lowerPrecision.cpp index 8e887f4..0bf5d40 100644 --- a/tests/testUserDefinedConverter_lowerPrecision.cpp +++ b/tests/testUserDefinedConverter_lowerPrecision.cpp @@ -98,13 +98,13 @@ int main() (indexOS==1)? #if MACH_MACOS_ARRAY_IDX == MACH_POST_MACOS14_ARM_CLANG \ || MACH_MACOS_ARRAY_IDX == MACH_POST_MACOS14_ARM_GNU - 14 + 13 //#elif MACH_MACOS_ARRAY_IDX == MACH_PRE_MACOS14_CLANG #else // default MACH_MACOS_ARRAY_IDX == MACH_PRE_MACOS14_GNU 16 // getLowerDecimalPrecision() = 17 digits #endif - :14) + :13) ); checkRoundTripConversion_txt2Val2txt, ConvertFromVal_lDP>("testUserDefinedConverter_lowerPrecision-7",