A
Allan Bruce
Hi there,
I am dumping a lot of floats to file and wish to reduce the filesize.
This is my main loop (looped several thousand times)
fprintf(fptr, "%f %f %f ", normals[0][0], normals[0][1], normals[0][2]); //
output the normal
fprintf(fptr, "%f %f %f ", v1[0], v1[1], v1[2]); // output the vertice
fprintf(fptr, "%f %f %f ", normals[1][0], normals[1][1], normals[1][2]); //
output the normal
fprintf(fptr, "%f %f %f ", v2[0], v2[1], v2[2]); // output the vertice
fprintf(fptr, "%f %f %f ", normals[2][0], normals[2][1], normals[2][2]); //
output the normal
fprintf(fptr, "%f %f %f ", v3[0], v3[1], v3[2]); // output the vertice
fprintf(fptr, "%f %f %f ", normals[3][0], normals[3][1], normals[3][2]); //
output the normal
fprintf(fptr, "%f %f %f ", v4[0], v4[1], v4[2]); // output the vertice
fprintf(fptr, "\n");// go to next line
Most of my numbers come out as something like 0.500000
Is it possible to truncate these to just 0.5 but without losing precision of
some of the numbers which may use all the decimal places?
Does anybody have any other suggestions about how to cut down on the file
size?
Thanks
Allan
I am dumping a lot of floats to file and wish to reduce the filesize.
This is my main loop (looped several thousand times)
fprintf(fptr, "%f %f %f ", normals[0][0], normals[0][1], normals[0][2]); //
output the normal
fprintf(fptr, "%f %f %f ", v1[0], v1[1], v1[2]); // output the vertice
fprintf(fptr, "%f %f %f ", normals[1][0], normals[1][1], normals[1][2]); //
output the normal
fprintf(fptr, "%f %f %f ", v2[0], v2[1], v2[2]); // output the vertice
fprintf(fptr, "%f %f %f ", normals[2][0], normals[2][1], normals[2][2]); //
output the normal
fprintf(fptr, "%f %f %f ", v3[0], v3[1], v3[2]); // output the vertice
fprintf(fptr, "%f %f %f ", normals[3][0], normals[3][1], normals[3][2]); //
output the normal
fprintf(fptr, "%f %f %f ", v4[0], v4[1], v4[2]); // output the vertice
fprintf(fptr, "\n");// go to next line
Most of my numbers come out as something like 0.500000
Is it possible to truncate these to just 0.5 but without losing precision of
some of the numbers which may use all the decimal places?
Does anybody have any other suggestions about how to cut down on the file
size?
Thanks
Allan