• Subject: Re: Float numbers equality.
• From: KHMan <keinhong@...>
• Date: Tue, 13 Aug 2013 17:07:55 +0800

```On 8/13/2013 3:46 PM, Karol Dro wrote:
```
```Thanks for replies.

2013/8/9 Luiz Henrique de Figueiredo [wrote:]

... tell us more about the problem
you're trying to solve.

I'm writing components for CEMS system.
I don't want to paste code, because names of variables, etc. are
in Polish.
I try to explain what this code calculates.

For example, one of the component calculate/normalize SO2 (sulfur
dioxide) concentration measurment.

Besides I have measurments: O2 (oxygen), H2O (humidity), T
(temperature), P (pressure), which are located in the separate
components.

On input I have measurment value (SO2_in) and I must normalize
this value to the reference conditions: O2_r = 11 %, H2O_r = 0,
T_r = 273.15, P_r = 1013.25.

Formula for this calculation is the following:

Correction factor:
O2_cf = (20.95 - 11) / (20.95 - O2)
H2O_cf = (100 - H2O_r) / (100 - H2O)
T_cf = (T + T_r) / T_r
P_cf = P_r / P

Normalized value:
SO2 = SO2_in / (O2_cf * H2O_cf * T_cf * P_cf)

For now, where is necessery, I'm using tostring function.
Taking into account the accuracy of the measurements, I think this
should be sufficient.

If I'm wrong, please correct me.
```
```
```
I don't see any comparison anywhere... Where does the equality comparison fit in?
```
Well, you should have read all the floating point material by now.

```
So, assuming you now know about floating point, do you still require an equality comparison?
```
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia

```