Questions tagged [double-precision]

Anything related to double-precision floating-point arithmetic and data-types. Often used with reference to IEEE754 double-precision floating-point representation.

240 questions
4
votes
1 answer

GLSL Double Precision Angle, Trig and Exponential Functions Workaround

In GLSL there's rudimentary support for double precision variables and operations which can be found here. However they also mention "Double-precision versions of angle, trigonometry, and exponential functions are not supported.". Is there a…
4
votes
1 answer

GCC What's the right inline assembly constraint to operate with ARM VFP instructions?

I want to load the value of a double precision register (d8) into a C variable on ARM platform with a toolchain (gcc-4.6) that comes with the Google NDKv8b. My ARM machine is a Samsung Galaxy S2 (it has VFPv3 and NEON). The GCC documentation says…
4
votes
3 answers

Storing numbers with higher precision in C

I am writing a program in which I need to store numbers with a very high precision(around 10^-10) and then further use them a parameter( create_bloomfilter ([yet to decide the type] falsePositivity, long expected_num_of_elem) ). The highest…
Aman Deep Gautam
  • 8,091
  • 21
  • 74
  • 130
3
votes
1 answer

postfix 'd+0' in Fortran real literal expressions

Does anyone knwow what the postfix "d+0" means in the assignments to M1, M2 and M4 below or is there any resource on the web or a book where one is very likely to find this information? subroutine plot( t, x, p, q, nga, nt, wron, & …
Cetin Sert
  • 4,497
  • 5
  • 38
  • 76
3
votes
3 answers

Error due to limited precision of float and double

In C++, I use the following code to work out the order of magnitude of the error due to the limited precision of float and double: float n=1; float dec = 1; while(n!=(n-dec)) { dec = dec/10; } cout << dec << endl; (in the double case all…
Ben
  • 15,938
  • 19
  • 92
  • 138
3
votes
5 answers

C++: difference between 0. and 0.0?

I am well aware of the difference between 0 and 0.0 (int and double). But is there any difference between 0. and 0.0 ( please note the . )? Thanks a lot in advance, Axel
user541747
  • 73
  • 1
  • 4
3
votes
1 answer

double precision integer subtraction with 32-bit registers(MIPS)

I am learning computer arithmetic. The book I use(Patterson and Hennessey) lists the below question. Write mips code to conduct double precision integer subtraction for 64-bit data. Assume the first operand to be in registers $t4(hi) and …
Abhijith Madhav
  • 2,748
  • 5
  • 33
  • 44
3
votes
1 answer

How to get the mantissa and exponent of a double in a power of 10?

I saw the function double frexp (double x, int* exp);, which splits a double into the mantissa (m) and the exponent (e), with a power of 2 (1.m * 2^e). Is there a similar function that returns the value in a power of 10? Something like m * 10^e…
fc67
  • 409
  • 5
  • 17
3
votes
1 answer

Double and float may have the same precision?

I have to implements a program that calculate the machine epsilon for float and double. I wrote these functions: int feps(){ //machine epsilon for float float tmp=1; int d=0; while(1+(tmp=tmp/2)>1.0f)d++; return d; } int…
LolloFake
  • 65
  • 6
3
votes
2 answers

How to set double precision in C++ on MacOSX?

I'm trying to port _controlfp( _CW_DEFAULT, 0xffffffff ); from WIN32 to Mac OS X / Intel. I have absolutely no idea how to port this instruction... And you? Thanks!
moala
  • 5,094
  • 9
  • 45
  • 66
3
votes
1 answer

How do you use double in OpenCL on a MacPro?

I have a Mac Pro (Late 2013) and I want to do some math in double using OpenCL. When I was using Mavericks the CL_DEVICE_EXTENSIONS for my FirePro GPU only listed cl_APPLE_fp64_basic_ops so I couldn't use double math functions like exp(). I…
dusty_keyboard
  • 136
  • 1
  • 5
3
votes
4 answers

Isn't double able to represent any 2^n number without precision issues? n is natural

This code: double x = 2.0; for(int i = 1 ; i<1024 ; i+=i) { Console.WriteLine( String.Format( "2^{0} = {1:F0}", i, x ) ); x*=x; } Outputs: 2^1 = 2 2^2 = 4 2^4 = 16 2^8 = 256 2^16 = 65536 2^32 = 4294967296 2^64 = 18446744073709600000 2^128 =…
LyingOnTheSky
  • 2,844
  • 1
  • 14
  • 33
3
votes
1 answer

MATLAB precision when substracting

I need high precision for a project I'm working on. The problem I have is illustrated here when substracting: >> 1-0.9999999999999999 ans = 1.1102e-16 >> 1-0.99999999999999999 ans = 0 I know it's related to the double precision. Is there anyway…
3
votes
1 answer

Possible loss of precision with Gram-Schmidt

I have a code that uses Gram-Schmidt inside a loop. I want to reduce the number of calls to this algorithm as much as possible, but the thing is that despite of getting the same result before and after the call, when I print the results of some…
fc67
  • 409
  • 5
  • 17
3
votes
2 answers

CUDA's warp shuffle for double-precision data

A CUDA program should do reduction for double-precision data, I use Julien Demouth's slides named "Shuffle: Tips and Tricks" the shuffle function is below: /*for shuffle of double-precision point */ __device__ __inline__ double shfl(double x, int…
taoyuan
  • 85
  • 1
  • 7