diff --git a/crates/nu-command/src/conversions/into/int.rs b/crates/nu-command/src/conversions/into/int.rs index 4af37771d9..801ec760b4 100644 --- a/crates/nu-command/src/conversions/into/int.rs +++ b/crates/nu-command/src/conversions/into/int.rs @@ -169,7 +169,32 @@ pub fn action(input: &Value, span: Span, radix: u32, little_endian: bool) -> Val } Value::Filesize { val, .. } => Value::Int { val: *val, span }, Value::Float { val, .. } => Value::Int { - val: *val as i64, + val: { + if radix == 10 { + *val as i64 + } else { + match convert_int( + &Value::Int { + val: *val as i64, + span, + }, + span, + radix, + ) + .as_i64() + { + Ok(v) => v, + _ => { + return Value::Error { + error: ShellError::UnsupportedInput( + "Could not convert float to integer".to_string(), + span, + ), + } + } + } + } + }, span, }, Value::String { val, .. } => {