printf 문에서 소수점 고정 같은건데.. 잘 모르겠습니다 ㅜㅜ..

kknd345의 이미지

printf 에서

%10.6f

하면 무엇인가요?
.6은 소수점 6자리 고정이라는거 알겠는데.. %10 부분을 모르겠습니다..

그리고

%12.3e 는 무엇인가요?

전혀 처음보는건데... 문서에 있어서요....

lacovnk의 이미지

man 3 printf

   The field width
       An  optional decimal digit string (with nonzero first digit) specifying a minimum field width.  If the converted
       value has fewer characters than the field width, it will be padded with spaces on the left  (or  right,  if  the
       left-adjustment  flag  has  been given).  Instead of a decimal digit string one may write `*' or `*m$' (for some
       decimal integer m) to specify that the field width is given in the next  argument,  or  in  the  m-th  argument,
       respectively,  which  must be of type int.  A negative field width is taken as a `-' flag followed by a positive
       field width.  In no case does a non-existent or small field width cause truncation of a field; if the result  of
       a conversion is wider than the field width, the field is expanded to contain the conversion result.

   The precision
       An  optional precision, in the form of a period (`.')  followed by an optional decimal digit string.  Instead of
       a decimal digit string one may write `*' or `*m$' (for some decimal integer m) to specify that the precision  is
       given  in the next argument, or in the m-th argument, respectively, which must be of type int.  If the precision
       is given as just `.', or the precision is negative, the precision is taken to be zero.  This gives  the  minimum
       number  of digits to appear for d, i, o, u, x, and X conversions, the number of digits to appear after the radix
       character for a, A, e, E, f, and F conversions, the maximum number of significant digits for  g  and  G  conver-
       sions, or the maximum number of characters to be printed from a string for s and S conversions.

       e,E    The  double  argument is rounded and converted in the style [-]d.ddde+-dd where there is one digit before
              the decimal-point character and the number of digits after it is equal to the precision; if the precision
              is missing, it is taken as 6; if the precision is zero, no decimal-point character appears.  An E conver-
              sion uses the letter E (rather than e) to introduce the exponent.  The exponent always contains at  least
              two digits; if the value is zero, the exponent is 00.

음. %10이면 그 길이에 상관 없이 field width를 정해준 것 같고

e는 위와 같습니다~

덧. 그냥 쉘에서 복사해서 붙였더니 길이가 애매하네요 -o-

http://man.kldp.org/wiki/FrontPage?action=GetManPage&lang=ko&man=printf&sec=3

여기 보면, 번역은 되어있지 않은데 보기 더 편하실 것 같습니다.

번역된 것 없나요? -o-; 한글 man을 안깔아서 모르겠네요;

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.