[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Printf -> Date possible ?



PureBytes Links

Trading Reference Links

Hello,
 
thanks for your help. Unfortuantely i have't found the solution until now.
My number can look like 28,793434 and the displayed number should just display only 2 digits after the comma.
28.79

printf

( "\n Value = %g %%", Value [   j ] );

Can i only solve it throuh modifiying Value[ j ] in that i round the Value ?
 
Regards


 
2007/6/26, gp_sydney <gp.investment@xxxxxxxxx>:

Do you mean the number of decimal places or the total number of digits?

For a complete description of printf and the format string for the C
language, take a look here (amongst other places):

http://en.wikipedia.org/wiki/Printf

Note though that AFL has limitations on what types of numbers it can
display.

As far as formatting floats goes, you can use a specification like
"%x.yf" where 'x' is the total number of displayed digits (including
the decimal point) and 'y' is the number of decimal places. If you
precede 'x' with zero (ie. %0x.yf) leading spaces will be replaced
with leading zeros.

Also note that if you specify less total digits than the number needs
to display the full value, it will still display the full number. So
if the value is 12345 and you specify %1.0f, it will still display
12345. If you don't specify 'x', eg. %.2f, it will use the minimum
number of characters necessary to display the number with two decimal
places, which is essentially the same as %1.2f as there will always be
at least one digit before the decimal point, even if it's zero.

GP

--- In amibroker@xxxxxxxxxxxxxxx, "Trinolix Derry" <trinolix@xxx> wrote:
>
> Hi,
>
> thanks a lot !
> Maybe one last question. Is there a way to reduce the displayed
digits for
> any values.
> Something like writeval(anything, 1.2)
> Unfortunately it doesn't work inside the loop.
>
> Regards
>
>
>
> 2007/6/25, gp_sydney <gp.investment@xxx>:
> >
> > Double it in the format string:
> >
> > printf("Percentage Gain = %1.2f%%", gain);
> >
> > This would give output like:
> >
> > Percentage Gain = 23.59%
> >
> > GP
> >
> > --- In amibroker@xxxxxxxxxxxxxxx <amibroker%40yahoog roups.com>,
"Trinolix
> > Derry" <trinolix@> wrote:
> > >
> > > Is there maybe any way to display the % letter ?
> > >
> > >
> > > Regards
> > > Thomas
> > >
> > >
> > >
> > > 2007/6/25, Trinolix Derry <trinolix@>:
> > > >
> > > > Hi,
> > > >
> > > > thanks a lot !
> > > > I see now that i missed the DateTimeToStr function.
> > > >
> > > > Regards
> > > >
> > > >
> > > >
> > > > 2007/6/25, gp_sydney <gp.investment@>:
> > > > >
> > > > > Try something like this:
> > > > >
> > > > > dt = DateTime();
> > > > > for (i = 0; i < BarCount; i++)
> > > > > printf(DateTimeToStr(dt[i]));
> > > > >
> > > > > GP
> > > > >
> > > > > --- In amibroker@xxxxxxxxxxxxxxx
<amibroker%40yahoog roups.com><amibroker%40yahoog
> > roups.com>,
> > > > > "Trinolix Derry" <trinolix@> wrote:
> > > > > >
> > > > > > Hello,
> > > > > >
> > > > > > i would like to print the date through the printf function
> > inside my
> > > > > loop,
> > > > > > but wasn't successfully so far.
> > > > > > Can someone please tell me a solution ?
> > > > > >
> > > > > > Regards
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> >
> >
> >
>
>
>
> --
> Regards
>




--
Regards __._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___