Results 1 to 5 of 5

Thread: C# question but also it's math!

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a new Maserati down a dead end street
    Posts
    4,335

    C# question but also it's math!

    A coworker asked me if I could run a formula for him and he gave it to me like this: (-1.75*.35^2*.35+3.067167)*.35^1.5
    Since C doesn't have that exponentiation operation I rewrote it with Math.Pow but I am not sure of the correct parenthesis placement.
    Is this equivalent?
    ?(-1.75* Math.Pow(.35,2) *.35+3.067167)*Math.Pow(.35,1.5)
    0.61955998366026122
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    2,276

    Re: C# question but also it's math!

    That's how I would interpret the formula as written.

    That being said, it is a bit odd that he's got .35^2*.35, since that would just be .35^3. If his intention was to raise the first .35 to the power of (2*.35) or even (2*.35+3.067167), then he should have included parenthesis indicating that.

  3. #3

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a new Maserati down a dead end street
    Posts
    4,335

    Re: C# question but also it's math!

    Thank you. I sent this link to him so he can look at the thread. I believe he received this calc from someone else, his customer. It's for water levels in a dam (weirs).
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  4. #4

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a new Maserati down a dead end street
    Posts
    4,335

    Re: C# question but also it's math!

    OK, he said he has it working/is getting the correct results. I will talk to him next week to find out his solution. Thank you!
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    37,846

    Re: C# question but also it's math!

    Presumably, there are a few variables in there. Seeing the original, with the variables, would probably clarify to some extent. After all, if there are no variables, then there isn't a whole lot of point in the computer doing the math at runtime. It could just be pre calculated and used as a constant.

    Had the variables been in the equation, it likely would have been clear.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width