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. Article Writing
  4. Universal Units

Universal Units

Scheduled Pinned Locked Moved Article Writing
performancehelptutorialquestion
2 Posts 2 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.
  • N Offline
    N Offline
    NatLang
    wrote on last edited by
    #1

    Assuming there's merit in this, I think it would make an excellent article for someone with the know-how. Let's say you are writing a recipe program that can be used by people in various countries who use differing units of measurement. Converting gallons to liters or fahrenheit to celsius on the fly for displaying a recipe is easy enough that it's probably not worth worrying about performance, but what if someone wants to export a list of 100,000 recipes for someone using other units of measurement? With several ingredients and temperatures in each recipe, that results in a lot of conversions, and performance can become an issue. (The recipe list is just the first example that came to mind... There could be other situations with billions of such conversions.) I wonder if there is a way to pre-calculate a generic unit of, e.g., weight, which can then be used to extremely quickly find ounces, pounds, grams, troy ounces, grains, etc. without resorting to floating-point division, etc. I imagine this would fall under the umbrella of NP-complete problems, but since we're only dealing with a limited number of units it seems like it should be possible to find an optimal unit without waiting for a trillion years. :) Can this be done or has it been done? Or am I on the wrong track here?

    T 1 Reply Last reply
    0
    • N NatLang

      Assuming there's merit in this, I think it would make an excellent article for someone with the know-how. Let's say you are writing a recipe program that can be used by people in various countries who use differing units of measurement. Converting gallons to liters or fahrenheit to celsius on the fly for displaying a recipe is easy enough that it's probably not worth worrying about performance, but what if someone wants to export a list of 100,000 recipes for someone using other units of measurement? With several ingredients and temperatures in each recipe, that results in a lot of conversions, and performance can become an issue. (The recipe list is just the first example that came to mind... There could be other situations with billions of such conversions.) I wonder if there is a way to pre-calculate a generic unit of, e.g., weight, which can then be used to extremely quickly find ounces, pounds, grams, troy ounces, grains, etc. without resorting to floating-point division, etc. I imagine this would fall under the umbrella of NP-complete problems, but since we're only dealing with a limited number of units it seems like it should be possible to find an optimal unit without waiting for a trillion years. :) Can this be done or has it been done? Or am I on the wrong track here?

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      generally, if a software is well released, and is MVC (model-view-Controlers) compliant, then the datas are always stored in the same way, in the same units. the problem of units is a matter of graphical rendering, so that affects only the UI (user interface)...

      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