Convert int64_t to double

前端 未结 4 1725
野趣味
野趣味 2021-02-07 05:31
  int64_t a = 1234;

  double d = (double) a;

Is this the recommended way?

4条回答
  •  迷失自我
    2021-02-07 05:56

    You should use static_cast or rely on the implicit cast instead:

    int64_t a = 1234;
    double d = static_cast(a);
    double f = a;
    

提交回复
热议问题