I have a csv file where amount and quantity fields are present in each detail record except header and trailer record. Trailer record has a total charge values which is the total sum of quantity multiplied by amount field in detail records . I need to check whether the trailer total charge value is equal to my calculated value of amoun...
Hi,
I have a case where I should get the elements from an array and I do not know if the type is double or integer.
[array objectAtIndex:2]
and the problem is that I can not identify the type. If i knew the type I simply would perform:
[[item objectAtIndex:2] intValue] or
[[item objectAtIndex:2] doubleValue]
Is there any way to detect...
In c# double type how can i set the number of digits after the point, i need only 4.
thank you.
...
Hi, my app needs to store latitude and longitude values parsed from XML into Core Data. Currently, I have a Core Data Model which has these attributes set to type double. The header file for the Model Object has them defined as NSNumber
How can I convert the string stored in my CurrentNodeText variable into the required type for stor...
So I am working on a program for school, and part of the assignment is to have a bunch of prompts for input pop up. I am using the JOptionPane, which inherently has an OK button and a Cancel button. Now, to make the program exit when they press cancel when the prompt is asking for a string, I have something like this:
firstName = JOpti...
I align numbers with various number of decimals so that the decimal sign aligns on a straight row. This can be achevied by padding with spaces, but I'm having trouble.
Lays say I want to align the following numbers:
0
0.0002
0.531
2.42
12.5
123.0
123172
This is the result I'm after:
0
0.0002
0.531
2.42
12.5
...
I have a csv file where amount and quantity fields are present in each detail record except header and trailer record. Trailer record has a total charge values which is the total sum of quantity multiplied by amount field in detail records . I need to check whether the trailer total charge value is equal to my calculated value of amount ...
I want to round up double value in two decimal places in c# how can i do that?
double inputValue = 48.485;
after round up
inputValue = 48.49;
...
I have a double variable test. I want to extract the all digits before decimal point and two digits after the decimal point store the output in integer variables dollar, cents. how can i do it? I dont want any rounding to happen.
example:
double test= 12.1234
Output
int dollar =12;
int cents =12;
double test =1235.0
output
int ...
I am getting an compilation error "not a statement" for the below code. Not sure what's wrong. inMax is a hasmap. tcharge is a string and it's a key. Is this one a valid statement?
Double tMaxCharge= (Double)inMax.get(tCharge);
...
Suppose I do a
double d = 234.5;
I want to see the memory contents of d [the whole 8 bytes]
How do I do that?
...
I have code to calculate the percentage difference between 2 numbers - (oldNum - newNum) / oldNum * 100; - where both of the numbers are doubles. I expected to have to add some sort of checking / exception handling in case oldNum is 0. However, when I did a test run with values of 0.0 for both oldNum and newNum, execution continued as if...
I know, i've read about the difference between double precision and single precision etc. But they should give the same results on most cases right ?
I was solving a problem on a programming contest and there were calculations with floating point numbers that were not really big so i decided to use float instead of double, and i checked...
Hi everybody.
My question has no practical application. I'm just interested. Suppose, I have a double value and I want to obtain its string representation similarly to the printf function. How would I do that without the C runtime library? Let's suppose I'm on the x86 architecture.
...
Hi,
I've got a static method that accepts two object type variables and runs the CompareTo() method:
public static int Compare(Object objA, Object objB)
{
return (((IComparable)objA).CompareTo(objB));
}
Problem is that CompareTo() throws an exception when trying to compare between different types (e.g. int and double).
Does any one...
Im trying to write something to get my images to show correctly.
I have 2 numbers "breedtePlaatje" and "hoogtePlaatje". When i load those 2 vars with the values i get back "800" and "500" i expect "verH" to be (500 / 800) = 0,625. Tho the value of verH = 0..
This is the code:
int breedtePlaatje = Convert.ToInt32(imagefield.Width);
int...
How can i format a Double to String in c# so as to have only two decimal digits?
If I use String.Format("{0:0.00}%", myDoubleValue) the number is rounded, and i want a simple truncate without rounding. Also, I want the conversion to String to be culture sensitive.
...
Hi!
I tried to write the following program in C# to calculate pi using infinite recursion, but I keep getting confused about integer/double/decimal division.
I really have no clue why this isn't working, so pardon me for my lack of understanding of strongly typed stuff, as I'm still learning C#.
Thanks in advance!
using System;
using ...
I am trying to multiply a double value by -1 to get the negative value. It continues to give me a positive value
EDIT: I am putting all the code up.
public class DecToTime {
public static void main(String[] args) throws IOException {
DecToTime dtt = new DecToTime();
double val = dtt.getNumber("13.930000000000E+02");
S...
Forgive me if this is a dumb beginners problem, but I really don't get it.
I have a member variable declared like so:
public Double Value;
When I assign 3.14159265 to Value and try to compute the sine of it, this happens:
system.out.println(Value.toString()); //outputs 3.14159265
Value = Math.sin(Value);
system.out.println(Value.toS...