This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Add two strings

Hallo,
Is it possible, that I can add the strings '1' '.' and '2'.
I want to add this 3 strings: 1.2 and convert it into a float value and than I want add a float value.

Parents
  • Adds another side the "Sledgehammer to crack nut" title, though!

    One way to avoid floating-point is to choose one's units appropriately; eg, instead of using "5.2 whatsits", use "52 centi-whatsits" or 520 milli-whatsits" - and then use integer arithmetic.

    Erm, at the risk of being a pest, I'm afraid your blow missed the nut by an order of magnitude, which is bad even for a sledgehammer: 5.2 whatsits is 520 centi-whatsits.

    But I'm willing to forgive people educated on "imperial" units for mixing up their SI prefixes --- as long as they extend similar courtesy to people baffled by the relation between inches and pints. ;-)

Reply
  • Adds another side the "Sledgehammer to crack nut" title, though!

    One way to avoid floating-point is to choose one's units appropriately; eg, instead of using "5.2 whatsits", use "52 centi-whatsits" or 520 milli-whatsits" - and then use integer arithmetic.

    Erm, at the risk of being a pest, I'm afraid your blow missed the nut by an order of magnitude, which is bad even for a sledgehammer: 5.2 whatsits is 520 centi-whatsits.

    But I'm willing to forgive people educated on "imperial" units for mixing up their SI prefixes --- as long as they extend similar courtesy to people baffled by the relation between inches and pints. ;-)

Children