Since most System Administrators do not want to do the formulae by hand, there are 2 easy methods.
First: If you want only 1 partition spanning the whole disk, the easiest will be to use % in parted:
(parted) mkpart primary ext4 0% 100%.
The second method is using this awk script from a bash shell:
awk -v x=$(cat /sys/block/sdb/queue/optimal_io_size) -v y=$(cat /sys/block/sdb/alignment_offset) -v z=$(cat /sys/block/sdb/queue/physical_block_size) ‘BEGIN { print ( x + y ) / z }