add round(), round1(), round6() expr functions

This commit is contained in:
stefan schippers 2026-01-30 18:58:45 +01:00
parent 6d86b73c81
commit cee25ab335
2 changed files with 6 additions and 1 deletions

View File

@ -33,6 +33,8 @@ static double toint(double x);
static void get_expr(double x);
static void get_char(int c);
static double rnd6(double x) {return round_to_n_digits(x, 6);}
static double rnd1(double x) {return round_to_n_digits(x, 1);}
static double rnd(double x) {return my_round(x);}
struct fn
{
@ -54,7 +56,9 @@ struct fn fn_array[]
{"ln" , log, 0},
{"exp" , exp, 0},
{"sqrt" , sqrt, 0},
{"round" , rnd6, 0},
{"round6" , rnd6, 0},
{"round1" , rnd1, 0},
{"round" , rnd, 0},
{"pi" , NULL, 3.141592653589793},
{"e" , NULL, 2.718281828459045},
{"k" , NULL, 1.380649e-23},

View File

@ -3119,6 +3119,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(force || !has_x || !xctx->modified || save(1, 0) != -1 ) { /* save(1)==-1 --> user cancel */
char win_path[WINDOW_PATH_SIZE];
int skip = 0;
if(has_x) tcleval("store_geom . [xschem get schname]");
dbg(1, "scheduler(): load: filename=%s\n", f);
my_strncpy(f, abs_sym_path(f, ""), S(f));
if(!force && f[0] && check_loaded(f, win_path) &&