Questions tagged [int256]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
2answers
116 views

What is the fastest way to check the sign of an int256 in Solidity?

Given an int256 number n, I want to get the sign of n: If n is positive, get 1 If n is negative, get -1 If n is 0, get 0 I know that I can do: function foo(int256 x) external { if (x > 0) { ...