Skip to content

FractalPaul/IntFloatMultiplyError_CSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

IntFloatMultiplyError

C# Int multiplied by float error in calculation...

This program multiplies an integer by a float (of a integer) to see if there is an error in the calculation. In C# there is an error with certain values. This occurs when mulitplying some integer values times another integer value that are only odd for each.

Such as: 3357(int) * 4999(float) = 16,781,644 instead of 16,781,643.

There are numerous other values that are produced. Interestingly there are only odd numbers for both that produce the calculation error.

Linux:

$ dotnet build
$ dotnet run

On Linux there is quite a list of values that create discrepancies.

Two number calculations..

To perform the combination of multiplications on just two numbers provide the two numbers as arguments:

$ dotnet run 3055 6111

Range calculations...

To perform the range calculation just put a Max Value as a single argument.

$ dotnet run 7000

This will calculate the combinations of multiplications for both numbers ranging from 1 to Max Value

Odd Ball Calculations...

To perform the Odd ball calculation execute without any parameters.

$ dotnet run

The Odd Ball calculation is a predetermined set of numbers that cause an error. These are set to compare to other platforms and languages such as C or Rust. Odd ball calulations... Notice that the 4th and 5th columns do not match. IntFloat Odd Ball C#

The following shows the calculated values on Windows 10: Int Float Multiply Error

A very short list of the numbers with the error calculations is below: Int Float Multiply Error List

A very short list of the numbers with the error calculations: Int Float Multiply Error short List

About

C# Int multiplied by float error in calculation...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages