gpt4 book ai didi

c++ - Boost 数值常量优点

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:45:25 25 4
gpt4 key购买 nike

通过使用 Boost 数值常量,例如 pi<T>,我得到了什么(我猜是在类型安全、性能和准确性方面) , 在 <boost/math/constants/constants.hpp> 中定义而不是包括 <cmath>而是使用 M_PI , 除了编译过程中较暖的计算机 :)?

最佳答案

键入安全且精度更高。

“所有常量都至少精确到 128 位长 double 所需的 34 位十进制数字,并且当与合适的任意精度类型一起使用时,大多数常量都精确到 100 位或更多。”

http://www.boost.org/doc/libs/1_49_0/boost/math/constants/constants.hpp

关于c++ - Boost 数值常量优点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10517908/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com