Add get_val
				
					
				
			This commit is contained in:
		
							parent
							
								
									849393fbd1
								
							
						
					
					
						commit
						25644b9d4e
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -81,6 +81,18 @@ enum Atom {
 | 
				
			||||||
	Const(Const),
 | 
						Const(Const),
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl Atom {
 | 
				
			||||||
 | 
						fn get_val(&self) -> f64 {
 | 
				
			||||||
 | 
							match self {
 | 
				
			||||||
 | 
								Atom::Number(val) => *val,
 | 
				
			||||||
 | 
								Atom::Const(c) => match c {
 | 
				
			||||||
 | 
									Const::Pi => 3.141592653589793238462643383279,
 | 
				
			||||||
 | 
									Const::E => 2.718281828459045235360287471352,
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Debug, Copy, Clone)]
 | 
					#[derive(Debug, Copy, Clone)]
 | 
				
			||||||
enum Func {
 | 
					enum Func {
 | 
				
			||||||
	Sine,
 | 
						Sine,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue