1598962140
The IEEE 754
specification defines many floating point types, including: binary16
, binary32
, binary64
and binary128
. Most developers are familiar with binary32
(equivalent to float
in C#) and binary64
(equivalent to double
in C#). They provide a standard format to represent a wide range of values with a precision acceptable for many applications. .NET has always had float
and double
and with .NET 5 Preview 7, we’ve added a new Half
type (equivalent to binary16
)!
A Half
is a binary floating-point number that occupies 16 bits. With half the number of bits as float, a Half
number can represent values in the range ±65504. More formally, the Half
type is defined as a base-2 16-bit interchange format meant to support the exchange of floating-point data between implementations. One of the primary use cases of the Half
type is to save on storage space where the computed result does not need to be stored with full precision. Many computation workloads already take advantage of the Half
type: machine learning, graphics cards, the latest processors, native SIMD libraries etc. With the new Half
type, we expect to unlock many applications in these workloads.
Half
type:The 16 bits in the Half
type are split into:
Despite that fact that the significand is made up of 10 bits, the total precision is really 11 bits. The format is assumed to have an implicit leading bit of value 1 (unless the exponent field is all zeros, in which case the leading bit has a value 0). To represent the number 1 in the Half
format, we’d use the bits:
0 01111 0000000000 = 1
The leading bit (our sign bit) is 0
, indicating a positive number. The exponent bits are 01111
, or 15
in decimal. However, the exponent bits don’t represent the exponent directly. Instead, an exponent bias is defined that lets the format represent both positive and negative exponents. For the Half
type, that exponent bias is 15
. The true exponent is derived by subtracting 15
from the stored exponent. Therefore, 01111
represents the exponent e = 01111 (in binary) - 15 (the exponent bias) = 0
. The significand is 0000000000
, which can be interpreted as the number .significand(in base 2)
in base 2, 0
in our case. If, for example, the significand was 0000011010 (26 in decimal)
, we can divide its decimal value 26
by the number of values representable in 10 bits (1 << 10)
: so the significand 0000011010 (in binary)
is 26 / (1 << 10) = 26 / 1024 = 0.025390625
in decimal. Finally, because our stored exponent bits (01111)
are not all 0
, we have an implicit leading bit of 1
. Therefore,
0 01111 0000000000 = 2^0 * (1 + 0/1024) = 1
In general, the 16 bits of a Half
value are interpreted as -1^(sign bit) * 2^(storedExponent - 15) * (implicitBit + (significand/1024))
. A special case exists for the stored exponent 00000
. In this case, the bits are interpreted as -1^(sign bit) * 2^(-14) * (0 + (significand/1024))
. Let’s look at the bit representations of some other numbers in the Half
format:
0 00000 0000000001 = -1^(0) * 2^(-14) * (0 + 1/1024) ≈ 0.000000059604645
(Note the implicit bit is 0 here because the stored exponents bits are all 0)
0 11110 1111111111 = -1^(0) * 2^(15) * (1 + 1023/1024) ≈ 65504
1 11111 0000000000 = -Infinity
A peculiarity of the format is that it defines both positive and negative 0:
1 00000 0000000000 = -0
0 00000 0000000000 = +0
A Half
can be converted to/from a float/double by simply casting it:
float f = (float)half; Half h = (Half)floatValue;
#.net #.net core #ai machine learning #c# #f# #machine learning #ml.net #announcement #bcl #numerics
1602560783
In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.
To demonstrate CRUD operations – insert, update, delete and retrieve, the project will be dealing with details of a normal bank transaction. GitHub repository for this demo project : https://bit.ly/33KTJAu.
Sub-topics discussed :
In Visual Studio 2019, Go to File > New > Project (Ctrl + Shift + N).
From new project window, Select Asp.Net Core Web Application_._
Once you provide the project name and location. Select Web Application(Model-View-Controller) and uncheck HTTPS Configuration. Above steps will create a brand new ASP.NET Core MVC project.
Let’s create a database for this application using Entity Framework Core. For that we’ve to install corresponding NuGet Packages. Right click on project from solution explorer, select Manage NuGet Packages_,_ From browse tab, install following 3 packages.
Now let’s define DB model class file – /Models/TransactionModel.cs.
public class TransactionModel
{
[Key]
public int TransactionId { get; set; }
[Column(TypeName ="nvarchar(12)")]
[DisplayName("Account Number")]
[Required(ErrorMessage ="This Field is required.")]
[MaxLength(12,ErrorMessage ="Maximum 12 characters only")]
public string AccountNumber { get; set; }
[Column(TypeName ="nvarchar(100)")]
[DisplayName("Beneficiary Name")]
[Required(ErrorMessage = "This Field is required.")]
public string BeneficiaryName { get; set; }
[Column(TypeName ="nvarchar(100)")]
[DisplayName("Bank Name")]
[Required(ErrorMessage = "This Field is required.")]
public string BankName { get; set; }
[Column(TypeName ="nvarchar(11)")]
[DisplayName("SWIFT Code")]
[Required(ErrorMessage = "This Field is required.")]
[MaxLength(11)]
public string SWIFTCode { get; set; }
[DisplayName("Amount")]
[Required(ErrorMessage = "This Field is required.")]
public int Amount { get; set; }
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
public DateTime Date { get; set; }
}
C#Copy
Here we’ve defined model properties for the transaction with proper validation. Now let’s define DbContextclass for EF Core.
#asp.net core article #asp.net core #add loading spinner in asp.net core #asp.net core crud without reloading #asp.net core jquery ajax form #asp.net core modal dialog #asp.net core mvc crud using jquery ajax #asp.net core mvc with jquery and ajax #asp.net core popup window #bootstrap modal popup in asp.net core mvc. bootstrap modal popup in asp.net core #delete and viewall in asp.net core #jquery ajax - insert #jquery ajax form post #modal popup dialog in asp.net core #no direct access action method #update #validation in modal popup
1591455526
ML.NET is a cross-platform, machine learning framework for .NET developers. Model Builder is the UI tooling in Visual Studio that uses Automated Machine Learning (AutoML) to train and consume custom ML.NET models in your .NET apps. You can use ML.NET and Model Builder to create custom machine learning models without having prior machine learning experience and without leaving the .NET ecosystem.
#.net #.net blog #visual studio #ml.net model builder #asp.net (.net) #progaming
1598962140
The IEEE 754
specification defines many floating point types, including: binary16
, binary32
, binary64
and binary128
. Most developers are familiar with binary32
(equivalent to float
in C#) and binary64
(equivalent to double
in C#). They provide a standard format to represent a wide range of values with a precision acceptable for many applications. .NET has always had float
and double
and with .NET 5 Preview 7, we’ve added a new Half
type (equivalent to binary16
)!
A Half
is a binary floating-point number that occupies 16 bits. With half the number of bits as float, a Half
number can represent values in the range ±65504. More formally, the Half
type is defined as a base-2 16-bit interchange format meant to support the exchange of floating-point data between implementations. One of the primary use cases of the Half
type is to save on storage space where the computed result does not need to be stored with full precision. Many computation workloads already take advantage of the Half
type: machine learning, graphics cards, the latest processors, native SIMD libraries etc. With the new Half
type, we expect to unlock many applications in these workloads.
Half
type:The 16 bits in the Half
type are split into:
Despite that fact that the significand is made up of 10 bits, the total precision is really 11 bits. The format is assumed to have an implicit leading bit of value 1 (unless the exponent field is all zeros, in which case the leading bit has a value 0). To represent the number 1 in the Half
format, we’d use the bits:
0 01111 0000000000 = 1
The leading bit (our sign bit) is 0
, indicating a positive number. The exponent bits are 01111
, or 15
in decimal. However, the exponent bits don’t represent the exponent directly. Instead, an exponent bias is defined that lets the format represent both positive and negative exponents. For the Half
type, that exponent bias is 15
. The true exponent is derived by subtracting 15
from the stored exponent. Therefore, 01111
represents the exponent e = 01111 (in binary) - 15 (the exponent bias) = 0
. The significand is 0000000000
, which can be interpreted as the number .significand(in base 2)
in base 2, 0
in our case. If, for example, the significand was 0000011010 (26 in decimal)
, we can divide its decimal value 26
by the number of values representable in 10 bits (1 << 10)
: so the significand 0000011010 (in binary)
is 26 / (1 << 10) = 26 / 1024 = 0.025390625
in decimal. Finally, because our stored exponent bits (01111)
are not all 0
, we have an implicit leading bit of 1
. Therefore,
0 01111 0000000000 = 2^0 * (1 + 0/1024) = 1
In general, the 16 bits of a Half
value are interpreted as -1^(sign bit) * 2^(storedExponent - 15) * (implicitBit + (significand/1024))
. A special case exists for the stored exponent 00000
. In this case, the bits are interpreted as -1^(sign bit) * 2^(-14) * (0 + (significand/1024))
. Let’s look at the bit representations of some other numbers in the Half
format:
0 00000 0000000001 = -1^(0) * 2^(-14) * (0 + 1/1024) ≈ 0.000000059604645
(Note the implicit bit is 0 here because the stored exponents bits are all 0)
0 11110 1111111111 = -1^(0) * 2^(15) * (1 + 1023/1024) ≈ 65504
1 11111 0000000000 = -Infinity
A peculiarity of the format is that it defines both positive and negative 0:
1 00000 0000000000 = -0
0 00000 0000000000 = +0
A Half
can be converted to/from a float/double by simply casting it:
float f = (float)half; Half h = (Half)floatValue;
#.net #.net core #ai machine learning #c# #f# #machine learning #ml.net #announcement #bcl #numerics
1618666860
This year’s .NET Conf was the largest one yet, with over 80 live sessions across three days that were co-organized and presented by the .NET community and Microsoft. On top of all of that, it also marked the release of .NET 5.0 that brings a full set of new capabilities, performance gains, and new languages features for developers to create amazing apps. If you missed this year’s .NET Conf live stream, don’t worry because we have you covered!
#.net #.net core #asp.net #c# #.net conf #.net foundation #community #demos
1592389602
.NET 5 is the next version and future of .NET. We are continuing the journey of unifying the .NET platform, with a single framework that extends from cloud to desktop to mobile and beyond. Looking back, we took the best of .NET Framework and put that into .NET Core 3,
#.net #.net 5 preview 4 #preview #.net blog #programming