Skip to content

Instantly share code, notes, and snippets.

@felixmon
Created October 20, 2020 07:38
Show Gist options
  • Save felixmon/533c91089448aef705d377dc23cdaf4c to your computer and use it in GitHub Desktop.
Save felixmon/533c91089448aef705d377dc23cdaf4c to your computer and use it in GitHub Desktop.
Comparison of two numbers

比较两个数字的大小,包含正负数的情形

A, B

A, B 为实数A

A 比 B 大了多少(百分比):

[(A/B)-1]/[B/ABS(B)]

第一步:A 除以 B,减去 1, 得出百分比
第二部,被比较数字 B 除以其本身的绝对值:ABS(B)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment