4 个解决方案
#1
float在32位和64位下不都是4字节
你先确定你问题是由于float导致的?
另外浮点数可能有精度丢失问题,但如果代码一样,32位与64位也应该是一样的
你先确定你问题是由于float导致的?
另外浮点数可能有精度丢失问题,但如果代码一样,32位与64位也应该是一样的
#2
Collapse AllExpand All Code: All Code: Multiple Code: Visual Basic Code: C# Code: Visual C++ Code: J# Code: JScript
Visual Basic
C#
Visual C++
J#
JScript
Run-Time Library Reference
_set_controlfp
See Also Send Feedback
Sets the floating-point control word.
void __cdecl _set_controlfp(
unsigned int newControl,
unsigned int mask
);
Parameters
newControl
New control-word bit values.
mask
Mask for new control-word bits to set.
Return Value
None.
Remarks
The _set_controlfp is similar to _control87, but it only sets the floating-point control word to newControl. The bits in the values indicate the floating-point control state. The floating-point control state allows the program to change the precision, rounding, and infinity modes in the floating-point math package. You can also mask or unmask floating-point exceptions using _set_controlfp. For more information, see _control87, _controlfp, __control87_2.
This function is deprecated when compiling with /clr (Common Language Runtime Compilation) or /clr:pure because the common language runtime only supports the default floating-point precision.
Requirements
Routine
Required header
Compatibility
_set_controlfp
<float.h>
x86 processor only
For more compatibility information, see Compatibility in the Introduction.
See Also
Concepts
Floating-Point Support
_clear87, _clearfp
_status87, _statusfp, _statusfp2
Send feedback on this topic to Microsoft.
Visual Basic
C#
Visual C++
J#
JScript
Run-Time Library Reference
_set_controlfp
See Also Send Feedback
Sets the floating-point control word.
void __cdecl _set_controlfp(
unsigned int newControl,
unsigned int mask
);
Parameters
newControl
New control-word bit values.
mask
Mask for new control-word bits to set.
Return Value
None.
Remarks
The _set_controlfp is similar to _control87, but it only sets the floating-point control word to newControl. The bits in the values indicate the floating-point control state. The floating-point control state allows the program to change the precision, rounding, and infinity modes in the floating-point math package. You can also mask or unmask floating-point exceptions using _set_controlfp. For more information, see _control87, _controlfp, __control87_2.
This function is deprecated when compiling with /clr (Common Language Runtime Compilation) or /clr:pure because the common language runtime only supports the default floating-point precision.
Requirements
Routine
Required header
Compatibility
_set_controlfp
<float.h>
x86 processor only
For more compatibility information, see Compatibility in the Introduction.
See Also
Concepts
Floating-Point Support
_clear87, _clearfp
_status87, _statusfp, _statusfp2
Send feedback on this topic to Microsoft.
#3
浮点运算是有误差的。
分别按照 32bit 和 64bit 编译的时候,有可能生成不同的指令,计算结果也可能有细微的差别。浮点运算很多的时候,这些误差有可能积累起来,导致运行结果不同。
分别按照 32bit 和 64bit 编译的时候,有可能生成不同的指令,计算结果也可能有细微的差别。浮点运算很多的时候,这些误差有可能积累起来,导致运行结果不同。
#4
64位也有很多种,
l64、f64
32位也同样。
所以跨平台编程不会使用int long float这种模糊的类型。。size32 size 16等这种才会被使用
l64、f64
32位也同样。
所以跨平台编程不会使用int long float这种模糊的类型。。size32 size 16等这种才会被使用
#1
float在32位和64位下不都是4字节
你先确定你问题是由于float导致的?
另外浮点数可能有精度丢失问题,但如果代码一样,32位与64位也应该是一样的
你先确定你问题是由于float导致的?
另外浮点数可能有精度丢失问题,但如果代码一样,32位与64位也应该是一样的
#2
Collapse AllExpand All Code: All Code: Multiple Code: Visual Basic Code: C# Code: Visual C++ Code: J# Code: JScript
Visual Basic
C#
Visual C++
J#
JScript
Run-Time Library Reference
_set_controlfp
See Also Send Feedback
Sets the floating-point control word.
void __cdecl _set_controlfp(
unsigned int newControl,
unsigned int mask
);
Parameters
newControl
New control-word bit values.
mask
Mask for new control-word bits to set.
Return Value
None.
Remarks
The _set_controlfp is similar to _control87, but it only sets the floating-point control word to newControl. The bits in the values indicate the floating-point control state. The floating-point control state allows the program to change the precision, rounding, and infinity modes in the floating-point math package. You can also mask or unmask floating-point exceptions using _set_controlfp. For more information, see _control87, _controlfp, __control87_2.
This function is deprecated when compiling with /clr (Common Language Runtime Compilation) or /clr:pure because the common language runtime only supports the default floating-point precision.
Requirements
Routine
Required header
Compatibility
_set_controlfp
<float.h>
x86 processor only
For more compatibility information, see Compatibility in the Introduction.
See Also
Concepts
Floating-Point Support
_clear87, _clearfp
_status87, _statusfp, _statusfp2
Send feedback on this topic to Microsoft.
Visual Basic
C#
Visual C++
J#
JScript
Run-Time Library Reference
_set_controlfp
See Also Send Feedback
Sets the floating-point control word.
void __cdecl _set_controlfp(
unsigned int newControl,
unsigned int mask
);
Parameters
newControl
New control-word bit values.
mask
Mask for new control-word bits to set.
Return Value
None.
Remarks
The _set_controlfp is similar to _control87, but it only sets the floating-point control word to newControl. The bits in the values indicate the floating-point control state. The floating-point control state allows the program to change the precision, rounding, and infinity modes in the floating-point math package. You can also mask or unmask floating-point exceptions using _set_controlfp. For more information, see _control87, _controlfp, __control87_2.
This function is deprecated when compiling with /clr (Common Language Runtime Compilation) or /clr:pure because the common language runtime only supports the default floating-point precision.
Requirements
Routine
Required header
Compatibility
_set_controlfp
<float.h>
x86 processor only
For more compatibility information, see Compatibility in the Introduction.
See Also
Concepts
Floating-Point Support
_clear87, _clearfp
_status87, _statusfp, _statusfp2
Send feedback on this topic to Microsoft.
#3
浮点运算是有误差的。
分别按照 32bit 和 64bit 编译的时候,有可能生成不同的指令,计算结果也可能有细微的差别。浮点运算很多的时候,这些误差有可能积累起来,导致运行结果不同。
分别按照 32bit 和 64bit 编译的时候,有可能生成不同的指令,计算结果也可能有细微的差别。浮点运算很多的时候,这些误差有可能积累起来,导致运行结果不同。
#4
64位也有很多种,
l64、f64
32位也同样。
所以跨平台编程不会使用int long float这种模糊的类型。。size32 size 16等这种才会被使用
l64、f64
32位也同样。
所以跨平台编程不会使用int long float这种模糊的类型。。size32 size 16等这种才会被使用