On Wed, 16 Mar 2005 14:10:06 +0100, Goswin Brederlow
<[EMAIL PROTECTED]> wrote:

Hi

> # f: convert a floating-point argument to decimal notation, in the style 
> dddd.ddd.
> # F: convert a floating-point argument in Caml syntax (dddd.ddd with a 
> mandatory .).
> # e or E: convert a floating-point argument to decimal notation, in the style 
> d.ddd e+-dd (mantissa and exponent).
> # g or G: convert a floating-point argument to decimal notation, in style f 
> or e, E (whichever is more compact).
> 
> But %f always prints dddd.ddd with a mandatory '.'. %F on the other
> hand does not always print a '.', e.g. 1e+18 does not. %F seems to do
> what %g describes.

%f does as the doc say:
# Printf.printf "%.0f\n" 10.;;
10
But by default there is alway 6 digit after the dot (and then a dot).
Compare to:
# Printf.printf "%.0F\n" 10.;;
10.

the documentation for %F is partially misleading, it alway convert a
floating-point argument in Caml syntax, but in the 1e+18 case the dot
is not mandatory in the ocaml syntax, I will forward it.
By the way %g and %F does not always do the same things :
# Printf.printf "%F" 10000000000.;;
10000000000.- : unit = ()
# Printf.printf "%g" 10000000000.;;
1e+10- : unit = ()


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to