C/Java では、浮動小数点数の基になる表現は IEEE754-32 であり、二重小数点は IEEE754-64 です。
違う。C 標準では、型間の関係は保証されていましたが、整数型と浮動小数点型のサイズに一定の特定の制限を指定したことはありません。
1 == sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
sizeof(float) <= sizeof(double) <= sizeof(long double)
C 実装では、現在ほとんどが IEEE-754 とその子孫を使用していますが、任意のタイプの浮動小数点形式を使用できます。同様に、1 の補数や符号の大きさなどの整数表現を自由に使用できます。
昇格規則について、C の標準化前のバージョンでは式の float を double に昇格させていましたが、C89/90 では規則が変更され、float * float
結果が返されfloat
ます。
If either operand has type long double, the other operand is converted to long double
Otherwise, if either operand is double, the other operand is converted to double.
Otherwise, if either operand is float, the other operand is converted to float.
C++ 演算子の暗黙的な型変換規則
ただし、仮想マシンでバイトコードを実行し、VM の型がプラットフォーム間で一貫しているため、Java や C# では当てはまります。