Questions tagged [numeric-conversion]

24 questions
1
vote
3 answers

Type aware string to number conversion in C++

Let's assume all the numbers in this world are positive integers and they can be represented by uintX_t C++ types. Let's consider next awesome code to convert a std::string to a number: #include #include #include…
Mircea Ispas
  • 20,260
  • 32
  • 123
  • 211
0
votes
7 answers

Casting and Convert.ToInt32() behave different in C#?

Here a simple C# piece of code: Convert.ToInt32(TimeSpan.FromMinutes(5).TotalMilliseconds); //which brings me 300000 (int)TimeSpan.FromMinutes(5).Milliseconds; //which brings me 0 Why would casting (int) result is different when compared to…
Junior Mayhé
  • 16,144
  • 26
  • 115
  • 161
0
votes
1 answer

How do I stop implicit date conversion when using ifelse with date time data?

I have a data frame that contains one column that is a series of dates, collected via a Google form. The date and time were collected separately. The data was entered by selecting a day from a calendar, and the date was entered manually - should…
Michelle
  • 1,281
  • 2
  • 16
  • 31
0
votes
2 answers

Error converting varchar to numeric (but there's no number)

I have a table with several columns, like this: CREATE TABLE CRM.INFO_ADICIONAL ( ID_INFO_ADICIONAL NUMBER(10) NOT NULL, NOMBRE VARCHAR2(100 BYTE) NOT NULL, OBLIGATORIO NUMBER(1) NOT…
0
votes
1 answer

convert factor to numeric in bash

What's the most efficient way to convert a factor vector (not all levels are unique) into a numeric vector in bash? The values in the numeric vector do not matter as long as each represents a unique level of the factor. To illustrate, this would be…
9987
  • 43
  • 4
0
votes
2 answers

C++ void reverse function

We are converting base 10 to a number in a different base(B). I am having trouble with the void reverse function it will not reverse the order of the numbers. string convertToBaseB(int num, int b){ int digit; stringstream answer; string x=""; …
0
votes
1 answer

How to convert UInt64 to Int64?

The second argument in this function call: dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC) causes the compiler error: 'UInt64' is not convertible to 'Int64' Swift Reference: func dispatch_time(when: dispatch_time_t, delta: Int64) ->…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
0
votes
1 answer

Silverlight XAML Binding -- Decimal to Double

I've got some Columns in a DataGridView that have their Binding property set to something like the following: Binding="{Binding NetPrice}" The problem is that this NetPrice field is a Decimal type and I would like to convert it to Double inside the…
Overhed
  • 1,289
  • 1
  • 13
  • 41
-1
votes
2 answers

How may I convert a three-digit Arabic number (Perl [0-9][0-9][0-9]) to a three-digit English representation ([zero-nine][zero-nine][zero-nine])

The alternative is to use Roman numerals, for which a package is available. I am using the LaTeX catchfile package and the \input{} command to associate a title in a set of TITLE files with \section{} commands in a set of DOCUMENT files. I would…
russ
  • 1
  • 1
1
2