Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29280 Discussions

Best way to write to fixed field format

Le_Callet__Morgan_M
427 Views

Dear all,

I am looking at the best way to write float and double value to a fixed filed format string (say 8 in length).

Over the year we have tried different format depending on the data but with the recent version of the compilers we have noticed some over flow or loss of accuracy.

Is there a generic way to ensure that we have the maximum accuracy when writing a number into a string considering the following special consideration:  70.6 can be written as -.0706+3.

Is there a guaranteed way to remove the leading 0 for value with a decimal point ?

Many thanks.

Dear all,

I am looking at the best way to write float and double value to a fixed filed format string (say 8 in length).

Over the year we have tried different format depending on the data but with the recent version of the compilers we have noticed some over flow or loss of accuracy.

Is there a generic way to ensure that we have the maximum accuracy when writing a number into a string considering the following special consideration:  70.6 can be written as -.0706+3.

Is there a guaranteed way to remove the leading 0 for value with a decimal point ?

Many thanks.

0 Kudos
1 Reply
Kenneth_C_Intel
Employee
427 Views
I see you posted this in our Windows forum https://software.intel.com/en-us/forums/topic/517564.  Did the advice on G0 format answer your question? 
 
-Ken
0 Kudos
Reply