[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: number->string of float with radix
From: |
Marius Vollmer |
Subject: |
Re: number->string of float with radix |
Date: |
18 Oct 2002 23:53:09 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Bill Schottstaedt <address@hidden> writes:
> standard input:1:1: Wrong type argument in position 2 (expecting INUMP): 2.0
>
> "INUMP" is internal jargon -- "integer" or "exact integer" would be better.
Yes, I agree. Our error messages suck generally, I'd say. If you
want to work on this, I'd say we should define a new macro
#define SCM_MAKE_VALIDATE2(pos, val, test, msg) \
do { \
SCM_ASSERT_TYPE (test, val, pos, FUNC_NAME, msg); \
} while (0)
and then incrementally replace uses of SCM_MAKE_VALIDATE with improved
versions. Or use SCM_ASSERT_TYPE directly. Hmm.
> Also, I wonder about these kinds of calls:
>
> guile> (number->string 10.5 2)
> "10.5"
>
> It's actually not senseless to have base-2 float notation ("1010.1",
> "a.8" hex), but if Guile just returns base 10, maybe it should warn
> the caller? Otherwise, for example, string->number does not invert
> number->string:
>
> guile> (string->number "10.5" 2)
> #f
Yes. We are in clear violation of R5RS here. I'll record a bug for
this in the workbook.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405