Software Archive
Read-only legacy content
17061 Discussions

keeping same precision

Intel_C_Intel
Employee
214 Views
I think I already know the answer to this, but does anyone know of a technique or function that allows me to read in a real number and output it with the same number of digits after the decimal point? In other words, reading in 123.456 and 123.45 in F8.0 format and then writing out 123.456 and 123.45 in F8.3 and F8.2 format automatically. I am writing a version converter program that reads in input files of the old version and then rewrites them in the new version format and can't arbitrarily decide how many digits after the decimal point to write out because of the variation in the input data.

I think I can write a routine to do this (would have to convert reals to character values), but it would be complicated and was hoping that someone had already decided this was a useful feature and implemented it somewhere.

Tom
0 Kudos
1 Reply
Intel_C_Intel
Employee
214 Views
Well, I feel like a fool - just read it in as A8 and write it out as A8.

Tom
0 Kudos
Reply