On Thu, Feb 18, 2021 at 01:55:13PM -0800, Tobias Neumann wrote:
> Thank you. As it turns out, complex exponentiation (^ : % -> %) with a 
> Complex(DoubleFloat) exponent is also broken:
> 
> Good:
> (7) -> (-1.0 :: Complex(Float))^(0.5)
> 
>    (7)  0.2022266248_7959507324 E -20 + %i
>                                                          Type: 
> Complex(Float)
> 
> Broken:
> (6) -> (-1.0 :: Complex(DoubleFloat))^(0.5)
> 
>    (6)  6.123233995736766e-17 - %i
>                                                    Type: 
> Complex(DoubleFloat)
> 

That is consequence of IEEE rules about signed zero and precedence
rules:

(21) -> m1 := -1.0 :: Complex(DoubleFloat)

   (21)  - 1.0
                                                   Type: Complex(DoubleFloat)
(22) -> imag(m1)

   (22)  -0.0
                                                            Type: DoubleFloat
(23) -> m1a := complex(-1, 0)$Complex(DoubleFloat)

   (23)  - 1.0
                                                   Type: Complex(DoubleFloat)
(24) -> imag(m1a)

   (24)  0.0
                                                            Type: DoubleFloat
(25) -> m1a^(0.5)      

   (25)  6.123233995736766e-17 + %i
                                                   Type: Complex(DoubleFloat)
31) -> m1b := (-1.0) ::Complex(DoubleFloat)

   (31)  - 1.0
                                                   Type: Complex(DoubleFloat)
(32) -> imag(m1b)

   (32)  0.0
                                                            Type: DoubleFloat

Coercion has very high precendece, so your example is equvalent to

-(1::Complex(DoubleFloat))

which according to IEEE has negative imaginary part...

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/20210218233419.GA35078%40math.uni.wroc.pl.

Reply via email to