An integer is a whole number negative, positive, or zero. i.e ... -2, -1, 0, 1, 2 ... Use this tag for questions about using, storing or manipulating integers.
1
vote
3answers
35 views
How to see if a number ends in .0
I am trying to run a test if the number ends in .0
I am running a program with numbers orders of magnitude apart so I can't estimate to a certain amount of digits. using % doesn't work either because ...
0
votes
3answers
22 views
C Scanf suddenly stopped reading in values
I'm trying to run a simple C program on my Mac. It worked fine for a while but then suddenly scanf stopped working. I basically want to read in an integer value and output what was entered. No matter ...
0
votes
0answers
30 views
Reading integers from Txt and summarize it
You are to write a program to compute statistics on a list of exam scores, the Exam Statistics Program (ESP). The input is the name of a text file that contains the number of scores followed by the ...
-2
votes
0answers
10 views
for loop in R programming
Please help me to solve this problem .I am new with this programm:
Let h(x; n) = 1 + x + x^2 + x^3 + ... + x^n = Sign of summ from 0 to n xi. Wirte a R program to calculate h(x; n) using a for loop.
...
0
votes
2answers
14 views
Orchid Tracking software - how to convert decimal values to GPS Degrees/minutes/seconds
I'm looking at a system which saves Longitude/Latitude in Integer format.
It is called Orchid tracking software.
I do not know how to convert these integer values into degrees/minutes/seconds.
I ...
0
votes
5answers
54 views
How to compare floating point numbers and integers
I am trying to create a program that checks if an equation creates a whole number answer but the equation creates floating point numbers that won't compare to integers. When it gets to the first ...
0
votes
2answers
37 views
How to take individual input in python?
Calculator Language is what the problem is called and I am to code it in python. The coding part is done but I am having trouble while reading the input file.
So the input file looks like this :
A ...
0
votes
2answers
58 views
python 3 - find and replace all numbers in a text file
I realise that finding and replacing in a text file has already been asked, but I wasn't sure how to apply it to my situation.
Basically, this goes on earlier in the program:
while True:
...
0
votes
2answers
50 views
C++ copying integer to char[] or unsigned char[] error
So I'm using the following code to put an integer into a char[] or an unsigned char[]
(unsigned???) char test[12];
test[0] = (i >> 24) & 0xFF;
test[1] = (i >> 16) & 0xFF;
test[2] ...
2
votes
2answers
48 views
php integer value is not showing as aspected
While coding I got an unexpected result.
I'm unsure how to ask this question so I'll put in my code and result:
$variable = 012;
$variable2 = 12;
$variable3 = '012';
When I echo out the variables:
...
0
votes
2answers
39 views
How to match the biggest digit in regex
I have some pdf files in my downloads folder with a particular string pattern.I need to take the latest saved file.
My code is
public static void main(String args[])
{
String ...
-1
votes
2answers
68 views
how to convert string to integer
how do i convert newValue2 to Integer because i am going to use it in a if statement ?
try {
toDate=format2.parse(string1);
java.util.Date newValue= new SimpleDateFormat(oldf).parse(string1);
...
2
votes
2answers
71 views
Integer exponentiation in Ocaml
Is there a function for integer exponentiation in OCaml? ** is only for floats. Although it seems to be mostly accurate, isn't there a possibility of precision errors, something like 2. ** 3. = 8. ...
-1
votes
3answers
39 views
testDecodeSingleInt(com.asdf.TestDecoder): java.lang.Integer cannot be cast to [Ljava.lang.Object; [closed]
When I run following code in my unit test:
Object parsedObject = null;
Integer i = new Integer(bb.getInt());
parsedObject = i;
I get the error in the subject line during runtime output by JUnit.. ...
2
votes
2answers
54 views
validate a string is non-negative whole number in javascript
This is a solution for validating an integer. Can someone please explain the logic of Karim's answer.
This works perfectly, but i am not able to understand how.
var intRegex = /^\d+$/;
...