bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-apl] Complex minus float gives wrong result


From: Kevin Anderson
Subject: [Bug-apl] Complex minus float gives wrong result
Date: Mon, 12 Oct 2015 16:22:09 -0700

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]