Implement writeRealAP and writeDoubleAP