AngouriMath
ToBaseN(AngouriMath.Entity.Number.Real,System.Int32)
Method (no overloads)
Summary
Translates a Number in base 10 into base N
Parameter "num"
A Real in base 10 to be translated into base N
Parameter "N"
The base to translate the number into
Returns
A String with the number in the required base
Example
using System;
using static AngouriMath.MathS;
using var _ = Settings.DowncastingEnabled.Set(false);
Console.WriteLine(ToBaseN(1.5m, 2));
Console.WriteLine(ToBaseN(3.75m, 2));
Console.WriteLine(ToBaseN(13.125m, 2));
Console.WriteLine(ToBaseN(13.125m, 10));
// uncomment when https://github.com/asc-community/AngouriMath/issues/584
// is fixed
// Console.WriteLine(ToBaseN(13.125m, 5));
Console.WriteLine(ToBaseN(13.125m, 8));
Console.WriteLine("-----------------------");
Console.WriteLine(FromBaseN("FF", 16));
Console.WriteLine(FromBaseN("77", 8));
Console.WriteLine(FromBaseN("1.1", 2));
Console.WriteLine(FromBaseN("1.01", 2));
Console.WriteLine(FromBaseN("1.05", 6));
Prints
1.1
11.11
1101.001
13.125
15.1
-----------------------
255
63
1.500000000
1.250000000
1.138888888
Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1534 pages online