This commit is contained in:
Simon Gardling
2022-03-09 19:20:30 -05:00
parent 462dc9488b
commit 2da78e5582
2 changed files with 17 additions and 2 deletions

View File

@@ -11,4 +11,3 @@
5. re-add euler's number (well it works if you use capital e like `E^x`)
6. allow constants in min/max integral input
7. sliding values for functions (like a user-interactable slider that adjusts a variable in the function, like desmos)
8. fix log2()

View File

@@ -51,6 +51,12 @@ pub fn process_func_str(function_in: String) -> String {
let mut add_asterisk: bool = false;
let prev_chars_len = prev_chars.len();
let prev_prev_prev_char = if prev_chars_len >= 3 {
*prev_chars.get(prev_chars_len - 3).unwrap()
} else {
' '
};
let prev_prev_char = if prev_chars_len >= 2 {
*prev_chars.get(prev_chars_len - 2).unwrap()
} else {
@@ -63,6 +69,16 @@ pub fn process_func_str(function_in: String) -> String {
' '
};
if (prev_prev_prev_char == 'l')
&& (prev_prev_char == 'o')
&& (prev_char == 'g')
&& (NUMBERS.contains(&c))
{
prev_chars.push(c);
output_string += &c.to_string();
continue;
}
let c_letters_var = LETTERS.contains(&c) | VALID_VARIABLES.contains(&c);
let prev_letters_var = VALID_VARIABLES.contains(&prev_char) | LETTERS.contains(&prev_char);