Questions tagged [long-double]

Questions related to `long double` floating-point data-type (numbers) as commonly found in languages like C and C++. Sometimes referred to as quadruple-precision floating-point data-type (numbers).

143 questions
3
votes
1 answer

Compiling Windows C++ application with long doubles in VS2010

At work we have MSVS2010 Ultimate, and I'm writing a program which runs exhaustive simulations using real numbers. I'm getting non-trivial round-off errors and I've already taken reasonable steps to ensure my algorithm is as numerically stable as…
Ozzah
  • 10,386
  • 15
  • 69
  • 112
3
votes
1 answer

Favorite/Best A.X=B Solver that Supports Long Doubles?

I am hoping to repeatedly hammer an X=B(A^-1) problem. That is, solve a linear system. For C++, which numerical solvers have support for 128bit long doubles (quads)? Using C style arrays is a major plus as all my 2D data is stored as a single…
Mikhail
  • 7,123
  • 9
  • 56
  • 121
3
votes
1 answer

Crazy behaviour during execution

I have been doing some inline-asm with gcc. Everything is ALMOST working, up to some behaviour that is just baffling me. I am evaluating a rational polynomial, but need to use 80-bit constants. The generated code seems to be perfect, but on…
3
votes
1 answer

Microsoft's edX C++ course: double vs long double - why a lack of common standard?

I'm in a Software Development A.S. degree program at a local community college. I want to get ahead of my college program (which I find too simplistic). So, I'm studying different languages and technologies everywhere I can (online). I decided to go…
InfiniteLoop
  • 234
  • 2
  • 11
3
votes
4 answers

How to convert a NSString to long double?

I am dealing with a long double value that can have huge values. At one time I have this number represented as NSString and I need to convert it to long double. I see that the only API I have is [myString doubleValue]; I don't see a…
Duck
  • 32,792
  • 46
  • 221
  • 426
3
votes
2 answers

How to force long double in Perl

I lose precision when doing arithmetic or trying to print (debug) numbers this big: 1234567890.123456789 I think my problems are with $d (result of arithmetic) and the formatted print of $e. How can I force long doubles? My Perl version (5.8.4 on…
dnvrdave
  • 107
  • 1
  • 7
3
votes
4 answers

Cout long double issue

So, I'm working on a C++ project. I have a var of long double type and assigned it a value like "1.02" Then, I try to use cout to print it and the result is: -0 I already tried to use setprecision and all I found googling the problem. What is the…
nervousDev
  • 65
  • 3
  • 9
3
votes
1 answer

Difference between double and long double in c++

Can someone explain the differences between doubles and long doubles except for the difference in precision to me? I wrote a program to solve a gravitational n-body problem so i basically integrate second order differential equations and my program…
3
votes
3 answers

confusion with data structure allignment?

Code 1:- struct emp { char a; double b; }; int main() { struct emp e; printf("%p %p", (void*)&e.a, (void*)&e.b); } Output on my computer:- OO28FF00 0028FF08 As the size of char and double is '1' and '8' respectively and hence the…
kevin gomes
  • 1,675
  • 4
  • 18
  • 30
3
votes
3 answers

accessing long double bit representation

TLDR; Does the following code invoke undefined (or unspecified) behaviour ? #include #include void printme(void *c, size_t n) { /* print n bytes in binary */ } int main() { long double value1 = 0; long double value2 =…
andreabedini
  • 1,255
  • 1
  • 12
  • 20
3
votes
2 answers

Sum of two "np.longdouble"s yields big numerical error

Good morning, I'm reading two numbers from a FITS file (representing the integer and floating point parts of a single number), converting them to long doubles (128 bit in my machine), and then summing them up. The result is not as precise as I would…
matteo
  • 209
  • 1
  • 10
2
votes
2 answers

Is long double useful in ANSI C?

There is a data type in C89 (ANSI C) standard called long double, but there is no any mathematical function to support long double (). For example, sin function accepts a long argument. C99 supports mathematical functions for long double. My…
Amir Saniyan
  • 10,990
  • 18
  • 77
  • 124
2
votes
1 answer

Long double precision error saturation in RK integrator

I'm trying to write an integrator which uses long doubles for very high precision. I know that my system architecture has long double support, but for some reason, the precision of my integrator maxes out at 16 significant digits. Here's some code…
David
  • 394
  • 2
  • 13
2
votes
1 answer

Format specifier %Lf is giving errors for `long double` variables

I am getting the following errors: In function 'main': [Warning] unknown conversion type character 'L' in format [-Wformat=] [Warning] too many arguments for format [-Wformat-extra-args] In function 'error_user': [Warning] unknown conversion type…
Henry
  • 617
  • 1
  • 5
  • 12
2
votes
1 answer

Support for float128 (np.longdouble) in scipy.stats

I would like to make some probability computations with scipy.stats, and avoid under/overflows: in addition to using the appropriate log-functions, I tried to increase the float precision using numpy.longdouble (float128 on Ubuntu). However, the…
PlasmaBinturong
  • 1,428
  • 13
  • 16
1 2
3
9 10