mirror of
https://github.com/janet-lang/janet
synced 2026-09-22 08:58:42 +00:00
Revert float interface - #1822
It is superfluous since we have the double interface. Users can manually cast and be aware they are losing precision.
This commit is contained in:
@@ -362,14 +362,6 @@ uint8_t janet_getuinteger8(const Janet *argv, int32_t n) {
|
||||
return (uint16_t) janet_unwrap_number(x);
|
||||
}
|
||||
|
||||
float janet_getfloat(const Janet *argv, int32_t n) {
|
||||
Janet x = argv[n];
|
||||
if (!janet_checkfloat(x)) {
|
||||
janet_panicf("bad slot #%d, expected float number, got %v", n, x);
|
||||
}
|
||||
return (float) janet_unwrap_number(x);
|
||||
}
|
||||
|
||||
int64_t janet_getinteger64(const Janet *argv, int32_t n) {
|
||||
#ifdef JANET_INT_TYPES
|
||||
return janet_unwrap_s64(argv[n]);
|
||||
|
||||
@@ -945,7 +945,6 @@ JANET_API Janet janet_nanbox32_from_tagp(uint32_t tag, void *pointer);
|
||||
/* End of tagged union implementation */
|
||||
#endif
|
||||
|
||||
JANET_API int janet_checkfloat(Janet x);
|
||||
JANET_API int janet_checkint8(Janet x);
|
||||
JANET_API int janet_checkuint8(Janet x);
|
||||
JANET_API int janet_checkint16(Janet x);
|
||||
@@ -956,7 +955,6 @@ JANET_API int janet_checkint64(Janet x);
|
||||
JANET_API int janet_checkuint64(Janet x);
|
||||
JANET_API int janet_checksize(Janet x);
|
||||
JANET_API JanetAbstract janet_checkabstract(Janet x, const JanetAbstractType *at);
|
||||
#define janet_checkfloatrange(x) ((x) >= FLT_MIN && (x) <= FLT_MAX && (x) == (float)(x))
|
||||
#define janet_checkint8range(x) ((x) >= INT8_MIN && (x) <= INT8_MAX && (x) == (int8_t)(x))
|
||||
#define janet_checkuint8range(x) ((x) >= 0 && (x) <= UINT8_MAX && (x) == (uint8_t)(x))
|
||||
#define janet_checkint16range(x) ((x) >= INT16_MIN && (x) <= INT16_MAX && (x) == (int16_t)(x))
|
||||
|
||||
Reference in New Issue
Block a user