Questions tagged as 'inteiros'

4
answers

Integer with 0 on the left is printed as another number

I have this code: $mob_numbers= array(02345674, 12345675, 22345676, 32345677); echo ($mob_numbers[0]); I wanted to print the first element of array but the output of that is:    641980 Why does this happen?     
asked by 14.03.2014 / 13:17
2
answers

Curiosity about equality of Integers

Why System.out.println(Integer.valueOf("0")==Integer.valueOf("0")); System.out.println(Integer.valueOf("1000")==Integer.valueOf("1000")); returns true false ? ps. I know == is different from equals()     
asked by 31.01.2014 / 05:36
2
answers

filesize for files larger than 2GB on x86 platforms

I was reading the PHP documentation and noticed this information:    Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB...
asked by 11.10.2015 / 00:02
1
answer

Extensive number for number

I would like to convert an extended number to normal int; example: FunçãoParaConverter("trinta e dois") // retorna 32 FunçãoParaConverter("mil vinte e quatro") // retorna 1024 FunçãoParaConverter("mil t...
asked by 15.12.2017 / 20:16
3
answers

Check if variable is a positive integer

To check if a variable is a positive integer , I'm resorting to a regular expression: #!/bin/bash id="$1" regNumTest='^[0-9]+$' if ! [[ "$id" =~ $regNumTest ]]; then echo "Parâmetro #1 deverá ser um inteiro!" exit 0 fi Wil...
asked by 25.03.2015 / 16:08
1
answer

More elegant ways to reverse integers, arrays, and strings in Python

Save! I've been looking for elegant ways to reverse strings, arrays, and integers in Python. What do you think of my codes below and what do they suggest to improve them? They work ... Thank you! frase = 'eu gosto de python'[::-1] num...
asked by 28.10.2015 / 00:33
1
answer

Recursive function for integer input

I have this code but it does not work very well, that is, if it is integer at first numOfValues is correct, but if not it is with type None , since what is in memory is the first input ( which is not integer). I would like, regardle...
asked by 04.03.2015 / 15:56
1
answer

Minimum bits needed to represent a natural number

What is the most performative way of finding the minimum number of bits needed to represent a natural number (i.e., no signal) in JavaScript? Is there a way to do without using loops? The code below for example works for every integer between...
asked by 26.07.2014 / 17:29
2
answers

Big integer does not work

My code looks like this: #include <stdio.h> int main() { unsigned long int L, N; scanf("%lu%lu", &L, &N); printf("%lu\n", (L-(N-1))*(L-(N-1)) + (N-1)); return 0; } When the test case has low numbers, the pro...
asked by 11.02.2016 / 22:50
2
answers

What is the rule to convert a binary value to a negative number and vice versa?

I was left with a doubt after @bigown answered this question: What is the ~ (useful) operator used in PHP ? How can I get the negative value in binary? And how, through the binary, reach a negative value? In @bigown's response, he...
asked by 05.08.2015 / 18:35