To do calculations with all the comments, you have to fetch them first, and run a loop to do whatever you wish (which you didn’t clearly state, so I can’t write an accurate answer).
To do so, you can use get_comments()
:
// Get the comments for the current post
$comments = get_comments();
// Run a loop and do stuff
foreach( $comments as $comment ){
// Do your calculation here. You can access the
// comment's ID by using $comment->ID;
}
Take a look at the codex page that I provided, to see a full list of possible parameters and returned values.