Is there a floating point literal suffix in C++ to make a number double precision?

后端 未结 4 865
耶瑟儿~
耶瑟儿~ 2021-01-04 01:26

I\'m currently working on a C++ project which does numerical calculations. The vast, vast majority of the code uses single precision floating point values and works perfectl

4条回答
  •  半阙折子戏
    2021-01-04 02:06

    You can't define your own suffix, but maybe a macro like

    #define D(x) (double(x##L))
    

    would work for you. The compiler ought to just emit a double constant, and appears to with -O2 on my system.

提交回复
热议问题