razenpok / breakinfinity.cs Goto Github PK
View Code? Open in Web Editor NEWDouble replacement for numbers that go over 1e308
License: MIT License
Double replacement for numbers that go over 1e308
License: MIT License
It's not a big deal but it's contrary to the readme.
What is the license of this?
The only format which is acceptable now is 1e308
The formats that are throwing exceptions:
1E308
1E+308
1e+308
e308
e+308
Related issue: Patashu/break_infinity.js#36
There is a crash happened in Indonesia(Language) on Android when I called BigDouble.ToString() , I guess it caused by the defferent expression between Indonesia and others . By the way I found the 'formatprovider' is unused in BigNumber.FormatBigDouble(BigDouble value, string format, IFormatProvider formatProvider).
I am implementing a cap on a value using BigInteger.Min
, using PositiveInfinity
to essentially mean "no cap". However, I found that when the value reached 10 (which changed the exponent), Min
would return that Infinity
was the smaller value!
Min
defers to the >
operator, and the exponent for infinity is actually 0, where the line which perform the comparison is this:
if (a.Mantissa > 0) return b.Mantissa < 0 || a.Exponent > b.Exponent;
where a
= 10 and b
= Infinity.
Since the mantissa of a is 1 and larger than 0, the comparison is b.Mantissa < 0 (false) || a.Exponent (1) > b.Exponent (0)
or false || true
, thus, Infinity is smaller than 10.
Not really a big issue just more of an FYI since the readme only talks about the max of 1e(9e15) despite it going higher.
The MAX_SAFE_INTEGER for JavaScript is 9,007,199,254,740,991, but in C#, it uses a long, 9,223,372,036,854,775,807 which just has 3 more digits.
This means the max is around 9.99e9,223,372,036,854,775,806 (1 exponent below from infinity) or more simply, 1e(9e18)
While trying out this package I noticed that the exponents don't seem to be working as expected. Typing '1000' into the left field in the Unity Inspector yields a value of 1e6, and typing '1000000' (1 million) yields a value of 1e21. I would imagine the expected values should be 1e3 and 1e6, respectively.
I don't think you need to do anything else, since it should serialize fine by default
I'm trying to use a bigdouble number in a progress bar but it might not be possible? I wanted to do something like this:
BigDouble num1 = 1000;
BigDouble num2 = 100;
BigDouble num3 = (num2 / num1) * 100;
int num4 = Convert.ToInt32(num3);
hp1.Value = num4;
hp1.Maximum = 100;
Is this even possible? I tried converting it to a string and then back, but the number gets too large.
Hello
And I wanted to start adding numbers popped up error NotImplementedException: the method or operation is not implemented.
BreakInfinity.BigDouble.op_Explicit (BreakInfinity.BigDouble v)
and it doesn't add or display anything anywhere.
Here when I click on the error
public static explicit operator float(BigDouble v)
{
throw new NotImplementedException();
}
based on a conversation with Wild Obunga in #modification on AD server. since a primary reason to make this library is for use in Unity games, this seems pretty important to do.
Patashu/break_infinity.js@0ba078b#diff-6a117233d5fa57db6c21ce175ef40e1c
Number goes to Infinity after stage 5144. What am I doing wrong?
public static BigDouble CalcEnemyHealth(int stage)
{
BigDouble x = BigDouble.Pow(1.35, Mathf.Min(stage - 1, 65));
BigDouble y = BigDouble.Pow(1.15, Mathf.Max(stage - 65, 0));
Debug.Log(y.ToString("E3"));
return BigDouble.Multiply(15, BigDouble.Multiply(x, y));
}
Stage 5143 will display 1.674E+308
here but stage 5144 will display NaNE+0
. The returned value will show Infinity at stage 5144.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.