XSLPformatvalue
XSLPformatvalue |
Purpose
Format a double-precision value in the style of Xpress NonLinear
Synopsis
int XPRS_CC XSLPformatvalue(double dValue, char *Buffer);
Arguments
dValue
|
Double precision value to be formatted.
|
Buffer
|
Character buffer to hold the formatted result. The result will never be more than 15 characters in length including the terminating null character.
|
Example
The following example formats the powers of 16 from -6 to +6 and prints the results:
int i; double Value; char Buffer[16]; Value = 1; for (i=0;i<=6;i++) { XSLPformatvalue(Value,Buffer); printf("\n16^%d = %s",i,Buffer); Value = Value * 16; } Value = 1.0/16.0; for (i=1;i<=6;i++) { XSLPformatvalue(Value,Buffer); printf("\n16^-%d = %s",i,Buffer); Value = Value / 16; } The results are as follows: 16^0 = 1 16^1 = 16 16^2 = 256 16^3 = 4096 16^4 = 65536 16^5 = 1.048576e+006 16^6 = 1.677722e+007 16^-1 = 0.0625 16^-2 = 0.00390625 16^-3 = 0.00024414063 16^-4 = 1.525879e-005 16^-5 = 9.536743e-007 16^-6 = 5.960464e-008
Further information
Trailing zeroes are removed. The decimal point is removed for integers. Numbers with absolute value less than 1.0e-04 or greater than 1.0e+06 are printed in scientific format.