在php中将指数数转换为十进制

2022-01-09 00:00:00 floating-point decimal php

我有一个指数格式的浮点数,即 4.1595246940817E-17,我想将其转换为十进制数,如 2.99 等.

I have a floating point number in exponential format i.e. 4.1595246940817E-17 and I want to convert it into decimal number like 2.99 etc.

任何帮助将不胜感激.

format_number() sprintf() 似乎对我不起作用.

format_number() sprintf() don't seem to be working for me.

推荐答案

你需要一个更好的数学扩展,比如 BC Math, GMP... 来处理更精确的精度.

You need a better math extension like BC Math, GMP... to handle the more precise precision.

浮点数的限制 &整数

相关文章