hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit f24d7709d5a2c26db8c070ebe7d2fa8203c9e40a
parent b4ab34f84703c578f69cd87ec58e352a1f7dea37
Author: Drew DeVault <sir@cmpwn.com>
Date:   Thu,  6 May 2021 14:06:19 -0400

strconv: partially implement floatingtosb

Diffstat:
Mstrconv/numeric.ha | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/strconv/numeric.ha b/strconv/numeric.ha @@ -56,7 +56,11 @@ export fn integertos(n: types::integer) const str = integertosb(n, base::DEC); // is statically allocated and will be overwritten on subsequent calls; see // [[strings::dup]] to duplicate the result. export fn floatingtosb(n: types::floating, b: base) const str = { - abort(); // TODO + assert(b == base::DEC); + return match (n) { + f: f32 => abort(), // TODO + f: f64 => f64tos(f), + }; }; // Converts any [[types::floating]] to a string in base 10. The return value is