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. Other Discussions
  3. The Weird and The Wonderful
  4. Culture vulture

Culture vulture

Scheduled Pinned Locked Moved The Weird and The Wonderful
com
6 Posts 5 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.
  • L Offline
    L Offline
    leppie
    wrote on last edited by
    #1

    String amount = "123"; // added for clarity, horror follows
    var actualAmount = Convert.ToDecimal(String.Format(CultureInfo.InvariantCulture ,"{0:N2}",
    Convert.ToDecimal(amount, CultureInfo.InvariantCulture)),CultureInfo.InvariantCulture);

    ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

    N R 2 Replies Last reply
    0
    • L leppie

      String amount = "123"; // added for clarity, horror follows
      var actualAmount = Convert.ToDecimal(String.Format(CultureInfo.InvariantCulture ,"{0:N2}",
      Convert.ToDecimal(amount, CultureInfo.InvariantCulture)),CultureInfo.InvariantCulture);

      ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

      N Offline
      N Offline
      Nagy Vilmos
      wrote on last edited by
      #2

      You've got more chance of peeing on JSOP's porch than you have of understanding why the developer did this.


      Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

      S 1 Reply Last reply
      0
      • N Nagy Vilmos

        You've got more chance of peeing on JSOP's porch than you have of understanding why the developer did this.


        Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

        S Offline
        S Offline
        Samuel Cragg
        wrote on last edited by
        #3

        I think the developer was unhappy with the performance of Decimal.Round so decided to implement it using strings, as we know computers prefer working with text rather than numbers...

        L 1 Reply Last reply
        0
        • L leppie

          String amount = "123"; // added for clarity, horror follows
          var actualAmount = Convert.ToDecimal(String.Format(CultureInfo.InvariantCulture ,"{0:N2}",
          Convert.ToDecimal(amount, CultureInfo.InvariantCulture)),CultureInfo.InvariantCulture);

          ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

          R Offline
          R Offline
          RCoate
          wrote on last edited by
          #4

          I can sort of understand the point. It looks like it is trying to round the amount down to 2 decimal places. Odd way to go about it though. Reminds me of the old "man with a hammer" quote.

          G 1 Reply Last reply
          0
          • R RCoate

            I can sort of understand the point. It looks like it is trying to round the amount down to 2 decimal places. Odd way to go about it though. Reminds me of the old "man with a hammer" quote.

            G Offline
            G Offline
            Gary Wheeler
            wrote on last edited by
            #5

            Unfortunately the original code monkey was using the hammer on his own skull.

            Software Zen: delete this;

            1 Reply Last reply
            0
            • S Samuel Cragg

              I think the developer was unhappy with the performance of Decimal.Round so decided to implement it using strings, as we know computers prefer working with text rather than numbers...

              L Offline
              L Offline
              leppie
              wrote on last edited by
              #6

              Rounding is a hard, let's go shopping!

              ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

              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