(1) -> precision()

   (1)  68
                                                        Type: PositiveInteger
(2) -> precision(300)

   (2)  68
                                                        Type: PositiveInteger
(3) -> a := sqrt(2.0);

                                                                  Type: Float
(4) -> precision(68)  

   (4)  300
                                                        Type: PositiveInteger
(5) -> a

   (5)
  1.4142135623_7309504880_1688724209_6980785696_7187537694_8073176679_737990732
  4_7846210703_885038753
                                                                  Type: Float

Is that really what one wants: I am implementing an algorithm, where I switch 
internally to a higher precision to guarantee the result being correct in the 
working precision. 
So right now FriCAS is cheating - at least for such an algorithm

The bad guy is 

convert(f):S ==
   b:Integer :=
     OUTPREC() = -1 and not zero? f =>
         bits(length(abs mantissa f)::PositiveInteger)
     0
   s :=
         OUTMODE() = "fixed" => fixed f
         OUTMODE() = "floating" => floating f
         OUTMODE() = "general" => general f
         empty()$String
       if b > 0 then bits(b::PositiveInteger)
       s = empty()$String => error "bad output mode"
       s

Here bits is called in the body of b, and here the switch to the larger 
(possibly incorrect) precision occurs, and later on it is switched back to the 
working precision

I think it would be a good rule to make output precision to working precision, 
if a user wants to change this he has to explicitly change precision



Mit freundlichen Grüßen

Johannes Grabmeier

Prof. Dr. Johannes Grabmeier
Köckstraße 1, D-94469 Deggendorf
Tel. +49-(0)-991-2979584, Tel. +49-(0)-171-5503789
Tel. +49-(0)-991-3615-100 (d),  Fax: +49-(0)-1803-5518-17745

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to