From 9b0845593de2ab181db54523b44a559b987e2f2c Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Wed, 17 Sep 2025 19:15:10 -0700 Subject: [PATCH] Don't name std::fmodf. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The C standard library function fmodf is not guaranteed to be in namespace std, and in fact is not with a default Ubuntu 24.04 installation, leading to the following compile error: ```console Change Dir: '/vcpkg/buildtrees/vcpkg-ci-orange-math/x64-linux-dbg' Run Build Command(s): /vcpkg/downloads/tools/ninja/1.12.1-linux/ninja -v -v -j33 [1/2] /usr/bin/c++ -DOMATH_SUPRESS_SAFETY_CHECKS -DOMATH_VERSION=\"3.5.0\" -isystem /vcpkg/installed/x64-linux/include -fPIC -g -std=gnu++23 -MD -MT CMakeFiles/main.dir/main.cpp.o -MF CMakeFiles/main.dir/main.cpp.o.d -o CMakeFiles/main.dir/main.cpp.o -c /vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/main.cpp FAILED: CMakeFiles/main.dir/main.cpp.o /usr/bin/c++ -DOMATH_SUPRESS_SAFETY_CHECKS -DOMATH_VERSION=\"3.5.0\" -isystem /vcpkg/installed/x64-linux/include -fPIC -g -std=gnu++23 -MD -MT CMakeFiles/main.dir/main.cpp.o -MF CMakeFiles/main.dir/main.cpp.o.d -o CMakeFiles/main.dir/main.cpp.o -c /vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/main.cpp In file included from /vcpkg/installed/x64-linux/include/omath/omath.hpp:22, from /vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/main.cpp:1: /vcpkg/installed/x64-linux/include/omath/color.hpp: In member function ‘constexpr omath::Hsv omath::Color::to_hsv() const’: /vcpkg/installed/x64-linux/include/omath/color.hpp:98:45: error: ‘fmodf’ is not a member of ‘std’; did you mean ‘modf’? 98 | hsv_data.hue = 60.f * (std::fmodf(((green - blue) / delta), 6.f)); | ^~~~~ | modf ninja: build stopped: subcommand failed. ``` Only the 'sufficient additional overloads' of `fmod` are guaranteed to be in `std`. Since this is clearly intended to call the (float, float) overload, explicitly cast `((green - blue) / delta)` (which is a `double`) to `float` and call the name in `std` as suggested by the diagnostic. --- include/omath/color.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/omath/color.hpp b/include/omath/color.hpp index 69e554f..e710a54 100644 --- a/include/omath/color.hpp +++ b/include/omath/color.hpp @@ -95,7 +95,7 @@ namespace omath hsv_data.hue = 0.f; else if (max == red) - hsv_data.hue = 60.f * (std::fmodf(((green - blue) / delta), 6.f)); + hsv_data.hue = 60.f * (std::fmod(static_cast((green - blue) / delta), 6.f)); else if (max == green) hsv_data.hue = 60.f * (((blue - red) / delta) + 2.f); else if (max == blue)