Z
Z
Zubastik_12018-04-08 01:27:02
PHP
Zubastik_1, 2018-04-08 01:27:02

How to work with numbers like 5.8E-7 in PHP?

For example, how to subtract the number 5.5E-7 from the number 5.8E-7? This option is clearly not correct.$width = 5.8E-7 - 5.5E-7

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cat Anton, 2018-04-08
@27cm

This option is clearly not correct.

Why? https://3v4l.org/Kgdia
If you want to avoid floating point problems, you can use BC Math:
php.net/manual/en/book.bc.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question