used snprintf to format e, f and g specifier