File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,15 @@ static mp_fp_as_int_class_t mp_classify_fp_as_int(mp_float_t val) {
117117 }
118118 // 8 * sizeof(uintptr_t) counts the number of bits for a small int
119119 // TODO provide a way to configure this properly
120+ #if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_B
121+ if (e <= ((8 * sizeof (uintptr_t ) + MP_FLOAT_EXP_BIAS - 4 ) << MP_FLOAT_EXP_SHIFT_I32 )) {
122+ return MP_FP_CLASS_FIT_SMALLINT ;
123+ }
124+ #else
120125 if (e <= ((8 * sizeof (uintptr_t ) + MP_FLOAT_EXP_BIAS - 3 ) << MP_FLOAT_EXP_SHIFT_I32 )) {
121126 return MP_FP_CLASS_FIT_SMALLINT ;
122127 }
128+ #endif
123129 #if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_LONGLONG
124130 if (e <= (((sizeof (long long ) * MP_BITS_PER_BYTE ) + MP_FLOAT_EXP_BIAS - 2 ) << MP_FLOAT_EXP_SHIFT_I32 )) {
125131 return MP_FP_CLASS_FIT_LONGINT ;
You can’t perform that action at this time.
0 commit comments