Xcode Using Exponents - xcode

This is probably a simple question, but I a variable "side" to be divided by the square of the variable "curNum". Currently, my code for this looks like
side = inputNum/(curNum^2);
However, this gives me the error "Invalid operands to binary ^" How can I successfully use exponents?

Try
pow(curNum, 2)
Should work......

Related

Why do we need the question mark in Immediate Window of VS?

So, reading this documentation:
https://learn.microsoft.com/en-us/visualstudio/ide/reference/immediate-window?view=vs-2022
It looks like the question mark (?) is an alias for the command >Debug.Print, which basically, will evaluate the expression and show the result.
So, in debug mode, instead of running this:
>Debug.Print DoSomething()
I can run this:
? DoSomething()
This is even better because I'm getting the autocomplete suggestions.
Now, the issue is that I can run the same line without a command at all, and it does exactly the same:
DoSomething()
So far looks like there is no need for the command >Debug.Print or the alias ?.
At first, I suspected that using ? will only print the result without changing the values, but this is not the case (When I assign a value to a variable using ? it is assigned and the new value is printed)
So, am I missing something here? Are there any other differences between these 3 options?
According to the documentation, if you want to use Visual Studio command, you need to add greater than sign before the command. If you run 'Debug.Print' without adding greater than sign, you will get an error.
My point is that the question mark ('?') is unnecessary if you in the Immediate Window, it is used to distinguish the typed expression from the result.

run time error '6' Overflow in visual basic 6.0

I am getting a run time error '6' Over Flow in vb 6
The "Overflow" error means that you are trying to put a number into a variable (or property etc), and the data type of the variable doesn't allow numbers that large.
Make sure that numbers used in calculations that are coerced into integers do not have results larger than integers.
What is the type of the data in the database?
My guess is that ADO returns it as either a String or a Decimal, and Decimal values only "fit into" a Variant in VB6.
VB6 has no syntax for a Decimal literal, however you can use something like:
CDec(111010114289#)
... inline, or declare a Const as in:
Private Const BigVal As Currency = 111010114289#
I you have to put a large number in a small variable, like C, check Remove integer bound check in project properties (if you are not compiling as PCode)

Error when subtracting two negative numbers in ksh: “assignment requires lvalue”

I am trying to debug someone else's script:
The code line is:
y=$((${oldvalue[$x]}-${newvalue[$x]}))
y gets calculated fine as long as both sides are positive numbers. However, I have a production situation where they are both negative and the error I get is:
DEBUG Old value = -4144290000
DEBUG New value = -4009685000
script.sh: line 123: -4144290000--4009685000: assignment requires lvalue
I never would use ksh myself for even the simplest of calculations but I am in a position of production support and have to deal with a big ball of mud, I would use at least Perl/Python. Can anybody tell why this problem is happening and how to fix it?
Thanks
It needed spaces on both sides of the minus
y=$((${oldvalue[$x]} - ${newvalue[$x]}))

Getting text from a form and evaluate in selenium using ruby

I am testing a registration form and one of the questions before submitting is:
"What is 8 + 4?"
The values will be different every time. I am using Selenium 2 with Ruby and want to to see if anyone knows how to a) get the text from the question and then b) compute the addition and return the correct answer in the field.
Thanks!
Using ruby code try to get the values in between is and ? Store this in Variable and now split the text with deliminator + now you will get the Values in array in different location. Now you can add these two and use for your evaluation. I don't have idea about ruby but its possible in PHP as I have done the same. Its should be in Ruby too.
Getting text between is and ? can be done strpos() in php that gives the position of the string see similar function for ruby.

Matlab big matrix

I'm trying to use matlab for the first time but I'm having a problem because the matrix I'm using is too big, I think.. I command I'm trying is:
m=[1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;169201]7;531456;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017]
And I'm getting the following error: Error: Unexpected MATLAB expression.
Does anyone have a solution for this?
Thanks in advance !
That matrix is tiny :-) Matlab can handle millions of elements per matrix.
However, on the second line, you have an extra bracket that ruins things:
...17;1692017;169201 ] 7;5...
Get rid of it, and you'll be fine!
Seems like you are trying to do a matrix, but typing its code wrongly. First, the ; separates lines; if you want to separaate columns in a row you have to use a space.
And you have two closing ], while you have only one opening [ which is clearly incorrect

Resources