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
  • 24,359
  • 17
  • 91
  • 104
Bjørson Bjørson
  • 1,514
  • 1
  • 15
  • 28

2 Answers2

0

You could use number_format:

echo number_format($cosVQ, 15);
Mureinik
  • 277,661
  • 50
  • 283
  • 320
0

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

Bjørson Bjørson
  • 1,514
  • 1
  • 15
  • 28