Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は通常、このようなものをグーグルで検索するのが得意ですが、今回は何も見つからないようです。
hereからソースコードをダウンロードしましたが、 という関数を使用していますroundf。
roundf
私はすでに#include <math.h>and を最初に追加しまし#include <cmath>たが、まだ問題があります。関数の起源を見つけることができないようです...
#include <math.h>
#include <cmath>
代替機能はありますか?または、ヘッダーファイルを含めることができるように、それがどこから来たのか知っている人はいますか?
このroundf()関数は C99 で定義されていますが、MSVC は C99 をほとんど実装していないため、Microsoft コンパイラでは使用できません。
roundf()
これを使用できます:
float roundf(float x) { return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f); }