Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2018-06

Format specifier in FPC?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Darius Blaszyk

Hi,

I have the following format specifier in C : %+.05f. What would be the FPC equivalent?

A float is printed like this: -0.70711

The specified '+' will explicitly print out the sign for the float independent if it is a positive or negative.

Rgds, Darius

Reply by email

Michael Van Canneyt
to Darius Blaszyk
Darius Blaszyk wrote 9 lines
Hi, I have the following format specifier in C : %+.05f. What would be the FPC equivalent? A float is printed like this: -0.70711 The specified '+' will explicitly print out the sign for the float independent if it is a positive or negative.

It should be %.5f in FPC.
But the + cannot be mimicked. FPC does not have this option.

Michael.

Reply by email

Darius Blaszyk
to Michael Van Canneyt

Thanks Michael! I made a custom function that adds the + in case of a positive value.

Rgds ,Darius

AM Michael Van Canneyt wrote 22 lines
On Wed, 27 Jun 2018, Darius Blaszyk wrote: > Hi, > > I have the following format specifier in C : %+.05f. What would be the FPC > equivalent? > > A float is printed like this: -0.70711 > > The specified '+' will explicitly print out the sign for the float > independent if it is a positive or negative. It should be %.5f in FPC. But the + cannot be mimicked. FPC does not have this option. Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email