Floating point arithmetic, again [Software]

posted by ElMaestro  – Denmark, 2020-12-10 23:05 (837 d 15:55 ago) – Posting: # 22132
Views: 6,985

Hi Ohlbe,

0==(0.8-0.4-0.2-2*0.1)
[1] TRUE
0==(.1+0.8-0.4-0.2-3*0.1)
[1] FALSE



We (as in us humans) should just switch to binary and we'd never have these discussions. We can still keep the metric system but to keep things easy we may wish to define a millimeter as 1/1024 of a meter, if we wish to impress someone by our ability to do division and multiplication in our heads :-D


In a nutshell, try:
a=.11111111111111111111111111111111111111111111111111111111
b=.111111111111111111111111111111111111111111111111111111111
(a-b)==0



Edit: two posts merged. [Ohlbe]

Pass or fail!
ElMaestro

Complete thread:

UA Flag
Activity
 Admin contact
22,557 posts in 4,724 threads, 1,607 registered users;
20 visitors (0 registered, 20 guests [including 5 identified bots]).
Forum time: 16:00 CEST (Europe/Vienna)

Science is wonderfully equipped to answer the question “How?”
but it gets terribly confused when you ask the question “Why?”    Erwin Chargaff

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