Все вопросы: [integer]
222 вопросов
Почему этот код в VBA Powerpoint отлично работает без команд Dim для чисел?
Из одного из руководств по VBA я узнал, что переменные, содержащие числа, должны быть сначала объявлены как целые числа: Dim mynumber as integer Но, пожалуйста, посмотрите на этот код: Sub math() A = 23 B = 2 ABSumTotal = A + B strMsg = "The answer is " & "$" & ABSu...
Правильный способ в SQL справиться с разницей между отсутствием значения и нулевым значением в поле типа данных INT
У меня возникли проблемы с полем INT, в котором может отсутствовать значение, нулевое значение или целое число больше нуля, и поскольку SELECT foo FROM bar where foo = '' оценивается идентично SELECT foo FROM bar where foo = 0 Я переопределил foo как foo INT (11) NULL, чтобы строки...
Как преобразовать целое число в дату на странице JSP, а затем отформатировать эту дату?
Я получаю следующую переменную, но не могу отформатировать целое число, поэтому есть ли способ преобразовать целое число в дату на странице JSP? <fmt:formatDate value="${c.dateInIntegerValue}" pattern="dd.MM.yyyy hh:mm"/>
Хранение целых чисел в словаре
Насколько я понимаю, в Objective-C можно помещать объекты только в словари.Так что, если бы мне пришлось создать словарь, в нем должны были бы быть все объекты.Это означает, что мне нужно ввести целые числа как NSNumber, верно? Так ... NSNumber *testNum = [NSNumber numberWithInt:varMoney];...
Почему 128 == 128 ложно, а 127 == 127 истинно при сравнении целочисленных оберток в Java?
class D { public static void main(String args[]) { Integer b2=128; Integer b3=128; System.out.println(b2==b3); } } Вывод: false class D { public static void main(String args[]) { Integer b2=127; Integer b3=127; System.out.p...
Генератор псевдослучайных последовательностей, а не просто генератор чисел
Мне нужен алгоритм, который в значительной степени превратит временную метку unix в подходящее случайное число, чтобы, если я «воспроизвожу» временные метки, я получал те же случайные числа. И вот что я имею в виду под "подходящим": Большинство людей не обнаруживают петли или закономернос...
Преобразование из строки "" в тип "Целое число" недопустимо.
Когда я пытаюсь запустить следующий код, я получаю сообщение "Преобразование из строки" "в тип" Целое число "недопустимо. ошибка. Dim maj = (From c In connect.Courses _ Where c.COTRequired = CBool("True") _ Select c.CourseID, c.CourseName, c.CreditH...
@synthesize не работает, и основные операции не работают в Objective-C
Я не понимаю, почему этот код не работает.Когда я нажимаю кнопку (действие: buttonclick), она должна изменить значение увеличения текста «r» в двух текстовых полях (MyTextLabel и MyTextLabel2) на единицу.Вот код: MainView.h #import <UIKit/UIKit.h> #import <Foundation/Foundation.h>...
Класс Python с целочисленной эмуляцией
Приведен следующий пример: class Foo(object): def __init__(self, value=0): self.value=value def __int__(self): return self.value Я хочу иметь класс Foo , который действует как целое число (или число с плавающей запятой). Итак, я хочу сделать следующее: f=Foo(3...
Размер int в C на разных архитектурах
Мне известно, что спецификация языка C не требует точного размера каждого целочисленного типа (например, int). Что мне интересно: есть ли способ в C (не C ++) определить целочисленный тип с определенным размером, который гарантирует, что он будет одинаковым для разных архитектур?Нравится: ...
Fast Multiplication
I'm writing code for a microprocessor with fast integer arithmetic and not so fast float arithmetic. I need to divide an integer by a number from 1 to 9 and convert result back to integer. I made a float array with members like 0, 1, 0.5, 0.3333 etc. But i think there is MAGIC constants (like 0x...
Quick Multiplication Question - Cocoa
I'm still learning, and I'm just stuck. I want the user to enter any number and in result, my program will do this equation: x = 5*y (y is the number the user adds, x is outcome) How would I do this? I'm not sure if I'm suppose to add in an int or NSString. Which should I use, and should I en...
How does an environment (e.g. Ruby) handle massive integers?
My integers in Ruby (MRI) refuse to overflow. I've noticed the class change from fixnum to bignum but I'm wondering how this is modeled and what sort of process ruby uses to perform arithmetic on these massive integers. I've seen this behaviour in SCHEME as well as other environments. I ask bec...
How to convert an ASCII value into a character in .NET
There are a million posts on here on how to convert a character to its ASCII value. Well I want the complete opposite. I have an ASCII value stored as an int and I want to display its ASCII character representation in a string. i.e. please display the code to convert the int 65 to A. What I hav...
Perfect square and perfect cube
Is there any predefined function in c++ to check whether the number is square of any number and same for the cube..
Generating random whole numbers in JavaScript in a specific range?
How can I generate random whole numbers between two specified variables in JavaScript, e.g. x = 4 and y = 8 would output any of 4, 5, 6, 7, 8?
How to properly compare two Integers in Java?
I know that if you compare a boxed primitive Integer with a constant such as: Integer a = 4; if (a < 5) a will automatically be unboxed and the comparison will work. However, what happens when you are comparing two boxed Integers and want to compare either equality or less than/greater tha...
Why is the number 16 converted to float(6.1026988574311E_320) by PHP using Zend_Amf
The Zend_Amf specification states that a Number type returned from flash will map to a float in PHP. Fine. But why does the number 16 get returned as 6.1026988574311E_320 ? PHP version is 5.2.9 running on OS X. I have tried forcing a cast to integer in PHP (the above value gets rounded to 0) and...
How can I check if a string contains a number smaller than an integer?
Having some issue with this... if (System.Convert.ToInt32(TotalCost(theOrder.OrderData.ToString()).ToString()) < 10000) ViewData["cc"] = "OK"; else ViewData["cc"] = "NO"; yields: "Input string was not in a correct format." How can I check if the number inside the st...
Efficient way to determine number of digits in an integer
What is a very efficient way of determining how many digits there are in an integer in C++?
PHP's unsigned integer on 32 bit and 64 bit platform
Here is the code: echo sprintf('%u',-123); And this is the output on 32 bit platform: 4294967173 but on 64 bit: 18446744073709551493 How to make it the same ?Say,the int(10) unsigned
initwithint warning, no method found?
I have a warning and just can't work out how to make it go away. In my .h I have this... -(void)restartTimer; Then the in my .m I have... -(void)restartTimer{ TimerViewController *TimerView = [[TimerViewController alloc] initWithInt:hStart number:mStart]; I get this error: Warning: no...
What is the fastest int to float conversion on the iPhone?
I am converting some Int16s and Int32s to float and then back again. I'm just using a straight cast, but doing this 44100 times per second (any guesses what its for? :) ) Is a cast efficient? Can it be done any faster? P.S Compile for thumb is turned off.
How to do an Integer.parseInt() for a decimal number?
The Java code is as follows: String s = "0.01"; int i = Integer.parseInt(s); However this is throwing a NumberFormatException... What could be going wrong?
Mapping integers onto the entire range
I'm using a hash table (DotNET Dictionary object) as part of a sparse two-dimensional data set. Most of the entries in the hash table will be close together. I'll probably end up with 100 ~ 10,000 entries, all of them clustered near zero. I've read that a Hash table performs better when the hashe...
How do programming languages handle huge number arithmetic
For a computer working with a 64 bit processor, the largest number that it can handle would be 264 = 18,446,744,073,709,551,616. How does programming languages, say Java or be it C, C++ handle arithmetic of numbers higher than this value. Any register cannot hold it as a single piece. How was thi...
Sending int through socket in Java
What is the best possible way to send an int through a socket in Java? Right now I'm looking at sockout.write((byte)( length >> 24 )); sockout.write((byte)( (length << 8) >> 24 )); sockout.write((byte)( (length << 16) >> 24 )); sockout.write((byte)( (length <<...
Use of hasNextLine in Java, won't read NextLine after NextInt
I am trying to get this to work System.out.println("Please enter what SOCKET NUMBER you" + "wish to connect to"); int sockname = Integer.parseInt(inFromUser.nextLine()); System.out.println("Please enter what HOSTNAME you" + "wish to connect to"); String hostname = inFro...