1

Servus, I have a problem with float numbers in PHP. My number is

$cosVQ = 0.907424504992097 

but when I do some math operations $cosVQ, I will receive different results in Javascript and PHP. Or for example wen I do echo I will receive only 0.9074245049920. What am I doing wrong?

user2314737
  • 27,088
  • 20
  • 102
  • 114
Bjørson Bjørson
  • 1,583
  • 1
  • 17
  • 31

2 Answers2

0

You could use number_format:

echo number_format($cosVQ, 15);
Mureinik
  • 297,002
  • 52
  • 306
  • 350
0

Ok I found answer for my question, which works as I wanted: ini_set('precision', 15);

Bjørson Bjørson
  • 1,583
  • 1
  • 17
  • 31