简体   繁体   English

如何使float表现为double?

[英]How to make float behave as double?

Is there some compiler flag in gcc to consider floats as doubles ? 在gcc中是否有一些编译器标志将浮点数视为双精度数? I tried 我试过了

#define float double

but it creates havoc in many headers and compilation fails stating 但它在许多标题中造成破坏,编译失败说明

ublic/sdk/inc/crt/float.h:5:40: fatal error: ../include/double.h: No such file or directory
At that line it was including float

I then tried doing 然后我尝试了

  typedef float double;

but it fails saying 但它没说

 error: multiple types in one declaration

I am looking at some compiler flag which can do this for me. 我正在寻找一些可以为我做这个的编译器标志。

There is no such thing. 哪有这回事。 That's why you use different types. 这就是你使用不同类型的原因。 What you could do is replace " float " by " double " in your source code. 您可以做的是在源代码中将“float”替换为“double”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM