Float is float! [Software]

posted by Helmut Homepage – Vienna, Austria, 2020-12-20 22:27 (75 d 05:29 ago) – Posting: # 22151
Views: 1,289

Hi PharmCat,

» I think in R it can be done...

At least consistently giving not zero. ;-)

library(Rmpfr)
prec <- 64
x <- mpfr(0.5, prec) - mpfr(0.4, prec) - mpfr(0.1, prec)
x
1 'mpfr' number of precision  64   bits
[1] -2.77555756156289135106e-17

y <- mpfr(-0.4, prec) - mpfr(0.1, prec) + mpfr(0.5, prec)
y
1 'mpfr' number of precision  64   bits
[1] -2.77555756156289135106e-17


Dif-tor heh smusma 🖖
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes

Complete thread:

Activity
 Admin contact
21,370 posts in 4,463 threads, 1,495 registered users;
online 4 (0 registered, 4 guests [including 3 identified bots]).
Forum time: Saturday 03:56 UTC (Europe/Vienna)

If debugging is the process of removing bugs,
then programming must be the process of putting them in.    Edsger W. Dijkstra

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5