XCAS float precision

10042018, 02:52 PM
(This post was last modified: 10042018 03:17 PM by Albert Chan.)
Post: #1




XCAS float precision
I finally join the club, and downloaded XCas (for Windows 32bits)
If XCas float default is IEEE double precision, I should get this: Python: 3.141592653589794  3.141592653589793 => 8.88e16 This is above in hexfloat, where ULP = 2^51 ~ 4.44e16: 0x1.921fb54442d1aP1  0x1.921fb54442d18P1 = 2 ULP ~ 8.88e16 Instead, I get something unexpected, suggesting XCas uses 54bits float (or more) (Also, returned float is not normalized, with a zero before decimal point) XCAS: 3.141592653589794  3.141592653589793 => 0.111e14 (2.5 ULP ?) Just to confirm above with 54bits float math (now, ULP = 2^52) 0x1.921fb54442d1a0P+1  0x1.921fb54442d178P+1 = 5 ULP ~ 1.11E15 (match above) 

10042018, 07:22 PM
Post: #2




RE: XCAS float precision
Xcas is using longfloats (via MPFR) for representation of floats having more than 14 digits.


10042018, 09:36 PM
Post: #3




RE: XCAS float precision
(10042018 07:22 PM)parisse Wrote: Xcas is using longfloats (via MPFR) for representation of floats having more than 14 digits. Thanks you. It now make sense. pibf := 3.141592653589793 // bigfloat pi53 := 3.141592653 + 5.8979310 // machine float evalf(pibf, 20) => 3.1415926535897928940 // big float confirmed evalf(pi53, 20) => 3.14159265359 // pi53 is 0.5 ULP bigger than pibf It seems when big float mixed with machine float, bigfloat is "demoted". evalf(pibf + 0.0, 20) => 3.14159265359 pibf  pi53 //==> 0.0 pibf == pi53 //==> true, big float demoted before comparison. 

10052018, 06:04 PM
Post: #4




RE: XCAS float precision
Indeed. Mixing floats and long floats will convert long float to float.


« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)