Compare commits

..

No commits in common. "6e3609d85e1a5dd4c330b5800949e3514c8e1b93" and "09996801d818eed2b81565d1861e31529058bcd7" have entirely different histories.

6 changed files with 5 additions and 15 deletions

View File

@ -9,6 +9,7 @@
- Update packages - Update packages
## Pre-release ## Pre-release
- Fix linelocation (consistent, what does an operator's linelocation mean?) - Fix linelocation (consistent, what does an operator's linelocation mean?)
- Tuple operations - Tuple operations
@ -29,7 +30,6 @@
- evaluate straight from command line - evaluate straight from command line
- Auto-push to crates.io - Auto-push to crates.io
- Package for debian - Package for debian
- Faster startup
@ -48,7 +48,6 @@
- Complex numbers - Complex numbers
- acot/acoth functions - acot/acoth functions
- Sums and products with functional arguments - Sums and products with functional arguments
- Add functions: gcd, inverse mod
## Prompt ## Prompt
- Live syntax/output (like firefox js terminal) - Live syntax/output (like firefox js terminal)

View File

@ -162,11 +162,6 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
if va.fract() != Quantity::new_rational(0f64).unwrap() { return Err((*la + *lb + *op_loc, DaisyError::BadMath)); } if va.fract() != Quantity::new_rational(0f64).unwrap() { return Err((*la + *lb + *op_loc, DaisyError::BadMath)); }
if vb.fract() != Quantity::new_rational(0f64).unwrap() { return Err((*la + *lb + *op_loc, DaisyError::BadMath)); } if vb.fract() != Quantity::new_rational(0f64).unwrap() { return Err((*la + *lb + *op_loc, DaisyError::BadMath)); }
let o = va.clone() % vb.clone();
if o.is_nan() {return Err((*la + *lb + *op_loc, DaisyError::BadMath));}
return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, va.clone() % vb.clone()))); return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, va.clone() % vb.clone())));
} else { return Ok(None); } } else { return Ok(None); }
} else { return Ok(None); } } else { return Ok(None); }

View File

@ -61,12 +61,10 @@ fn format_map_ansi(c: char) -> Option<String> {
} }
// style::reset also resets color.
// Make sure color comes AFTER style reset.
fn format_map_full(c: char) -> Option<String> { fn format_map_full(c: char) -> Option<String> {
Some(match c { Some(match c {
'n' => { // Normal text 'n' => { // Normal text
format!("{}{}", style::Reset, color::Fg(color::Reset)) format!("{}{}", color::Fg(color::Reset), style::Reset)
}, },
'i' => { // Normal italic text 'i' => { // Normal italic text
format!("{}{}", color::Fg(color::Reset), style::Italic) format!("{}{}", color::Fg(color::Reset), style::Italic)
@ -75,7 +73,7 @@ fn format_map_full(c: char) -> Option<String> {
format!("{}{}", color::Fg(color::Magenta), style::Bold) format!("{}{}", color::Fg(color::Magenta), style::Bold)
}, },
'a' => { // Colored text 'a' => { // Colored text
format!("{}{}", style::Reset, color::Fg(color::Magenta)) format!("{}{}", color::Fg(color::Magenta), style::Reset)
}, },
'e' => { // Error titles 'e' => { // Error titles
format!("{}{}", color::Fg(color::Red), style::Bold) format!("{}{}", color::Fg(color::Red), style::Bold)

View File

@ -244,7 +244,7 @@ impl Rem<FloatBase> for FloatBase {
(!modulus.fract().unwrap().is_zero()) (!modulus.fract().unwrap().is_zero())
} { panic!() } } { panic!() }
FloatBase{val : self.val.trunc() % modulus.val.trunc()} FloatBase{val : self.val.fract() % modulus.val.fract()}
} }
} }

View File

@ -186,7 +186,7 @@ impl Scalar {
pub fn is_nan(&self) -> bool { pub fn is_nan(&self) -> bool {
match self { match self {
Scalar::Float {v} => {v.val.is_nan()}, Scalar::Float {v} => {v.val.is_nan()},
Scalar::Rational {..} => {false} Scalar::Rational {..} => {panic!()}
} }
} }

View File

@ -162,7 +162,6 @@ fn operators() {
good_expr("2", "6/3"); good_expr("2", "6/3");
good_expr("2", "5%3"); good_expr("2", "5%3");
good_expr("4", "2^5 mod 7");
good_expr("8", "5+3"); good_expr("8", "5+3");
good_expr("64", "4^3"); good_expr("64", "4^3");
good_expr("64", "4 ^ 3"); good_expr("64", "4 ^ 3");
@ -185,7 +184,6 @@ fn operators() {
bad_expr("1e5!"); bad_expr("1e5!");
bad_expr("0^(-1)"); bad_expr("0^(-1)");
bad_expr("pi!"); bad_expr("pi!");
bad_expr("2.5 mod 8");
} }
#[test] #[test]