-1
5.6063031659674E-8
0.049384616190426
0.041345497234064
0.013279709725645
0.3620935249019
4.5741615668742E-6
0.0454423017838
9.6445838196105E-6
3.1555173304188E-7
5.8474349007938E-7
1.8171531995817E-5
0.0015936353073957
9.9344709993503E-8
1.3762311862235E-6
0.01668723044222
0.00015548477586444
1.3631509003722E-7
0.00016099844756336
2.2468529825075E-6
7.1749367787711E-6
1.3941796415447E-7
1.4811123370548E-11

I tries number_format or round functions but results are wrong , the proper result would be this :

5.6063
0.0493
0.0413
0.0132
0.3620
4.5741
0.0454
9.6445
3.1555
5.8474
1.8171
0.0015
9.9344
1.3762
0.0166
0.0001
1.3631
0.0001
2.2468
7.1749
1.3941
1.4811
Mac Taylor
  • 5,020
  • 14
  • 50
  • 73
  • 1
    Possible duplicate of [Set precision for a float number in PHP](https://stackoverflow.com/questions/19875583/set-precision-for-a-float-number-in-php) – Derek Pollard Jun 12 '18 at 17:26
  • If that is so please do that in a demo and show me you can do that with number_format ! look at the E- part , I myself think the only possible way is to cut it and act as it is a string not a number !?! – Mac Taylor Jun 12 '18 at 17:28
  • https://eval.in/1019979 , this demo , if you put a number from the question on this demo , you can see , it returns error. – Mac Taylor Jun 12 '18 at 17:31
  • 1
    Because that's not valid C code: https://eval.in/1019985 – AbraCadaver Jun 12 '18 at 17:35
  • 1
    What are you actually trying to accomplish here, and why? You cannot simply discard the exponent part of the number without completely destroying what your data represents. – Sammitch Jun 12 '18 at 18:05

1 Answers1

-1

Try the following, because I think all other math related functions will not give the result you want.

$str =(string) 5.6063031659674E-8; $str = substr($str,0,6);

Sugumar Venkatesan
  • 4,019
  • 8
  • 46
  • 77