Re: [fricas/fricas] OutputForm of float(i : Integer, j : Integer) (Issue #159)

6 views
Skip to first unread message

Grégory Vanuxem

unread,
Sep 25, 2024, 3:55:43 PM9/25/24
to fricas...@googlegroups.com
Hi Waldek, hi *,

I switch here, sorry, but it is easier. I will add a link on GitHub.

Yes I agree with you but here is the documentation of FloatingPointSystem: 

   float : (Integer, Integer) -> %
      ++ float(a, e) returns \spad{a * base() ^ e}.
   float : (Integer, Integer, PositiveInteger) -> %
      ++ float(a, e, b) returns \spad{a * b ^ e}.

So, why there are different outputs here:

(1) -> float(17,1)

   (1)  30.0
                                                                                                   Type: Float
(2) -> float(17,1,2)

   (2)  34.0
                                                                                                   Type: Float
(3) -> base()

   (3)  2

(4) -> PRINT(float(17,1))$Lisp

(17 . 1)
   (4)  (17 . 1)
                                                                                             Type: SExpression
(5) -> PRINT(float(17,1,2))$Lisp

(34 . 0)
   (5)  (34 . 0)

I can understand that float(*,*) in the Float domain allows you to "directly" sets the mantissa and exponent of the floating point number in the internal representation of Float (via normalize), that is, a Lisp cons, in a way you want but as I see this, this routine should be documented as something like a "primitive" routine or something like that in fact. Or use the default implementation in the FPS category. That would be a pity from my point of view.  

I hesitated before to point this out in the discussion: https://groups.google.com/g/fricas-devel/c/252RGzrXxdw/m/FpxtDemfBAAJ

I may be wrong, and I would be happy to be wrong, but I find this inconsistent and at least confusing for a user who doesn't care of how a floating point number is represented etc.

Greg



Le mer. 25 sept. 2024 à 13:55, hebisch <notifi...@github.com> a écrit :

On Tue, Sep 24, 2024 at 10:46:06PM -0700, Grégory Vanuxem wrote:
> This issue has changed. Maybe related to commit b53b7b8 ?
>
> ````
> (1) -> float(17,1)
>
> (1) 30.0
> Type: Float

This is the same value as before, just printed in slightly different
way. As discussed in the mailing list for consistency now we use
fixed point format in such range.

> (2) -> log %
>
> (2) 3.5263605246_161613897
> Type: Float
> (3) -> log 34.0
>
> (3) 3.5263605246_161613897
> Type: Float
> (4) -> float(17,2)
>
> (4) 70.0
> Type: Float
> (5) -> log %
>
> (5) 4.2195077051_761066991
> Type: Float
> (6) -> log 68.0
>
> (6) 4.2195077051_761066991
> Type: Float
> ````
>
>
> --
> Reply to this email directly or view it on GitHub:
> https://github.com/fricas/fricas/issues/159#issuecomment-2373077579
> You are receiving this because you are subscribed to this thread.
>
> Message ID: ***@***.***>

--
Waldek Hebisch


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: <fricas/fricas/issues/159/2373872609@github.com>

Reply all
Reply to author
Forward
0 new messages