calculate fraction only once