+ 8
@~ swim ~ I'm with you on this motion, and recently, I have also found out that direct value assignment for long double type is also buggy (I got -1.#QNAN), it now seems that the main problem lies with the long double type implementation itself rather than with the pow() function, I feel bad to have pointed my finger on pow() function : ) Moreover, the string library is also having some issues, other than what @Eric Blinkidu said, the stoi() method, for converting string to integer is also unusable, I had confirmed with @kurwius about that, I found out about this when trying on a challenge that requires collecting and summarizing numerical strings value, had stoi() been usable I wouldn't need to write my own code, and instead, use stoi(), as it's specification is pretty good, like, it accepts numerical string in multiple base etc. Do you think maybe I should write them too? well I hope this gets some attention somehow, good idea : ) #upvoted #goodmove
9th Dec 2017, 3:54 AM
Ipang
+ 7
@kurwius, In Code Playground, sizeof(long double) is 12 (96bit), so it is unlikely due to C runtime library fault, because if it is, sizeof would return 8 as you explained. I also doubt if SoloLearn is using MinGW for the same reason. For some funny reason, again in SoloLearn, long double is indeed not working as expected, even direct value assignment (not a returned value from a function) to a long double variable is erroneous, and it just happens, even without any I/O using incompatible types. I mean, for something as simple as "long double ld = n;" we don't get the value of n when we use cout to print the variable content. Outside SoloLearn this is not be an issue, as @Gordie and @Babak Sheykhan had proven the fact. According to cppreference the pow function supports long double, both as for the argument and as the return value. http://en.cppreference.com/w/cpp/numeric/math/pow I run your code on Code Playground, and got these results: -0 256.000000 Thank you for the insight on stoi function : )
9th Dec 2017, 2:43 PM
Ipang
+ 7
@~ swim ~ Thanks you're right, there's always something new to learn : ) @kurwius That's great, though, I didn't really expect we would need to use a specific function just for printing value of a certain type, because neither @Gordie nor @Babak Sheykhan needed to use that function in order to print the value on their systems. Thank you, that's a valuable resource you showed me, I'm learning by making mistakes, today you teach me something new : ) #Respect
9th Dec 2017, 5:45 PM
Ipang
+ 6
Yes, agreed. std::to_string() does not work.
8th Dec 2017, 9:34 PM
Eric Blinkidu
Eric Blinkidu - avatar
+ 6
@kurwius Shamefully I have to admit, I don't even have a PC/Laptop, so my code idea relies on Code Playground, and for that, I cannot verify in Visual Studio or any other IDE, or even compiler, honestly. However, I happen to know, having told by @Babak Sheykhan, that my code using long double (which failed here in Code Playground) works in his IDE, which is Visual Studio. And @Gordie also told me the same thing (I'm not sure which compiler is @Gordie using). So my conclusion, at first, it was a problem with pow function, because that failing code assigned value to long double type variable through pow function. Later on, I tested again (out of curiosity) whether not a long double type can work here in Code Playground, by directly assigning value, not through pow function, and found the same problem. P.S. I have no intention to dishonor or disgrace anyone, was just pointing out some facts I found. No hard feelings... : )
9th Dec 2017, 4:21 PM
Ipang
+ 5
@~ swim ~ It was a bit of surprise to me though mate, I previously thought it would be 128bit, but it turned out, it was 32bit short : )
9th Dec 2017, 3:11 PM
Ipang
+ 5
@~ swim ~ I put it here as evidence, for my statement regarding long double type, being oddly in Code Playground, sorry mate, didn't mean to trash your thread in anyway : )
9th Dec 2017, 4:40 PM
Ipang
+ 4
Okay @Jamie, will do, thanks : )
9th Dec 2017, 3:58 AM
Ipang
+ 3
Even the regex part isn't properly working. The new compiler should be atleast gcc 6.3
9th Dec 2017, 4:22 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 3
problem with using namespace std; that has to be use in c++....
9th Dec 2017, 1:26 PM
Arun
+ 3
It's on! We finally got GCC 7.2.0 with C++17 support std::thread works std::experimental::filesysytem compiles but misses the special link flag
24th Mar 2018, 6:41 AM
Simon
Simon - avatar
+ 1
updates are essential! features like updating compilers are necessary to ensure flexibility in coding practices. SL team should look in to this.
10th Dec 2017, 9:17 PM
Germain F
Germain F - avatar