The adjusted basis for determining the gain or loss from the sale or other disposition of property, whenever acquired, shall be the basis (determined under section 1012 or other applicable sections of this subchapter and subchapters C (relating to corporate distributions and adjustments), K (relating to partners and partnerships), and P (relating to capital gains and losses)), adjusted as provided in section 1016.
If a deduction is allowable under section 170 (relating to charitable contributions) by reason of a sale, then the adjusted basis for determining the gain from such sale shall be that portion of the adjusted basis which bears the same ratio to the adjusted basis as the amount realized bears to the fair market value of the property.