OutputForm of float(i : Integer, j : Integer)

10 views
Skip to first unread message

Grégory Vanuxem

unread,
Mar 29, 2024, 7:56:37 PM3/29/24
to fricas...@googlegroups.com
Hello,

I don't think this is intended, or at least it's not documented in HyperDoc:

(1) -> float(17,1) -- 17 * base() ^ 1

(1) 0.3 E 2
Type: Float
(2) -> log %

(2) 3.5263605246_161613897
Type: Float
(3) -> log(34.0)

(3) 3.5263605246_161613897
Type: Float
(4) ->

- Greg

Waldek Hebisch

unread,
Mar 30, 2024, 1:43:30 PM3/30/24
to fricas...@googlegroups.com
AFAICS it is intended:

1) float(17, 1) creates number with specified internal representation,
2) number of mantissa bits is taken as accuracy
3) when number is expressed in exponential way, then it is printed
in exponential form in base 10

Those rules determine output in (1). In principle printing routine
could include second digit after dot, that is print with more accuracy
than internal "accuracy", but I think that decision to print only
digits justified by accuracy is intentional.

When exponent is zero situation is a bit different and in this
case number can be printed exactly.

BTW: Compare:

(8) -> PRETTYPRINT(float(17,1))$Lisp
(17 . 1)

(8) ()
Type: SExpression
(9) -> PRETTYPRINT(34.0)$Lisp
(34 . 0)

(9) ()
Type: SExpression

You can see that internal representation is quite different.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages