pub fn opcode_flt(&mut self, chunk: &Chunk, i: usize) -> i32 {
        if self.stack.len() < 1 {
            print_error(chunk, i, "flt requires one argument");
            return 0;
        }

        let value_rr = self.stack.pop().unwrap();
        let is_float;
        {
            let value_rrb = value_rr.borrow();
            match *value_rrb {
                Value::Float(_) => {
                    is_float = true;
                }
                _ => {
                    let value_opt = value_rrb.to_float();
                    match value_opt {
                        Some(n) => {
                            self.stack.push(Rc::new(RefCell::new(Value::Float(n))));
                            return 1;
                        }
                        _ => {
                            print_error(chunk, i, "unable to convert argument to float");
                            return 0;
                        }
                    }
                }
            }
        }
        if is_float {
            self.stack.push(value_rr);
        }
        return 1;
    }
/// Convert a value into a floating-point value.
Convert a value into a floating-point value.
Convert a value into a floating - point value .
pub fn opcode_flt(&mut self, chunk: &Chunk, i: usize) -> i32 {
        if self.stack.len() < 1 {
            print_error(chunk, i, "flt requires one argument");
            return 0;
        }
        let value_rr = self.stack.pop().unwrap();
        let is_float;
        {
            let value_rrb = value_rr.borrow();
            match *value_rrb {
                Value::Float(_) => {
                    is_float = true;
                }
                _ => {
                    let value_opt = value_rrb.to_float();
                    match value_opt {
                        Some(n) => {
                            self.stack.push(Rc::new(RefCell::new(Value::Float(n))));
                            return 1;
                        }
                        _ => {
                            print_error(chunk, i, "unable to convert argument to float");
                            return 0;
                        }
                    }
                }
            }
        }
        if is_float {
            self.stack.push(value_rr);
        }
        return 1;
    }
pub fn opcode_flt ( & mut self , chunk : & Chunk , i : usize ) -> i32 { if self . stack . len ( ) < 1 { print_error ( chunk , i , " " ) ; return 0 ; } let value_rr = self . stack . pop ( ) . unwrap ( ) ; let is_float ; { let value_rrb = value_rr . borrow ( ) ; match * value_rrb { Value :: Float ( _ ) => { is_float = true ; } _ => { let value_opt = value_rrb . to_float ( ) ; match value_opt { Some ( n ) => { self . stack . push ( Rc :: new ( RefCell :: new ( Value :: Float ( n ) ) ) ) ; return 1 ; } _ => { print_error ( chunk , i , " " ) ; return 0 ; } } } } } if is_float { self . stack . push ( value_rr ) ; } return 1 ; }
Convert a value into a floating-point value.
Convert a value into a floating - point value .
&mut self
chunk
&Chunk
i
usize