; qualified middle-Income building For purposes of this section— (1) Qualified basis (A) Determination The qualified basis of any qualified middle-income building for any taxable year is an amount equal to— (i) the applicable fraction (determined as of the close of such taxable year) of (ii) the eligible basis of such building (determined under subsection (d)). (B) Applicable fraction For purposes of subparagraph (A), the term applicable fraction means the smaller of the unit fraction or the floor space fraction. (C) Unit fraction For purposes of subparagraph (B), the term unit fraction means the fraction— (i) the numerator of which is the number of middle-income units in the building, and (ii) the denominator of which is the number of residential rental units (whether or not occupied) in such building. (D) Floor space fraction For purposes of subparagraph (B), the term floor space fraction means the fraction— (i) the numerator of which is the total floor space of the middle-income units in such building, and (ii) the denominator of which is the total floor space of the residential rental units (whether or not occupied) in such building. (2) Qualified middle-income building The term qualified middle-income building means any building which is part of a qualified middle-income housing project at all times during the period— (A) beginning on the 1st day in the credit period on which such building is part of such a project, and (B) ending on the last day of the credit period with respect to such building. (d) Eligible basis For purposes of this section— (1) New buildings The eligible basis of a new building is its adjusted basis as of the close of the 1st taxable year of the credit period. (2) Existing buildings (A) In general The eligible basis of an existing building is— (i) in the case of a building which meets the requirements of subparagraph (B), its adjusted basis as of the close of the 1st taxable year of the credit period, and (ii) zero in any other case. (B) Requirements A building meets the requirements of