[using ECLiPSe 7.0] I have a query about IC floats limitations. I understand some of the limitations of interval arithmetic and that not all decimals can be represented accurately by floats. But practically, I need to know what is the largest float range that can be used without generating aberrant results. ?- lib(ic). Yes (0.08s cpu) ?- R $:: -5 .. 5, R $= 1.6. R = 1.6__1.6000000000000005 % That's ok Yes (0.00s cpu) ?- R $:: -3.4028235 * 10 ^ 38 .. 3.4028235 * 10 ^ 38, R $= 1.6. % i.e. single precision 32 bits C float range R = 0.0__3.7778931862957162e+22 % aberrant Yes (0.00s CPU) ?- R $:: -3.4028235 * 10 ^ 3 .. 3.4028235 * 10 ^ 3, R $= 1.6. R = 1.5999999999999091__1.6000000000003638 % I can live with that Yes (0.00s cpu) ?- R $= 1.6. R = 1.6__1.6 % but that would be nicer all the time Yes (0.00s cpu) ?- R $:: -2 ^ 31 - 1 .. 2 ^ 31 - 1, R $= 1.6. % using the C long range: -2147483647 .. 2147483647 R = 1.5999999046325684__1.6000003814697266 % that's ok Yes (0.00s cpu) ?- R $:: -3.4028235 * 10 ^ 20 .. 3.4028235 * 10 ^ 20, R $= 1.6. R = 0.0__65536.0 % starting to be silly... Yes (0.00s cpu) It's the unpredictability that I have difficulties with. What's the best way to deal with this? Not imposing bounds? Using a safe range, but which one? Many thanks for your efforts Regards, Chris -- Dr Chris Meudec<http://www.echancrure.eu/> (he/him) Maitrise, PhD, MA (T&L) Lecturer in Software Development E chris.meudec_at_...438...<mailto:chris.meudec@...438...> | setu.ie<https://setu.ie/> [turn on images]<https://setu.ie/> Kilkenny Road Campus, Kilkenny Road, Carlow, R93 V960, Ireland Campas Bhóthar Chill Chainnigh, Bóthar Chill Chainnigh, Ceatharlach, R93 V960, ÉireReceived on Thu Dec 15 2022 - 12:21:53 CET
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:21 CEST