Commit Graph

112 Commits

Author SHA1 Message Date
Dmitri Gribenko
10a8f4e3f9 Merge pull request #348 from wczekalski/bugfix/float-string-precision
Fix precision of float to string to max significant decimals
2015-12-15 02:41:49 -08:00
Wojtek Czekalski
10b61b7d8c Made floating point numbers conform to CustomDebugStringConvertible
debugDescription prints numbers with greater precision
2015-12-14 19:25:14 +01:00
Wojtek Czekalski
e4fe5f1508 Introduced debug parameter in floating point to string conversion 2015-12-14 19:25:13 +01:00
Wojtek Czekalski
1ed9da86db Fix precision of float to string to max significant decimals
The default precision which is used for converting floating point numbers to strings leads to many confusing results. If we take a Float32 1.00000000 value and 1.00000012 of the same type, these two, obviously are not equal. However, if we log them, we are displayed the same value. So a much more helpful display using 9 decimal digits is thus: [1.00000000 != 1.00000012] showing that the two values are in fact different.
(example taken from: http://www.boost.org/doc/libs/1_59_0/libs/test/doc/html/boost_test/test_output/log_floating_points.html)

I'm by no means a floating point number expert, however having investigated this issue I found numerous sources saying that "magic" numbers 9 and 17 for 32 and 64 bit values respectively are the correct format. Numbers 9 and 17 represent the maximum number of decimal digits that round trips. This means that number 0.100000000000000005 and 0.1000000000000000 are the same as their floating-point representations are concerned.
2015-12-14 13:48:41 +01:00
Dmitri Gribenko
83751888c7 Start porting Swift to Linux on aarch64 (arm64)
Hello world works, a non-trivial part of the testsuite passes.
2015-12-13 17:05:42 -07:00
William Dillon
4bf81e09da Build working on ARMv7l 2015-12-12 22:06:13 -08:00
Chris Willmore
fb6f4be77f Merge pull request #227 from LeoShimonaka/master
Fix typos in docs / comments / method name
2015-12-04 22:44:18 -08:00
Leo Shimonaka
70e66973ee Fix spelling error in documentation / comments / method name 2015-12-05 00:28:08 -05:00
Landon Fuller
30080ae2c4 FreeBSD hides getline()'s prototype by default.
The alternative to _WITH_GETLINE would be to define _POSIX_C_SOURCE
>= 200809.
2015-12-04 12:25:47 -07:00
Landon Fuller
23fee41713 Add missing va_list include. 2015-12-04 12:25:30 -07:00
Joe Groff
5e5cdc6be3 Runtime: Use 'once' instead of static local variable initialization.
The C++ ABI for static locals is a bit heavy compared to dispatch_once; doing this saves more than 1KB in runtime code size. Dispatch_once/call_once is also more likely to be hot because it's also used by Swift and ObjC code.

Alas, llvm::get_execution_seed() from llvm/ADT/Hashing.h still inflicts one static local initialization on us we can't override (without forking Hashing.h, anyway).
2015-11-30 12:08:12 -08:00
Joe Groff
69a206229d Runtime: Start splitting out stubs only needed by the standard library.
Set up a separate libSwiftStubs.a archive for C++ stub functionality that's needed by the standard library but not part of the core runtime interface. Seed it with the Stubs.cpp and LibcShims.cpp files, which consist only of stubs, though a few stubs are still strewn across the runtime code base.
2015-11-11 17:28:57 -08:00