Hello,
Debugging some finance-related SQL code found a strange issue with numeric(24,8) mathematics precision.
Running the following query on your MSSQL you would get A + B * C expression result to be 0.123457
SELECT A,
B,
C,
A + B * C
FROM
(
SELECT CAST(0.12345678 AS NUMERIC(24,8)) AS A,
CAST(0 AS NUMERIC(...
Fixed: See notes at bottom
I am implementing a generic class that supports two features, implicit type conversion and custom equality operators. Well, it supports IN-equality as well, if it does that.
1) if ( "value" = myInstance ) then ...
2) Dim s As String = myInstance
3) Dim s As String = CType(myInstance,String)
The problem I ...
Back in VB6, I wrote a few functions that would let me code without having to care about the difference between null and '' for strings, null and 0 for numbers, etc. Nothing kills my productivity more when coding than having to add special case code for dealing with data that might cause some irrelevant error; 9999/10000 if something I'...
What is the best way to convert an int or null to boolean value in an SQL query, such that:
Any non-null value is TRUE in the results
Any null value is FALSE in the results
...
The number is bigger than int & long but can be accomodated in Decimal. But the normal ToString or Convert methods don't work on Decimal.
...
How can I convert an int64 to an int32 type in F# without Microsoft.FSharp.Compatibility.Int32.of_int64
I'm doing this because interactive doesn't seem to work when I try
open Microsoft.FSharp.Compatibility
With FSharp.PowerPack added as a reference it says:error FS0039: The namespace 'Compatibility' is not defined.
Edit: does anyo...
how to convert tis-620 string to utf-8 string in java
...
How do i convert a string to a decimal in unity javascript
...
I need to convert strings with optional trailing signs into actual numbers using Powershell.
Possible strings are:
1000-
323+
456
I'm trying to use System.Int.TryParse with a NumberStyles of AllowTrailingSign, but I can't work out how to make System.Globalization.NumberStyles available to Powershell.
...
I'm attempting to learn basic Win32 programming and running into a frustrating problem. I wish to convert a variable (Call it NumClicks) and display it as the application name (as part of a string).
From what I've seen, going from int + some block of text to a char* is problematic, because converting it to the requisite end data type(LPC...
I'm trying to make a generic method for type conversions which gets an object and the type of object to be cast.
By using Convert.ChangeType() I can do what I want, but it takes too much time on run time. What is the best method to make a generic class like I want.
My old code looks like that;
public static ConvertTo<T>(object data) ...
In java, what is the best way to convert a double to a long?
Just cast? or
double d = 394.000;
long l = (new Double(d)).longValue();
System.out.println("double=" + d + ", long=" + l);
...
JavaScript does funky automatic conversions with objects:
var o = {toString: function() {return "40"; }};
print(o + o);
print((o+1)+o);
print((o*2) + (+o));
will print:
4040
40140
120
This is because +, if any of the arguments are objects/strings, will try to convert all the arguments to strings then concatenate them. If all argume...
In SQL server you can use the DATENAME function to get the day of week as a string
declare @date datetime
set @date = '12/16/08'
select datename(dw, @date)
which returns "Tuesday"
and you can use the DATEPART function to get the day of week as an integer
declare @date datetime
set @date = '12/16/08'
select datepart(dw, @date)
Whic...
I have been playing with javascript arrays and I have run into, what I feel, are some inconsistencies, I hope someone can explain them for me.
Lets start with this:
var myArray = [1, 2, 3, 4, 5];
document.write("Length: " + myArray.length + "<br />");
for( var i in myArray){
document.write( "myArray[" + i + "] = " + myArray[i] + "<...
Are there any standalone type conversion libraries?
I have a data storage system that only understands bytes/strings, but I can tag metadata such as the type to be converted to.
I could hack up some naive system of type converters, as every other application has done before me, or I could hopefully use a standalone library, except I ca...
How can I convert a string to a date time object in javascript by specifying a format string?
I am looking for something like:
var dateTime = convertToDateTime("23.11.2009 12:34:56", "dd.MM.yyyy HH:mm:ss");
...
Can someone tell me why:
var nl = Convert.ToInt64("17029268.1650117");
fails, and instead you have to do this:
var nl = Convert.ToInt64(Convert.ToDouble("17029268.1650117"));
Because it seems so stupid!
...
i have a function like
void printMe (void *i)
{
printf("%d", i);
}
where i want to pass a void pointer and print it to screen.
The above example is fine if the i is integer, float or double but crashes if i is a char. There is no overloading in C like i usually use in C++.
So the question is this, can we create a function in C tha...
I have a column of numbers stored as chars. When I do a ORDER BY for this column I get the following:
100
131
200
21
30
31000
etc.
How can I order these chars numerically? Do I need to convert something or is there already an SQL command or function for this?
Thank You.
...