Float is float! [Software]

posted by Helmut Homepage – Vienna, Austria, 2020-12-20 23:27 (223 d 22:35 ago) – Posting: # 22151
Views: 2,946

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,596 posts in 4,516 threads, 1,532 registered users;
online 4 (0 registered, 4 guests [including 1 identified bots]).
Forum time: Sunday 23:02 CEST (Europe/Vienna)

Sit down before fact as a little child,
be prepared to give up every conceived notion,
follow humbly wherever and whatever abysses nature leads,
or you will learn nothing.    Thomas Henry Huxley

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