• (cs) in reply to Selbo
    Selbo:
    So many of you are wrong. Celsius and Centigrade are not exactly the same. To convert Celsius to Kelvin, you subtract 273. To convert Centigrade to Kelvin, you subtract 273.15. (Centigrade is obsolete.)
    Centigrade is hardly obsolete. I just love those dolled-up weather girls. What would we do without the common acceptance of Centigrade?

    In other news, the original 0 Celsius was, in fact, the boiling-point of water, not the tri-state point.

    I imagine that this is quite important when you deal with locales and epochs and stuff.

  • (cs) in reply to Kelvin
    Kelvin:
    DeLos:
    but then the delta is the difference in Celsius! surely you need a K2C function to handle that! //see comment.xls

    wouldn't that be C2K?

    Well, that rather depends upon whether the function in question is commutative or not.

    I can't believe I just said that.

  • ALex Garner (unregistered)
    "...modial interaction of magneto-reluctance (rather than a more efficient method, such as capacitive directance) for supplying inverse reactive current in a unilateral phase detractor"

    "...panendermic semiboloid to the "up" end of his grammeter. Obviously, this caused very high levels of sinusoidal depleneration"

    You forgot to quote your source: http://youtube.com/watch?v=TuhYd9L_d7w

    You need to do this if you're going to lift copy verbatim, otherwise it looks like your implying that you wrote it.

  • geeknerd (unregistered)

    They may also want to get a decent C compiler that would flag the missing return statement as an error. Then fire whoever wrote that drivel.

  • Jay (unregistered) in reply to Bergerac
    Bergerac:
    Actually that doesn't look strange at all to me. In my experience, high performance embedded code often has sequences of if..then..else, or lookup tables rather than arithmetic operations, because "if x=y, then a=b" is quicker than a subtract operation. (Although admittedly this depends on the processor).

    Hmm, I don't know what language or processor you're using, but any platform I've ever worked on, doing an IF is way slower than doing a subtraction.

    At the machine level, doing "if x==y" normally involves: load x into a register, subtract y, compare result to zero, if result is zero (or is not zero, as the case may be) jump somewhere. That is, every compare involves an internal subtraction, PLUS doing the compare and the go-to. Even machine languages that support direct memory-to-memory compares take more cycles to do it than they do for a subtraction.

    And in the if/then/else method, you wouldn't do just one compare unless you got a match on the very first try. You might have to do dozens of compares.

    If/then/else could be faster than a calculation if the calculation is complex. But it's not going to beat a simple subtraction.

  • friday (unregistered) in reply to K2C
    K2C:
    why didn't he just use a database? everyone knows databases are more efficient then excel...
    absolutely, oracle would do nicely...
  • anonymous pumpkin (unregistered)

    Zero is always returned from the function K2C(), if this C is a standard C based compiler.

    To explain, here is the topmost line:

    if(Ktemp= 273 ){return 0 }
    The if statement always evaluates to true because using the "=" assignment ( versus the "==" equality check ) will always be the value 273, or, true.

    Thus, the function always returns 0.

    In fact, a good optimizing compiler will remove most of the remaining code in the function, and this becomes a very small function at the binary level.

  • Bergerac (unregistered) in reply to Jay

    You're totally right - I think I was having a brain fart when I wrote that. I've had a hard week writing flight control software for the Boeing 777, mwuhahahahah (only kidding!) The multiple if..elses would not only take far longer, they'd also be unpredictable for a real-time system. I had in mind more complex arithmetic operations.

  • Jimmiss (unregistered) in reply to K2C

    This is what happens when schools shrug their responsibility to teach students to question things and think for themselves.

  • Franklyn (unregistered)

    i really don't know what to say . the difference is the same no matter what the units are !!. urgh... WTF indeed

  • Matt (unregistered) in reply to DeLos

    Beyond the fact that all of this is unnecessary code, I'm more concerned with the fact that if any of those temperatures are outside the range [0C,30C], the K2C function returns garbage... so there is a bug in the software...

  • David H Dennis (unregistered)

    Did nobody notice that the code used = instead of ==?

    If this was a C program it would have always returned zero!

    D

  • vince (unregistered)

    This is incredible! I hope this "programmer" is doing better with electronics !

  • Nevermind (unregistered) in reply to vince

    Well this whole story is made up from scratch, not a grain of truth in it.

    For instance "inverse reactive current in a unilateral phase detractor." is taken directly from a spoof vid on youtube.

    http://youtube.com/watch?v=i3RqDp7i308

    and so is this line: "temperature control board’s panendermic semiboloid to the "up" end of his grammeter."

  • Aleks (unregistered)

    This code shouldn't work, it has = instead of == in comparison. The line

     if(Ktemp=	273	){return	0} 
    

    Would firsth assign 273 to Ktemp variable, and then promptly return 0.

    DeLos: It doesn't matte if the difference is in Celsius or Kevin. Diff in kevins: k1-k2, is the same as diff in celcius: c1-c2 = k1-273 - (k2-273) = k1 -273 - k2 + 273 = k1 -k2

  • Anon (unregistered) in reply to DeLos

    You dont neled to type it in by hand

    Enter say,

    Testing 1 string Testing 2 string Testing 3 string

    In 3 cells in a column, select them all and click and drag the little black box on the bottom right hand corner. It will copy that with the numbers changing into each one.

  • aoa (unregistered)

    The excel might not have been typed by hand - they could have used 'complete down' to fill-in the columns based on 2 rows of examples, and that would have left values rather than formulae in the spreadsheet

  • Derekwaisy (unregistered)
    Comment held for moderation.
  • Jimmyanten (unregistered)
    Comment held for moderation.
  • BVZ_Moskva_o (unregistered) in reply to Selbo
    Comment held for moderation.
  • BVZ_Moskva_o (unregistered)
    Comment held for moderation.
  • ppu-prof_Hag (unregistered) in reply to Selbo
    Comment held for moderation.

Leave a comment on “K2C”

Log In or post as a guest

Replying to comment #:

« Return to Article