big: Add tests for log.

This commit is contained in:
Jeroen van Rijn
2021-08-11 20:59:52 +02:00
parent 922df6a438
commit 385b9c9922
4 changed files with 123 additions and 79 deletions
+2 -2
View File
@@ -14,8 +14,8 @@ int_log :: proc(a: ^Int, base: DIGIT) -> (res: int, err: Error) {
return -1, .Invalid_Argument;
}
if err = clear_if_uninitialized(a); err != .None { return -1, err; }
if n, _ := is_neg(a); n { return -1, .Invalid_Argument; }
if z, _ := is_zero(a); z { return -1, .Invalid_Argument; }
if n, _ := is_neg(a); n { return -1, .Math_Domain_Error; }
if z, _ := is_zero(a); z { return -1, .Math_Domain_Error; }
/*
Fast path for bases that are a power of two.