Questions tagged [math]

For math questions in general that do not fall into special categories such as `floating-point` , `fixed-point`, or `safe-math` as previously used, all of which are also valid subsets of this category hence this tag can also be used to earmark such questions.

Filter by
Sorted by
Tagged with
11 votes
2 answers

What's the best way to compute square root in Substrate?

I'm working on a quadratic voting function, and I'm trying to use a function like square root. There is no square root function in sp that I could find. What is the best way to do this?
Jake Hemmerle's user avatar
3 votes
1 answer

Division operation in `u128` results false value

In my node, Balance type is u128. I have following variable let per_block = 100_000_000_000_000_000_u128; let total = 50_000_000_000_000_000_000_000_u128; let ratio = per_block.checked_div(total); ...
Sudip Ghimire's user avatar
0 votes
1 answer

How do I best calculate angle differences when crossing the 360 axis? (Python) [closed]

I am trying to calculate the total number of turns of a vehicle over time to be a feature in the prediction of accident likelihood. Unfortunately, I am having issues solving the problem of crossing ...
user2506's user avatar