ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/rcalc.c
(Generate patch)

Comparing ray/src/cal/rcalc.c (file contents):
Revision 1.24 by greg, Sat May 10 01:27:14 2014 UTC vs.
Revision 1.25 by greg, Sat May 10 01:48:14 2014 UTC

# Line 801 | Line 801 | struct field  *f
801   static void
802   putrec(void)                                /* output a record */
803   {
804 <        char  fmt[32], typ[32];
804 >        char  fmt[32], typ[16];
805          int  n;
806          struct field  *f;
807          int  adlast, adnext;
# Line 836 | Line 836 | putrec(void)                                /* output
836                          break;
837                  case T_NUM:
838                          n = f->type & F_WID;
839                        typ[0] = (n <= 6) ? 'g' : 'e';
840                        typ[1] = '\0';
839                          dv = evalue(f->f.ne);
840 <                        if ((av = fabs(dv)) < 1L<<31) {
840 >                        av = fabs(dv);
841 >                        if (n <= 9)
842 >                                strcpy(typ, "g");
843 >                        else
844 >                                sprintf(typ, ".%de", n-5);
845 >                        if (av < 1L<<31) {
846                                  long    iv = (int)(av + .5);
847                                  if (iv && fabs(av-iv) <= av*1e-14)
848                                          strcpy(typ, ".0f");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines