formatting number

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alain Dhaene

    formatting number

    Hi

    Can sombody tell me the best way to format a number in this way.

    456.45657 must be 456,46

    So the point becoms a comma and I would have 2 digits i.pv. 5

    thanks,

    Alain


  • Geoff Berrow

    #2
    Re: formatting number

    I noticed that Message-ID: <c586i6$3go$1@n ews.worldonline .be> from Alain
    Dhaene contained the following:
    [color=blue]
    >Can sombody tell me the best way to format a number in this way.
    >
    >456.45657 must be 456,46
    >
    >So the point becoms a comma and I would have 2 digits i.pv. 5[/color]



    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • Joachim Mæland

      #3
      Re: formatting number

      On Sat, 10 Apr 2004 09:14:16 +0200, Alain Dhaene wrote:
      [color=blue]
      > Can sombody tell me the best way to format a number in this way.
      >
      > 456.45657 must be 456,46
      >
      > So the point becoms a comma and I would have 2 digits i.pv. 5[/color]

      Take care of precision:


      Fix the output format:


      --
      mvh/regards
      Joachim Mæland

      If everything seems under control, you're just not going fast enough.
      -Mario Andretti

      Comment

      • Chung Leong

        #4
        Re: formatting number

        "Geoff Berrow" <blthecat@ckdog .co.uk> wrote in message
        news:9n8f701il9 vp5psf7mftcvh27 k3a151k6t@4ax.c om...[color=blue]
        > I noticed that Message-ID: <c586i6$3go$1@n ews.worldonline .be> from Alain
        > Dhaene contained the following:
        >[color=green]
        > >Can sombody tell me the best way to format a number in this way.
        > >
        > >456.45657 must be 456,46
        > >
        > >So the point becoms a comma and I would have 2 digits i.pv. 5[/color]
        >
        > http://uk.php.net/number_format[/color]

        There's also setlocale(), although using it is somewhat dicey.


        Comment

        Working...