long-double

Why did Microsoft abandon long double data type? [closed]

三世轮回 提交于 2019-12-28 14:07:08
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . A while ago I wrote a program which used some factorial functions. I used the long double data type to support "relative" big numbers.

Actual long double precision does not agree with std::numeric_limits

情到浓时终转凉″ 提交于 2019-12-24 16:01:37
问题 Working on Mac OS X 10.6.2, Intel, with i686-apple-darwin10-g++-4.2.1, and compiling with the -arch x86_64 flag, I just noticed that while... std::numeric_limits<long double>::max_exponent10 = 4932 ...as is expected, when a long double is actually set to a value with exponent greater than 308, it becomes inf--ie in reality it only has 64bit precision instead of 80bit. Also, sizeof() is showing long doubles to be 16 bytes, which they should be. Finally, using <limits.h> gives the same results

The precision of the long double output is not correct. What might be wrong?

爷,独闯天下 提交于 2019-12-24 10:29:57
问题 I have a long double constant that I am setting either as const or not-const. It is longer (40 digits) than the precision of a long double on my test workstation (19 digits). When I print it out, it no longer is displayed at 19 digits of precision, but at 16. Here is the code I am testing: #include <iostream> #include <iomanip> #include <limits> #include <cstdio> int main () { const long double constLog2 = 0.6931471805599453094172321214581765680755; long double log2 = 0

How do I use the numpy longdouble dtype?

守給你的承諾、 提交于 2019-12-23 09:34:59
问题 I am trying to work with the np.longdouble dtype in my Python code, and am trying to use NumPy to manipulate long doubles that I get from a C module compiled with Cython. Suppose I do this: import numpy as np print np.finfo(np.longdouble) Machine parameters for float128 --------------------------------------------------------------------- precision= 18 resolution= 1e-18 machep= -63 eps= 1.08420217249e-19 negep = -64 epsneg= 5.42101086243e-20 minexp=-16382 tiny= 3.36210314311e-4932 maxexp=

How do I force usage of long doubles with Cython?

青春壹個敷衍的年華 提交于 2019-12-22 10:27:12
问题 I apologize in advance for my poor knowledge of C: I use Python to code and have written a few modules with Cython using the standard C functions to effect a great increase in speed. However, I need a range higher than 1e308 (yes, you read it right), which is what I currently get by using the type double complex and the functions cexp and cabs . I tried to use the functions cexpl and cabsl , and declared my variables to be of type long double complex , but I still encounter overflows after

Define LDBL_MAX/MIN on C

℡╲_俬逩灬. 提交于 2019-12-19 10:53:31
问题 I'm working with C, I have to do an exercise in which I have to print the value of long double min and long double max . I used float.h as header, but these two macros ( LDBL_MIN/MAX ) give me the same value as if it was just a double. I'm using Visual Studio 2015 and if I hover the mouse on LDBL MIN it says #define LDBL_MIN DBL_MIN . Is that why it prints dbl_min instead of ldbl_min ? How can I fix this problem? printf("Type: Long Double Value: %lf Min: %e Max: %e Memory:%lu\n", val10, LDBL

Converting long double in .NET

你说的曾经没有我的故事 提交于 2019-12-13 18:35:17
问题 I have to convert some C code (that ran in a Linux machine) to .Net, and found some operations with long double. They are not special operations, just some multiplications and divisions that end with a lot of decimals, it seems the type was used just because of its size. What would you do in order to convert the code? I'm thinking of just multiply the values and divide back at the end to see if it helps since the code is anyway returning short values at the end, plus I don't know if the

Why these two snippets generate different value?

半城伤御伤魂 提交于 2019-12-11 12:18:50
问题 When I run the following code: #include <stdio.h> int main() { int i = 0; volatile long double sum = 0; for (i = 1; i < 50; ++i) /* first snippet */ { sum += (long double)1 / i; } printf("%.20Lf\n", sum); sum = 0; for (i = 49; i > 0; --i) /* second snippet */ { sum += (long double)1 / i; } printf("%.20Lf", sum); return 0; } The output is: 4.47920533832942346919 4.47920533832942524555 Shouldn't the two numbers be same? And more interestingly, the following code: #include <stdio.h> int main() {

C - long double and printf issue

可紊 提交于 2019-12-11 03:26:11
问题 I am new C programmer and I am working on a school project where I have to approximate the value or pi. My professor stated that we have to declare all integer terms using long double . The console shows me asking the user for the number of terms to approximate pi given a function. I enter 1 for the number of terms however the code returns -0.00000000 instead of 4.00000000. #include <stdio.h> #include <math.h> long double approx1(int terms) { long double pi = 0; long double num = 4; long

Longdouble(1e3000) becomes inf: What can I do?

断了今生、忘了曾经 提交于 2019-12-11 02:29:14
问题 (Most other related questions in the web concern conversion between C's longdouble and python's. This question is different.) I do not see why I cannot correctly get a longdouble in python like this: In [72]: import numpy as np In [73]: np.longdouble(1e3000) Out[73]: inf It seems that I need to let my python console know 1e3000 is a longdouble instead of double. How can I do that 回答1: The problem is that by using an expression like ...(1e3000) , the Python parser has to calculate what is