[Bug-apl] Complex minus float gives wrong result
Subtract with a complex on the left and a float on the right acts as if the operands were swapped: 2J8 - 3.0 1J¯8 3.0 - 2J8 1J¯8 However, complex minus int or int minus complex is OK: 2J8 - 3 ¯1J8 3 - 2J8 1J¯8 FloatCell.cc::bif_subtract is executing "return A->bif_subtract(Z, this)" when A is not a real, no doubt inspired by the pattern used in FloatCell::bif_add. It should rather take its inspiration from IntCell::subtract and do "bif_negative(Z); return A->bif_add(Z,Z);" instead.
[Bug-apl] UserFunction_header::remove_duplicate_local_var
Suggest: while(pos < local_vars.size(); ++pos) {if (sym == local_vars[pos]) {local_vars[pos] = local_vars.back(); local_vars.pop_back();}}instead of: for (; pos < local_vars.size(); ++pos) {if (sym == local_vars[pos]) {local_vars[pos] = local_vars.back(); local_vars.pop_back();}}
[Bug-apl] UserFunction_header::remove_duplicate_local_var
Sorry about that last; accidentally sent in mid-compose! Here's how it should have read. In remove_duplicate_local_var, Suggest: while (pos < local_vars.size(); ++pos) {if (sym == local_vars[pos]) {local_vars[pos] = local_vars.back(); local_vars.pop_back();} else++pos}instead of: for (; pos < local_vars.size(); ++pos) {if (sym == local_vars[pos]) {local_vars[pos] = local_vars.back(); //[KA] Probable bug here //[KA] local_vars[pos] still duplicates sym //[KA] if local_vars.back() also == sym local_vars.pop_back();}}Two examples of headers which should elicit the issue: FUN;LV;LV;LV FUN B;LV;B;B