AngouriMath

Navigation

← Back to list of members

FromBaseN​(System.​String,​System.​Int32)

 Method (no overloads)

Summary

Translates a number in base N into base 10

Parameter "num"

A Real in base N to be translated into base 10

Parameter "N"

The base to translate the number from

Returns

The Real in base 10

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-2022 · Project's repo · Site's repo · Octicons · Transparency · 1533 pages online