Commit Graph

102 Commits

Author SHA1 Message Date
Jimmi Holst Christensen
8139c5a516
New Zig formal grammar (#1685)
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00
emekoi
c7799ff2b2 fixed comments 2018-10-27 12:58:40 -05:00
Andrew Kelley
2b395d4ede
remove @minValue,@maxValue; add std.math.minInt,maxInt
closes #1466
closes #1476
2018-10-26 15:01:51 -04:00
Andrew Kelley
d5648d2640
remove implicit cast from T to *const T
closes #1465
2018-10-15 18:23:47 -04:00
Jimmi Holst Christensen
378d3e4403
Solve the return type ambiguity (#1628)
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00
emekoi
a22d9daaec added math.pow support for integer types. resolves #1637 (#1642)
added math.powi for integers; pow now handles ints
2018-10-10 10:50:23 -04:00
Andrew Kelley
d40c4e7c89
Merge pull request #1429 from shawnl/arm64
initial arm64 support
2018-10-06 00:11:39 -04:00
Andrew Kelley
275b4100c0
remove unnecessary setFloatMode calls
Now that Strict is the default, these calls only add noise.
2018-09-18 15:15:03 -04:00
Andrew Kelley
a2abdb185f
Merge remote-tracking branch 'origin/master' into llvm7 2018-09-16 10:51:58 -04:00
Andrew Kelley
c06a61e9bf
remove this. add @This().
closes #1283
2018-09-13 16:34:33 -04:00
Marc Tiehuis
e70c543bc4 math/complex: cexp test correction and ldexp usage fix 2018-09-13 20:33:05 +12:00
Shawn Landden
f8808edff4 simplify f64_min to equivilent value
arm64 complains about the old value (I added a test)
2018-09-08 03:52:28 +00:00
Andrew Kelley
7109035b78 Merge remote-tracking branch 'origin/master' into llvm7 2018-08-25 21:57:28 -04:00
Marc Tiehuis
353419f82d Default to strict IEEE floating point
Closes #1227.
2018-08-23 22:54:46 +12:00
Andrew Kelley
dd9728c5a0 Merge remote-tracking branch 'origin/master' into llvm7 2018-07-24 00:43:12 -04:00
Andrew Kelley
5a919dd82d Merge remote-tracking branch 'origin/master' into self-hosted-libc-hello-world 2018-07-23 14:32:13 -04:00
Andrew Kelley
99153ac0aa add std.math.big.Int.fitsInTwosComp
so that we can pass runtime-known values
2018-07-22 10:58:45 -04:00
Marc Tiehuis
d53fae3551 Add big int fits function (#1279)
Returns whether the current value in an Int fits in the requested type.
2018-07-22 10:11:27 -04:00
Marc Tiehuis
07b6a3d335 Tighten Int.to bounds and add twos-complement bitcount 2018-07-22 17:47:57 +12:00
Andrew Kelley
f5a67dba08 self-hosted: implicit cast comptime ints to other ints
we now have successful exit codes from main linking
against libc
2018-07-20 01:46:49 -04:00
Andrew Kelley
1d85b588ea self-hosted: progress on IR for supporting libc hello world
* add c int types
 * some more ir stubs
2018-07-19 00:08:47 -04:00
Andrew Kelley
558b0b8791 Merge remote-tracking branch 'origin/master' into llvm7 2018-07-16 13:37:16 -04:00
Andrew Kelley
e9a03cccf3 all integer sizes are available as primitives
* fix wrong implicit cast for `@IntType` bit_count parameter.
 * fix incorrect docs for `@IntType` bit_count parameter.

closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley
6e1425e312 Merge remote-tracking branch 'origin/master' into llvm7 2018-07-02 20:00:13 -04:00
Ben Noordhuis
30cfc0ab2c test std.math f16 sqrt support
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
be36179064 add std.math f16 signbit support
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
ca444e6191 add std.math f16 copysign support
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
d293f1a0ed add std.math f16 floor support
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
1abc925292 add std.math f16 fabs support
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
f36b095b5f add std.math f16 isnormal support
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
30b75ae353 add std.math f16 isfinite support
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
a36d7b6131 add std.math f16 inf support
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
27b02413dc add std.math f16 nan support
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
61df5bc142 add std.math f16 constants
refs #1122
2018-06-30 01:58:17 +02:00
Marc Tiehuis
f50c0c664f Add float repr bit extraction functions 2018-06-21 01:45:12 -04:00
Andrew Kelley
c7804277bf @floatToInt now has safety-checked undefined behavior
when the integer part does not fit in the destination integer type

 * Also fix incorrect safety triggered for integer casting an
   `i32` to a `u7`. closes #1138
 * adds compiler-rt function: `__floatuntidf`
2018-06-19 16:06:10 -04:00
Andrew Kelley
c757984879 Merge remote-tracking branch 'origin/master' into llvm7 2018-06-18 14:51:23 -04:00
Andrew Kelley
4210f1f6a0 remove bool to int syntax. add @boolToInt
add missing docs

See #1061
2018-06-18 03:07:16 -04:00
Andrew Kelley
7912061226 remove integer and float casting syntax
* add `@intCast`
 * add `@floatCast`
 * add `@floatToInt`
 * add `@intToFloat`

See #1061
2018-06-17 02:57:07 -04:00
Andrew Kelley
06a26f0965 std.Complex: use better arg passing convention and fix a TODO 2018-06-16 21:32:53 -04:00
Andrew Kelley
e311cd562b don't automatically take pointer when passing by non-copying value
this commit does not have all tests passing
2018-06-16 19:37:00 -04:00
Andrew Kelley
65d04cbeb4 std.DynLib: open the fd with CLOEXEC 2018-06-16 17:27:45 -04:00
Andrew Kelley
48de57d824 add basic std lib code for loading dynamic libraries
this is going to only work for very basic libraries;
I plan to slowly add more features over time to support more
complicated libraries
2018-06-16 17:01:23 -04:00
Andrew Kelley
32dd98b19f Merge remote-tracking branch 'origin/master' into llvm7 2018-06-14 18:27:59 -04:00
Marc Tiehuis
dc8bda7e02 Add arbitrary-precision integer to std
A few notes on the implementation:

 - Any unsigned power of two integer type less than 64 bits in size is supported
 as a Limb type.
 - The algorithms used are kept simple for the moment. More complicated
 algorithms are generally only more useful as integer sizes increase a
 lot and I don't expect our current usage to be used for this purpose
 just yet.
 - All branches (practically) have been covered by tests.

See 986a2b3243/bench
for rough performance comparison numbers.

Closes #364.
2018-06-10 18:24:34 +12:00
Marc Tiehuis
212449bc23 Fix Log2Int type construction
The following case for example, would previously fail:

    const a = u24(1) << Log2Int(u24)(22);
2018-06-06 22:41:55 +12:00
Andrew Kelley
7dd18294b7 Merge remote-tracking branch 'origin/master' into llvm7 2018-06-05 10:29:54 -04:00
Jimmi HC
02cb220faf Renamed "(int/float literal)" to "comptime_int/float" 2018-06-05 11:14:43 +02:00
Andrew Kelley
58ce79f935 Merge remote-tracking branch 'origin/master' into llvm7 2018-06-04 02:58:55 -04:00
Andrew Kelley
fcbb7426fa use * for pointer type instead of &
See #770

To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.

This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00