Binary representation [Software]

posted by ElMaestro  – Denmark, 2018-03-16 14:13 (2624 d 18:09 ago) – Posting: # 18561
Views: 7,793

Hi Mittyri,

❝ x=0.250000

❝ as it should be

:confused:


How nice, then it is also compiler-dependent...
The issue is that 0.05 cannot be represented accurately in a binary brain.
So, the compiler will need to deal with such a fraction and either round it up or round it down. Whatever it does, it can have downstream implications. In my case it implied that my simple naïve decimal logic (0.25 <=0.25) never evaluated to TRUE because it was not tested as such.
The solution could be to add e.g. 1e-8 to the righthand side. Dumb, but that's logic.
Computers suck.
:-D:-D:-D

Pass or fail!
ElMaestro

Complete thread:

UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,678 registered users;
44 visitors (0 registered, 44 guests [including 18 identified bots]).
Forum time: 09:22 CEST (Europe/Vienna)

Pharmacokinetics may be simply defined as
what the body does to the drug,
as opposed to pharmacodynamics, which may be defined as
what the drug does to the body.    Leslie Z. Benet

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