Commit Graph

1436 Commits

Author SHA1 Message Date
Andrew Kelley
54675b060a add ptrToInt builtin, remove usize(ptr) cast
closes #415
2017-08-08 17:38:25 -04:00
Andrew Kelley
9ca798bc75 zen update 2017-08-08 15:49:12 -04:00
Andrew Kelley
221e5b188c README: add the zen of zig 2017-08-07 19:11:55 -04:00
Andrew Kelley
f78ee53484 fix printing floating point compile errors
now we just need compiler_rt implementations for:

 undefined symbol '__fixunsdfti'
 undefined symbol '__umodti3'
 undefined symbol '__udivti3'
2017-08-07 18:11:24 -04:00
Andrew Kelley
2234788fa8 add ability to explicitly cast float to integer
closes #414
2017-08-07 15:57:41 -04:00
Andrew Kelley
38b47d8aca Merge pull request #412 from zig-lang/issue-399
Correct floating-point literal allowed ranges
2017-08-07 09:15:13 -04:00
Marc Tiehuis
0705b711f8 Correct floating-point literal allowed ranges
The exponent range for floating-point values is [-1022, 1023].

Fixes #399.
2017-08-07 18:08:09 +12:00
Andrew Kelley
d8227c79a2 limit generated C preprocessor tokens to alphabet
closes #407

The mangling strategy replaces bytes outside the alphabet
with "_xx_" where xx is the hex code of the byte.
2017-08-06 19:31:05 -04:00
Andrew Kelley
1268bdfa60 Revert "silence false positives about uninitialized variables"
This reverts commit 3d1a0f2ee9.

breaks build for older compilers
2017-08-06 18:33:30 -04:00
Andrew Kelley
d83e4092bf fix constant debug info when number literal is 0 2017-08-06 18:15:11 -04:00
Andrew Kelley
a0a57beed5 fix invalid target info 2017-08-06 18:14:46 -04:00
Andrew Kelley
f1b2735a2e fix segfault when var args fn proto shows up in ir printing 2017-08-06 18:14:17 -04:00
Andrew Kelley
3d1a0f2ee9 silence false positives about uninitialized variables 2017-08-06 18:13:48 -04:00
Andrew Kelley
d247859ff6 remove duplicate gitignore entry 2017-08-06 16:14:57 -04:00
Andrew Kelley
57fb8efde2 add missing stdcallcc to ExitProcess decl 2017-08-06 16:13:52 -04:00
Andrew Kelley
ad9f48b74b fix initializing undefined and crash when casting to invalid type
closes #408
2017-08-05 16:54:50 -04:00
Marc Tiehuis
27e4893ee5 Add Visual Studio Code extension link 2017-07-15 21:36:47 +12:00
Andrew Kelley
f4b214c010 remove unused enum 2017-07-08 18:02:50 -04:00
Andrew Kelley
d1e68c3ca8 better bigint/bigfloat implementation 2017-07-08 17:59:10 -04:00
Andrew Kelley
3e8af78895 Merge branch 'math'
This merges the standard library math functions that
Marc Tiehuis (@tiehuis) has been working on. Marc has
joined the Zig organization and now has commit access.
Thank you for this huge contribution to Zig.

Closes #374.
2017-06-27 17:15:41 -04:00
Marc Tiehuis
e81bf1c38c Return undefined in frexp instead of 0 on nan input
This is more in line what usual C implementations do.
2017-06-22 19:29:57 +12:00
Marc Tiehuis
5aff641f4b Fix pow tests
See #393.
2017-06-21 23:24:00 +12:00
Marc Tiehuis
994f4da8d4 Fix scalbn constant multiplier 2017-06-21 18:53:33 +12:00
Marc Tiehuis
14a324a0fa Fixes for release mode tests 2017-06-21 18:21:11 +12:00
Andrew Kelley
dfa2d11167 fix incorrect install line in cmakelists 2017-06-20 11:10:54 -04:00
Marc Tiehuis
aeb12d52b0 Add install targets for math library files 2017-06-20 23:10:50 +12:00
Marc Tiehuis
5bbec42a4e Add math special case tests and general fixes
- Should cover special case inputs for most functions
 - Fixed a number of runtime panicking behaviour reliant on shift
   overflow/division by zero etc.
2017-06-20 23:10:22 +12:00
Andrew Kelley
221286433a don't call c.getrandom because older libcs don't have it
See #397
2017-06-19 21:39:44 -04:00
Andrew Kelley
c9fc8bd802 workaround for llvm bug
See #393 for details
2017-06-19 14:36:33 -04:00
Andrew Kelley
799c699101 Merge branch 'master' into math 2017-06-19 11:01:41 -04:00
Andrew Kelley
62b23f5da5 build: link against system libs reported by llvm-config 2017-06-19 10:33:19 -04:00
Marc Tiehuis
4efb9ae2e5 Get tests passing under release mode
This does not fix the underlying issue in pow at this stage, but we may
be able to narrow down the cause after adding tests for specific edge
cases in functions.
2017-06-18 14:16:04 +12:00
Andrew Kelley
62323eeb75 std: refactor pow to be generic 2017-06-17 20:39:45 -04:00
Andrew Kelley
76344a6fc4 Merge branch 'trailing-commas' 2017-06-17 10:35:22 -04:00
scurest
1a63f27247 allow trailing commas
closes #392
2017-06-17 10:34:51 -04:00
Andrew Kelley
1566ca21c4 fix peer type resolution for array and error
closes #388
2017-06-17 10:29:04 -04:00
Andrew Kelley
91afdc58d2 update C headers to clang 4.0.0
closes #389
2017-06-16 14:35:00 -04:00
Andrew Kelley
c0f9012bed parseh: fix not recognizing integer suffixes on hex numbers 2017-06-16 14:34:38 -04:00
Marc Tiehuis
4c16f9a3c3 Add math library
This covers the majority of the functions as covered by the C99
specification for a math library.

Code is adapted primarily from musl libc, with the pow and standard
trigonometric functions adapted from the Go stdlib.

Changes:

 - Remove assert expose in index and import as needed.
 - Add float log function and merge with existing base 2 integer
   implementation.

See https://github.com/tiehuis/zig-fmath.
See #374.
2017-06-16 20:32:31 +12:00
Andrew Kelley
865b53f286 fix alignOf builtin
* fix assertion error when type is not yet complete
 * fix alignment value

closes #391
2017-06-15 23:47:05 -04:00
Andrew Kelley
ae61e26680 fix compiler segfault on null ?? x
closes #390
2017-06-14 19:32:52 -04:00
Andrew Kelley
7f0620a20f partial implementation of printing floating point numbers with errol3
also add bitCast builtin function. closes #387
2017-06-14 00:24:25 -04:00
Andrew Kelley
6a93dda3e1 progress toward windows hello world working 2017-06-14 00:04:34 -04:00
Andrew Kelley
199bbb6292 progress toward hello world without libc in windows 2017-06-04 10:08:55 -04:00
Andrew Kelley
e5b90651ba compileError builtin includes "referenced by" notes
to help track down the cause

closes #278
2017-06-03 15:09:40 -04:00
Andrew Kelley
e64f0971fc add appveyor integration testing 2017-06-03 12:47:23 -04:00
Andrew Kelley
1e301b03a9 change std.rand.Rand.rangeUnsigned to std.rand.Rand.range
and make it support signed integers
2017-05-31 18:23:56 -04:00
Andrew Kelley
1ae2002b41 fix crash when writing to const hardcoded ptr
closes #381
2017-05-29 14:25:00 -04:00
Andrew Kelley
8ae4ffa493 fix crash when unwrapping optional field of global variable
closes #379
2017-05-29 14:08:39 -04:00
Andrew Kelley
16f16b9c17 Merge pull request #380 from AndreaOrru/master
Generalize join for use outside std/os/path
2017-05-28 23:22:56 -04:00