~vcs-imports/gnumeric/master

« back to all changes in this revision

Viewing changes to src/gutils.c

  • Committer: Morten Welinder
  • Date: 2023-11-23 02:48:47 UTC
  • Revision ID: git-v1:057cbe5d7ea115c8e9190821bdad67bed05e9ca4
Tests: add exporter test for cplex and lpsolve formats.

This just exercises the code path.  We don't actually currently test
much here.

Show diffs side-by-side

added added

removed removed

Lines of Context:
674
674
void
675
675
gnm_string_add_number (GString *buf, gnm_float d)
676
676
{
677
 
        size_t old_len = buf->len;
678
 
        double d2;
679
 
        static int digits;
680
 
 
681
 
        if (digits == 0) {
682
 
                gnm_float l10 = gnm_log10 (FLT_RADIX);
683
 
                digits = (int)gnm_ceil (GNM_MANT_DIG * l10) +
684
 
                        (l10 == (int)l10 ? 0 : 1);
685
 
        }
686
 
 
687
 
        g_string_append_printf (buf, "%.*" GNM_FORMAT_g, digits - 1, d);
688
 
        d2 = gnm_strto (buf->str + old_len, NULL);
689
 
 
690
 
        if (d != d2) {
691
 
                g_string_truncate (buf, old_len);
692
 
                g_string_append_printf (buf, "%.*" GNM_FORMAT_g, digits, d);
693
 
        }
 
677
        go_dtoa (buf, "!" GNM_FORMAT_g, d);
694
678
}
695
679
 
696
680
/* ------------------------------------------------------------------------- */