double

Delete Tuples in more dimensional list if same

て烟熏妆下的殇ゞ 提交于 2020-01-04 05:24:11
问题 I have a list of tuples namely: [[[('p', 'u'), ('r', 'w')], [('t', 'q')]], [[('p', 'u'), ('r', 'w')], [('v', 'q')]], [[('p', 'u'), ('r', 'w')], [('t', 's')]], [[('p', 'u'), ('r', 'w')], [('v', 's')]], [[('p', 'w'), ('r', 'u')], [('t', 'q')]], [[('p', 'w'), ('r', 'u')], [('v', 'q')]], [[('p', 'w'), ('r', 'u')], [('t', 's')]], [[('p', 'w'), ('r', 'u')], [('v', 's')]], [[('r', 'u'), ('p', 'w')], [('t', 'q')]], [[('r', 'u'), ('p', 'w')], [('v', 'q')]], [[('r', 'u'), ('p', 'w')], [('t', 's')]], [[

Are there Move (_mm_move_ss) and Set (_mm_set_ss) intrinsics that work for doubles (__m128d)?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-04 05:17:11
问题 Over the years, a few times I have seen intrinsics functions with in float parameters that get transformed to __m128 with the following code: __m128 b = _mm_move_ss(m, _mm_set_ss(a)); . For instance: void MyFunction(float y) { __m128 a = _mm_move_ss(m, _mm_set_ss(y)); //m is __m128 //do whatever it is with 'a' } I wonder if there is a similar way of using _mm_move and _mm_set intrinsics to do the same for doubles ( __m128d )? 回答1: Almost every _ss and _ps intrinsic / instruction has a double

Are there Move (_mm_move_ss) and Set (_mm_set_ss) intrinsics that work for doubles (__m128d)?

百般思念 提交于 2020-01-04 05:17:06
问题 Over the years, a few times I have seen intrinsics functions with in float parameters that get transformed to __m128 with the following code: __m128 b = _mm_move_ss(m, _mm_set_ss(a)); . For instance: void MyFunction(float y) { __m128 a = _mm_move_ss(m, _mm_set_ss(y)); //m is __m128 //do whatever it is with 'a' } I wonder if there is a similar way of using _mm_move and _mm_set intrinsics to do the same for doubles ( __m128d )? 回答1: Almost every _ss and _ps intrinsic / instruction has a double

Replicate certain values in vector determined by other vector

安稳与你 提交于 2020-01-04 04:01:21
问题 I have a vector of values (say 1:10 ), and want to repeat certain values in it 2 or more times, determined by another vector (say c(3,4,6,8) ). In this example, the result would be c(1,2,3,3,4,4,5,6,6,7,8,8,9,10) when repeating 2 times. This should work for an arbitrary length range vector (like 200:600 ), with a second vector which is contained by the first. Is there a handy way to achieve this? 回答1: Akrun's is a more compact method, but this also will work # get rep vector reps <- rep(1L,

NSTimeInterval to readable NSNumber

帅比萌擦擦* 提交于 2020-01-04 01:52:27
问题 NSTimeInterval == double; (e.g. 169.12345666663) How can I round up this double so that there are only 2 digits left after the "dot"? It would be very good if the result is a NSNumber. 回答1: If this is for display purposes, take a look at NSNumberFormatter. If you really want to round the double in your calculations for some reason, you can use the standard C round() function. 回答2: A NSDecimal can be rounded to a specified number of digits with NSDecimalRound(). double d = [[NSDate date]

Literal Assignment in Java [duplicate]

落爺英雄遲暮 提交于 2020-01-03 12:25:28
问题 This question already has answers here : Java's L number (long) specification (6 answers) Closed 3 years ago . what's the difference in defining double example = 23.1d or double example = 23.1 Why long, float and double can end with l, f, d? 回答1: There is no difference between double example = 23.1d; and double example = 23.1; because a floating point literal without a type suffix is always interpreted as a double. The type suffixes are necessary in order to avoid ambiguities in certain

Literal Assignment in Java [duplicate]

旧时模样 提交于 2020-01-03 12:23:41
问题 This question already has answers here : Java's L number (long) specification (6 answers) Closed 3 years ago . what's the difference in defining double example = 23.1d or double example = 23.1 Why long, float and double can end with l, f, d? 回答1: There is no difference between double example = 23.1d; and double example = 23.1; because a floating point literal without a type suffix is always interpreted as a double. The type suffixes are necessary in order to avoid ambiguities in certain

Implementation of type “long double” with GCC and C++11

假如想象 提交于 2020-01-03 09:43:56
问题 I've tried searching for information on long double, and so far I understand it is implemented differently by compilers. When using GCC on Ubuntu (XUbuntu) Linux 12.10 I get this: double PId = acos(-1); long double PIl = acos(-1); std::cout.precision(100); std::cout << "PId " << sizeof(double) << " : " << PId << std::endl; std::cout << "PIl " << sizeof(long double) << " : " << PIl << std::endl; Output: PId 8 : 3.141592653589793115997963468544185161590576171875 PIl 16 : 3

Implementation of type “long double” with GCC and C++11

若如初见. 提交于 2020-01-03 09:42:14
问题 I've tried searching for information on long double, and so far I understand it is implemented differently by compilers. When using GCC on Ubuntu (XUbuntu) Linux 12.10 I get this: double PId = acos(-1); long double PIl = acos(-1); std::cout.precision(100); std::cout << "PId " << sizeof(double) << " : " << PId << std::endl; std::cout << "PIl " << sizeof(long double) << " : " << PIl << std::endl; Output: PId 8 : 3.141592653589793115997963468544185161590576171875 PIl 16 : 3

Any equivalent of “extended” for C#?

纵然是瞬间 提交于 2020-01-03 08:39:26
问题 I'm working on a new version of my Mandelbrot screensaver and I'm running out of floating point accuracy - simple double values don't have enough significant figures for my needs. More significant figures = greater levels of zooming into the fractal Back when I wrote a version of this screensaver in Delphi 7, I used the extended floating point type, 80 bits in size. In .NET, I could switch to decimal, but the performance hit for this is terrible, slowing down fractal generation by a factor of