Category : double

so I was trying a question from codechef contest and the question was pretty simple. The question isn’t necessary for my doubt, actually the doubt is, that when I change the data type of the variable "value" from float to double the answer remains the same but the comparison operators work differently #include<bits/stdc++.h> using namespace ..

Read more

I have uninstalled a couple of installations of Python from my Windows 10 machine, but when I try to run pip from the command prompt now, using the only python install that is specified in PATH in the System Environment Variables, it gives me this error: Fatal error in launcher: Unable to create process using ..

Read more

I am trying to read the data from a text file and store it into array.I’m using c++. I need it for solving FEM problem. let say my text file is as follows; node: 1,2,3,4,5,6,7,8,9,10 x: 4,4,3.75,3.76773151,3,3.59192947,4,3.5,3.55115372,3.375, 3.71330586 y: 3,275,3,2.65921885,2.79192947,2.5,3,2.55115372,2.78349365,2.36222989 z: 0,0,0,0,0,0,0,0,0,0 I want to store this data from text file into a 10*4 matrix(myarray[10][4]). ..

Read more

For the following snippet of code: long double foo = 5.32e-5; double bar = foo ; printf("%Lf can be written %Len", foo, foo); printf("%f can be written %en", bar , bar); I’m getting this output: -1950228512509697500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000 can be written 2.725000e+002 0.000053 can be written 5.320000e-005 foo has been converted to bar without issue, this makes ..

Read more

I wrote such a code to find the grid step(difference between two adjacent machine-representable numbers, machine epsilon the difference between the minimum machine-representable number greater than one and one), the teacher says: Give examples for which the program gives the wrong answer. How do you fix the program to make it work correctly? Help please ..

Read more

Lets say i have a string "53.430996", I want to convert it to a string and store all the values after the floating point I tried: #include <iostream> #include <bits/stdc++.h> #include <string> #include <stdlib.h> using namespace std; int main(){ char* convertme="53.430996"; double converted=atof(convertme); cout << converted; return 0; } But the output is 53.431 but ..

Read more