diff options
| author | Julian Weigt <juw@posteo.de> | 2026-01-16 19:05:23 +0100 |
|---|---|---|
| committer | Julian Weigt <juw@posteo.de> | 2026-02-04 15:55:54 +0100 |
| commit | 2d7d2f09189d57b47863d2ce89b6a450f4402681 (patch) | |
| tree | e8ac8b38fe3125631d4e6f1be0c068b4600a5b1e /double.c | |
| parent | eefbfcdfc2f2374dcba95a62c31f3162e2247853 (diff) | |
Finish all printing including latex and niceties for printing 0 and 1 and such.
Diffstat (limited to 'double.c')
| -rw-r--r-- | double.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -33,12 +33,24 @@ double valuetype_to_double(double d){ return d; } double inv_exptype_to_double(double d){ return 1.0/d; } -int to_string(char* s, double d){ +int valuetype_to_string(char* s, double d){ sprintf(s,"%f",d); return 0; } +int valuetype_to_latex(char* s, double d){ + if( d == 0.0) sprintf(s,"$0$"); + else if( d == 1.0) sprintf(s,"$1$"); + else sprintf(s,"$%4.3f$",d); + return 0; +} + int root_to_string(char* s, double d, double p){ - to_string(s,pow(d,1/p)); + valuetype_to_string(s,pow(d,1.0/p)); + return 0; +} + +int root_to_latex(char* s, double d, double p){ + valuetype_to_latex(s,pow(d,1.0/p)); return 0; } |
