I
I
igoodmood2015-09-17 15:50:47
css
igoodmood, 2015-09-17 15:50:47

How to leave only 2 decimal places (not round) after the decimal point?

There is a number 31.400000000000002
I need to get 31.40
I know how to round, but I haven’t found a solution yet

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
igumenov, 2019-04-23
@igumenov

Apply alignment for the wrapper
with something like align-items: center;

A
angru, 2015-09-17
@angru

"{0:.2f}".format(31.40000000000000000002)

L
Lulzsec, 2015-09-17
@Lulzsec

number_format function

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question