| ... | @@ -12,6 +12,14 @@ pub const ParseFloatError = error{ | ... | @@ -12,6 +12,14 @@ pub const ParseFloatError = error{ |
| 12 | }; | 12 | }; |
| 13 | | 13 | |
| 14 | pub fn parseFloat(comptime T: type, s: []const u8) ParseFloatError!T { | 14 | pub fn parseFloat(comptime T: type, s: []const u8) ParseFloatError!T { |
| | 15 | if (@typeInfo(T) != .Float) { |
| | 16 | @compileError("Cannot parse a float into a non-floating point type."); |
| | 17 | } |
| | 18 | |
| | 19 | if (T == f80) { |
| | 20 | @compileError("TODO support parsing float to f80"); |
| | 21 | } |
| | 22 | |
| 15 | if (s.len == 0) { | 23 | if (s.len == 0) { |
| 16 | return error.InvalidCharacter; | 24 | return error.InvalidCharacter; |
| 17 | } | 25 | } |