Commit Graph

15 Commits (53766e7a3a5c7141a64e21c30540f9ed571cdfdd)

Author SHA1 Message Date
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 0c16cd2d0e run zig fmt on the codebase
See #1003
2018-05-29 04:23:38 -04:00
Andrew Kelley 4787127cf6 partial conversion to post-fix pointer deref using zig fmt 2018-05-10 00:29:49 -04:00
Marc Tiehuis 53588f4f12 Add missing pub specifier to atan2 2018-03-22 19:18:51 +13:00
Andrew Kelley 3671582c15 syntax: functions require return type. remove `->`
The purpose of this is:

 * Only one way to do things
 * Changing a function with void return type to return a possible
   error becomes a 1 character change, subtly encouraging
   people to use errors.

See #632

Here are some imperfect sed commands for performing this update:

remove arrow:

```
sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig")
```

add void:

```
sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig")
```

Some cleanup may be necessary, but this should do the bulk of the work.
2018-01-25 04:10:11 -05:00
Andrew Kelley 4183c6f1a5 move std/debug.zig to a subdirectory
self hosted compiler parser tests do some fuzz testing
2017-12-23 22:15:48 -05:00
Andrew Kelley e44a11341d std.math: remove unnecessary inline calls and
workaround windows 32 bit test failure
See #537
2017-12-22 13:14:07 -05:00
Andrew Kelley d917815d81 explicitly return from blocks
instead of last statement being expression value

closes #629
2017-12-22 00:50:30 -05:00
Andrew Kelley 14cda27b64 depend on embedded SoftFloat-3d instead of __float128
See #302
See #467
2017-09-14 01:46:47 -04:00
Andrew Kelley b8ed0cb374 remove workaround for LLVM not respecting "nobuiltin"
now that we depend on LLVM 5.0.0 we can remove the
workaround.

closes #393
2017-08-28 04:28:42 -04:00
Andrew Kelley be16034275 std.math: remove constants that can be derived
from others at compile time
2017-08-20 05:43:40 -04:00
Andrew Kelley 09bd4a9a86 compile-time f32, f64 operations are now correctly lossy
previously we used the bigfloat abstraction to do all
compile-time float math. but runtime code and comptime code
are supposed to get the same result. so now if you add a
f32 to a f32 at compile time it does it with f32 math
instead of the bigfloat. float literals still get the
bigfloat math.

closes #424
2017-08-20 01:04:51 -04: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 c9fc8bd802 workaround for llvm bug
See #393 for details
2017-06-19 14:36:33 -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