# How to trim to i.e. 2 decimal places in the Data window? - page 3

18

Keith Watford:

Let's just show how your code is not reliable (apart from being off topic).

BarVolAvg is a calculated value and it is extremely unlikely that it will always be calculated to a nice convenient 2 fractional digits.

Such as

10694990411.760000

What if it was calculated to

10694990411.759999    ?

Now, if you wanted to display that to 2 fractional digits you'd want it displayed as

10694990411.76

Wouldn't you?

So let's try that with your code

It prints as

10694990411.75

Not really the wanted result is it?

we need to TRIM all AnyNumber.00000000000000xxx000011000x0099999999999

till 2 digits, right?

is this big difference what happend after 3 digit? ... if you cant round it to 2 normaly (dont left other digits)

Moderator
30346

dzfx5:

we need to TRIM all AnyNumber.00000000000000xxx000011000x0099999999999

till 2 digits, right?

I don't know what that means!

18

Keith Watford:

I don't know what that means!

AnyNumber means INT values, but all after dot (.), mens value we need to round.
18

Keith Watford:

Let's just show how your code is not reliable (apart from being off topic).

BarVolAvg is a calculated value and it is extremely unlikely that it will always be calculated to a nice convenient 2 fractional digits.

Such as

10694990411.760000

What if it was calculated to

10694990411.759999    ?

Now, if you wanted to display that to 2 fractional digits you'd want it displayed as

10694990411.76

Wouldn't you?

So let's try that with your code

It prints as

10694990411.75

Not really the wanted result is it?

Dont show yout "theoretical examples" (that can be rounded using even NormalizeDouble funtion).... (just cos you see im using MathFlorr function).... try it on "bugged" round numbers example (where your Round functions dont work the way how you think this must give you your expected results).
18

1.

10694990411.76

2.

10694990411.75

MAIN RESULT IS -> you got 2x digits after . dot anyways, right?!!!!! (thats we are talking about)

we are not talking about foolisn 1 cent, but about that then we get your xxx.yyyyyyyyyy value roundedtil. xx.yy only.

*** you noobs (who dont read post main question is talking about).

18

This is what was I just now posted in my prifile (after registering in MQL community for 3x days :D LOL) ->

I dont participate in posts and do not help ohters to resorve theyr programming problems. ;)

Moderator
30346

dzfx5:

This is what was I just now posted in my prifile (after registering in MQL community for 3x days :D LOL) ->

I dont participate in posts and do not help ohters to resorve theyr programming problems. ;)

That's good to know, thanks.

18

Keith Watford:

That's good to know, thanks.

Ty, im fine ;)

(It was my first post i participaed (and I think it was aslo last)... therefore - Ty Im fine ;)
and better I will not loose my time reading all "this"... :D

41754

Keith Watford:

That's good to know, thanks.

Just ban him and we will get rid of this new moron.
Moderator
30346

Alain Verleyen:
Just ban him and we will get rid of this new moron.

If I banned people for not thinking things through before posting, I would probably have banned myself  a few times by now Alain.

;D