ソフトウェア フローティング エミュレーション (ハードウェア浮動小数点が無効) をサポートする 32 ビットの powerpc カーネルで以下の C++ プログラムを実行すると、条件付き評価が正しくありません。ここで潜在的な問題は何ですか?
#include <stdio.h>
int main() {
int newmax = 1;
if ((newmax + 0.0) > 256) {
printf("\nShouldn't be here\n");
} else {
printf("\nShould be here\n");
}
}
コンパイル:
powerpc-linux-g++ -msoft-float -c floating.cxx
powerpc-linux-g++ -o floating floating.o
ターゲット システムでの出力:
[linux:/]$ ./floating
Shouldn't be here