Python‎ > ‎decimal‎ > ‎

Decimal.radix()


Definition
Return Decimal(10), the radix (base) in which the Decimal class doesall its arithmetic.

Syntax
Decimal(x).radix()-> Decimal(base)

Parameters
x=Decimal value

Examples
The return with following:
 >>> Decimal(1).radix()
Decimal('10')
>>> Decimal(100.00).radix()
Decimal('10')
>>> Decimal(0).radix()
Decimal('10')
>>> Decimal(1.1).radix()
Decimal('10')
>>> 


The return is:
from decimal import Decimal
import operator

a=Decimal(1).radix()
b=Decimal('10')
w=Decimal(a).radix().__eq__(b)
print("The value of a is equal to b: ", w)
>>>
The value of a is equal to b:  True
>>>

The value is equal to:
 from decimal import Decimal
import operator

a=Decimal(1).radix()
b=(Decimal('20'))
x=operator.gt(a,b)
print("The value of a is greater than b: ", x)
>>> 
The value of a is greater than b: False
>>>

The return is:
 from decimal import Decimal
import operator

a=Decimal(1).radix()
b=Decimal(1.3).next_toward(2)
y=operator.lt(a,b)
print("The value a lesser than b: ", y)
>>>
The value a lesser than b: False
>>>



Comments