+ if (logmax > 0.0 && logintv < 0.0)
+ {
+ nrdecs = MIN(6,(int)(ceil(fabs(logintv))));
+ logshift = 0;
+ if (logmax < 12.0)
+ format_string = xasprintf("%%.%dlf",nrdecs);
+ else
+ format_string = xasprintf("%%lg");
+ }
+ else if (logmax > 0.0) /*logintv is > 0*/
+ {
+ if (logintv < 5.0 && logmax < 10.0)
+ {
+ logshift = 0; /* No scientific format */
+ nrdecs = 0;
+ format_string = xstrdup("%.0lf");
+ }
+ else
+ {
+ logshift = (int)logmax;
+ /* Possible intervals are 0.2Ex, 0.5Ex, 1.0Ex */
+ /* log10(0.2E9) = 8.30, log10(0.5E9) = 8.69, log10(1.0E9) = 9 */
+ /* 0.2 and 0.5 need one decimal more. For stability subtract 0.1 */
+ nrdecs = MIN(8,(int)(ceil(logshift-logintv-0.1)));
+ format_string = xasprintf("%%.%dlf×10<sup>%d</sup>",nrdecs,logshift);
+ }
+ }
+ else /* logmax and logintv are < 0 */
+ {
+ if (logmax > -3.0)
+ {
+ logshift = 0; /* No scientific format */
+ nrdecs = MIN(8,(int)(ceil(-logintv)));
+ format_string = xasprintf("%%.%dlf",nrdecs);
+ }
+ else