Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to display '0.5' as '1/2'?

How to display '0.5' as '1/2'?

Scheduled Pinned Locked Moved C#
tutorialquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    matthias s 0
    wrote on last edited by
    #1

    hello, can anyone tell me how I can string.format a double to turn a value of 0.5 into 1/2 or, for example 2.0 into 2/1? thanks in advance!

    /matthias

    I love deadlines. I like the whooshing sound they make as they fly by.
    [Douglas Adams]

    P G 2 Replies Last reply
    0
    • M matthias s 0

      hello, can anyone tell me how I can string.format a double to turn a value of 0.5 into 1/2 or, for example 2.0 into 2/1? thanks in advance!

      /matthias

      I love deadlines. I like the whooshing sound they make as they fly by.
      [Douglas Adams]

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Check out my http://www.codeproject.com/csharp/PIEBALDTypesRational.asp[^]

      D 1 Reply Last reply
      0
      • P PIEBALDconsult

        Check out my http://www.codeproject.com/csharp/PIEBALDTypesRational.asp[^]

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Your article is getting smacked pretty hard. You might want to rewrite it so it explains how these things are done instead of just documenting how to use your library.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        1 Reply Last reply
        0
        • M matthias s 0

          hello, can anyone tell me how I can string.format a double to turn a value of 0.5 into 1/2 or, for example 2.0 into 2/1? thanks in advance!

          /matthias

          I love deadlines. I like the whooshing sound they make as they fly by.
          [Douglas Adams]

          G Offline
          G Offline
          Giorgi Dalakishvili
          wrote on last edited by
          #4

          You might want to have a look at this: http://www.codeproject.com/csharp/fractiion.asp

          my articles

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups