Float is float! [Software]

posted by Helmut Homepage – Vienna, Austria, 2020-12-20 23:27 (400 d 13:19 ago) – Posting: # 22151
Views: 4,637

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,854 posts in 4,573 threads, 1,554 registered users;
online 18 (1 registered, 17 guests [including 18 identified bots]).
Forum time: Tuesday 12:47 CET (Europe/Vienna)

I love deadlines.
I love the whooshing sound they make
as they go by.    Douglas Adams

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