From baf990e65c62f42e45fe25ac385db9536d3f1788 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 27 Apr 2025 16:49:38 -0400 Subject: Update stdlib to use `print` instead of `printf` in all cases. This means bringing in fpconv to do float-to-string conversion and a few updates to integer and number methods for string formatting. --- src/stdlib/nums.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/stdlib/nums.h') diff --git a/src/stdlib/nums.h b/src/stdlib/nums.h index 5871c904..fdd9e227 100644 --- a/src/stdlib/nums.h +++ b/src/stdlib/nums.h @@ -21,9 +21,8 @@ Text_t Num$as_text(const void *f, bool colorize, const TypeInfo_t *type); PUREFUNC int32_t Num$compare(const void *x, const void *y, const TypeInfo_t *type); PUREFUNC bool Num$equal(const void *x, const void *y, const TypeInfo_t *type); CONSTFUNC bool Num$near(double a, double b, double ratio, double absolute); -Text_t Num$format(double f, Int_t precision); -Text_t Num$scientific(double f, Int_t precision); -Text_t Num$percent(double f, Int_t precision); +Text_t Num$percent(double f, double precision); +double CONSTFUNC Num$with_precision(double num, double precision); double Num$mod(double num, double modulus); double Num$mod1(double num, double modulus); CONSTFUNC bool Num$isinf(double n); @@ -76,9 +75,8 @@ Text_t Num32$as_text(const void *f, bool colorize, const TypeInfo_t *type); PUREFUNC int32_t Num32$compare(const void *x, const void *y, const TypeInfo_t *type); PUREFUNC bool Num32$equal(const void *x, const void *y, const TypeInfo_t *type); CONSTFUNC bool Num32$near(float a, float b, float ratio, float absolute); -Text_t Num32$format(float f, Int_t precision); -Text_t Num32$scientific(float f, Int_t precision); -Text_t Num32$percent(float f, Int_t precision); +Text_t Num32$percent(float f, float precision); +float CONSTFUNC Num32$with_precision(float num, float precision); float Num32$mod(float num, float modulus); float Num32$mod1(float num, float modulus); CONSTFUNC bool Num32$isinf(float n); -- cgit v1.2.3