Float is float! [Software]

posted by Helmut Homepage – Vienna, Austria, 2020-12-21 00:27 (709 d 18:39 ago) – Posting: # 22151
Views: 6,114

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 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

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

Complete thread:

UA Flag
Activity
 Admin contact
22,418 posts in 4,693 threads, 1,598 registered users;
15 visitors (0 registered, 15 guests [including 3 identified bots]).
Forum time: 19:07 CET (Europe/Vienna)

Intellect distinguishes between the possible and the impossible;
reason distinguishes between the sensible and the senseless.
Even the possible can be senseless.    Max Born

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