printnum.c

来自「linux平台下类似著名的电路板作图软件 Spice的源代码」· C语言 代码 · 共 33 行

C
33
字号
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group**********//* Print a number in a reasonable form.  This is the sort of thing that * %G does, but more appropriate for spice.  Returns static data. */#include "spice.h"#include "suffix.h"int cp_numdgt = -1;char *printnum(num)    double num;{    static char buf[128];    int n;    if (cp_numdgt > 1)        n = cp_numdgt;    else        n = 6;    if (num < 0.0)        n--;    (void) sprintf(buf, "%.*le", n, num);    return (buf);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?