Question: Very simple, I want to round my 'base\_price' and 'entry' with the precision, here 0.00001. It doesn't work because it converts it to a scientific number.
How do I do this; I have been stuck for 1 hour.

Some post says to use `output="{:.9f}".format(num)` but it adds some zero after the last 1.

It work with `precision = str(0.0001)` but start from 4 zeros after the dot, it change to scientific numbers and `digit = precision[::-1].find('.')` doesn't work with scientific numbers.

```
precision = str(0.00001) #5 decimals after the dot
print(precision)
base_price=0.0314858333
entry=0.031525

digit = precision[::-1].find('.')
entry_price = float(round(float(entry), digit))
base_price = float(round(float(base_price), digit))
print(entry_price,base_price)

```

Expected result:

```
base_price=0.03148 #5 decimals after the dot
entry=0.03152 #5 decimals after the dot

```

Answer: 
If you want to round to a precision given by a variable, you can just do

```py
precision = 0.00001
entry = 0.031525
entry_price = round(entry / precision) * precision

```
It sounds like you want to truncate the number, so:

```
precision = 0.00001
base_price = 0.0314858333

# use int to truncate the division to the nearest fraction. 
base_price = int(base_price / precision) * precision 
print(base_price) # prints 0.03148

```