Penney posts smaller loss than expected, stock up