Longitude can be between 0~360 (long3) and -180~180 (long1). To convert from long3 to long1, use the formula below:

long1=mod((long3+180),360)-180

# Python:
long1 = (long3 + 180) % 360 - 180

# Or:
if long3 <= 180: long1 = long3
else: long1 = long3 - 360

To illustrate the values:

long3: 180, 181, ..., 359, 360/0, 1, ..., 179, 180
long1: -180, -179, ... -1, 0, 1, ..., 179, 180