Mail Archives: djgpp/2008/02/22/02:45:20

X-Authentication-Warning: mail set sender to djgpp-bounces using -f
From: Martin Ambuhl <mambuhl AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: double
Date: Fri, 22 Feb 2008 02:32:20 -0500
Lines: 14
Message-ID: <>
References: <c7b DOT 2773db24 DOT 34efcc13 AT aol DOT com>
Mime-Version: 1.0
X-Trace: YXpjIs4/8jara61Lm+O9YwgN+OFNBKoBEqklAgsvLoTeY92N9R
Cancel-Lock: sha1:xLFMtHQgJTySGGU0fcCwXXotzIM=
User-Agent: Thunderbird (Windows/20071031)
In-Reply-To: <>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Sterten AT aol DOT com wrote:
> double x;
> int main(int argc,char*argv[]){  
> x=1.23;
> printf("x=%13.12Lf\n",x);
> }
> prints x=0.000000000000 instead of x=1.230000000000
> what's wrong ?

"%Lf" is the specifier for a long double without exponent.
x is not a long double; it is a double.
"%f" is the printf specifier for a double without exponent (the scanf 
specifier "%lf" is acceptable for printf under the C99 standard).

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019