Float is float! [Software]

posted by Helmut Homepage – Vienna, Austria, 2020-12-20 22:27 (34 d 14:28 ago) – Posting: # 22151
Views: 630

Hi PharmCat,

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

At least consistently giving not zero. ;-)

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

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

Dif-tor heh smusma 🖖
Helmut Schütz

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

Complete thread:

 Admin contact
21,310 posts in 4,445 threads, 1,489 registered users;
online 5 (0 registered, 5 guests [including 2 identified bots]).
Forum time: Sunday 12:55 UTC (Europe/Vienna)

Every man gets a narrower and narrower field of knowledge
in which he must be an expert in order to compete with other people.
The specialist knows more and more about less and less
and finally knows everything about nothing.    Konrad Lorenz

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