Hello Ralf, Le mer. 7 août 2024 à 13:38, Ralf Hemmecke <[email protected]> a écrit : > > Greg, what do you expect? Internally it's a binary representation. By which > power of 2 would you have to multiply 3.7 to get a natural number so that you > can represent 3.7 exactly as an integer mantissa? When you convert 3.7 to > Float (that has 20 digits) then you cannot expect to extract 30 correct > digits from that 20-digits floating point number. Well, you can, but > unfortunately, the number is internally (as a float) not exactly 3.7 anymore.
Yes, I know how a floating point number is represented for hardware computations and 3.7 was chosen because internally it will be an approximation, even if it can exactly be represented by a rational. If I take care of string conversion it is because when you mix (coerce in the panAxiom sense) different implementations, using string is usually the preferred way, It leaves it to the implementation to convert them in the way that suits it best. You know this I think. Moreover since I am also coding a small interface to Mathematica, depending on the number of numbers given in a string format it will be coerced differently. That's all. - Greg > > On Wednesday, August 7, 2024 at 4:15:23 AM UTC+2 [email protected] wrote: >> >> Hello, >> >> Downloaded with Microsoft Edge (on Windows): >> ┌──(greg㉿ellipse)-[~/Git/jlfricas/src/algebra] >> └─$ cat /mnt/c/Users/gregv/Downloads/FLOAT.diff |patch >> (Stripping trailing CRs from patch; use --binary to disable.) >> patching file FLOAT.spad >> >> I guessed it has to be applied on the extracted FLOAT.spad file during >> the build. It works fine thanks but is this expected: >> >> Before and after >> >> (1) -> toString(3.7,30) >> >> (1) "3.700000000000000000002684354560" >> >> Type: String >> >> Time: 0.04 (OT) = 0.06 sec >> (2) -> )lib FLOAT >> Float is now explicitly exposed in frame frame1 >> Float will be automatically loaded when needed from >> /home/greg/Git/jlfricas/FLOAT.NRLIB/FLOAT >> (2) -> toString(3.7,30) >> >> (2) "3.700000000000000000002710505431" >> >> Type: String >> >> Using 30 is of course not judicious since by default digits() = 20, I >> wonder what can be returned with this argument. >> >> - Greg >> >> >> >> Le lun. 5 août 2024 à 03:12, Waldek Hebisch <[email protected]> a écrit : >> > >> > On Sat, Jul 27, 2024 at 05:25:52PM +0200, Grégory Vanuxem wrote: >> > > No. toString(3.7,20) >> > > >> > > Le sam. 27 juil. 2024 à 17:24, Waldek Hebisch <[email protected]> a écrit >> > > : >> > > > >> > > > On Sat, Jul 27, 2024 at 03:31:57PM +0200, Grégory Vanuxem wrote: >> > > > > => >> > > > > (1) "4.30000000000000000000" >> > > > > >> > > > > I wanted to use it, but apparently not now ;) >> > >> > AFAICS the attached patch fixes the problem for Float. To handle >> > DoubleFloat we probably should move floating point formatting to >> > a separate package and use approptiate routine from this package >> > also for DoubleFloat. In fact, I would prefer to do _all_ >> > DoubleFloat formatting via such a package (so get rid of Lisp >> > formatting). >> > >> > -- >> > 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/ZrAnAxhlBl_NEtZd%40fricas.org. > > -- > 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/a690a18f-0aa0-4cd4-9d1e-ecab9d2deb09n%40googlegroups.com. -- 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/CAHnU2dYwsKkDZqLXn6jQxrvfoK2FyOM3%2Bv-rbQmGmbXwKhQTvQ%40mail.gmail.com.
