Make more of the builtins do promotion from int to double for convenience.

This commit is contained in:
Christoffer Lerno
2023-01-13 00:46:00 +01:00
committed by Christoffer Lerno
parent 50b0958fb6
commit 2123e81e8e
5 changed files with 83 additions and 33 deletions

View File

@@ -13,7 +13,7 @@ fn void main()
fn VarString bin(int x)
{
int bits = 1 + (int)(x == 0 ? 0 : math::log10((double)(x)) / math::log10(2));
int bits = x == 0 ? 1 : 1 + (int)math::log2(x);
VarString str;
str.append_repeat('0', bits);
for (int i = 0; i < bits; i++)