Python‎ > ‎decimal‎ > ‎

Decimal.adjusted()


Introduction
Return the adjusted exponent of the number which is equal to exp + digits - 1.

Syntax
Decimal().adjusted()

Parameters
Decimal() takes numeric value
adjusted() takes no arguments

Examples
The return are:
 >>> Decimal(-1355).adjusted()
3
>>> Decimal(-1).adjusted()
0
>>>

if min(map(lambda(decimal,decimal)).__gt__()
The method returns with the minimum value in the sets equation set1/set2*set2 is greater than 2. 
from decimal import*
set1={Decimal(-1355).adjusted(),Decimal(-233.321).copy_negate(), Decimal(-23.99).exp()}
set2={ Decimal(2.0).fma(3,7),Decimal(1.1).log10()}
if min(map(lambda a,b: a/b*b, set1, set2)).__gt__(2):
        print("Return is greater than 2.")
else:
        print("Not within parameters")

>>> 
Return is greater than 2.
>>>       


input(Decimal().adjusted())
The method return decimal values in various decimal methods through input() method.
from decimal import Decimal

print("Python Decimal Methods")
a=Decimal(input("Enter Decimal Value: "))

print("Your value in Decimal().adjusted()) method is: ", Decimal(a).adjusted())

print("---------------------------------------------------------------------------------")
print("While other methods return your value as: ")
print("Your value in Decimal().as_tuple(() method is: ", Decimal(a).as_tuple())

print("---------------------------------------------------------------------------------")
print("Your value in Decimal().canonical() method is: ", Decimal(a).canonical())

print("---------------------------------------------------------------------------------")
print("Your value in Decimal().compare(your value-1) method is: ", Decimal(a).compare(a-1))

print("---------------------------------------------------------------------------------")
print("Your value in Decimal().compare_signal(3)) method is: ", Decimal(a).compare_signal(3))

>>> 
Python Decimal Methods
Enter Decimal Value: 55
Your value in Decimal().adjusted()) method is: 1
---------------------------------------------------------------------------------
While other methods return your value as: 
Your value in Decimal().as_tuple(() method is: DecimalTuple(sign=0, digits=(5, 5), exponent=0)
---------------------------------------------------------------------------------
Your value in Decimal().canonical() method is: 55
---------------------------------------------------------------------------------
Your value in Decimal().compare(your value-1) method is: 1
---------------------------------------------------------------------------------
Your value in Decimal().compare_signal(3)) method is: 1
>>>

set(Decimal)
The return is after pop() the item:
 >>> from decimal import Decimal
>>> a=set()
>>> a.add(Decimal(1).adjusted())
>>> a.add(Decimal(.55).canonical())
>>> a.add(Decimal(-1).compare_signal(1))
>>> a
{0, Decimal('0.5500000000000000444089209850062616169452667236328125'), Decimal('-1')}
>>> b=set()
>>> b.add(Decimal(1).compare_total(2))
>>> b.add(Decimal(0.1).copy_abs())
>>> b
{Decimal('0.1000000000000000055511151231257827021181583404541015625'), Decimal('-1')}
>>> a.pop()
Decimal('-1')
>>> a.union(b)
{Decimal('0.1000000000000000055511151231257827021181583404541015625'), Decimal('-1')}


Comments