Dot-Net

你會如何在評論中描述數學?

  • March 13, 2020

正如問題所說…

數學符號形式的方程式可能比程式碼形式更有意義。能夠將數學放在評論中可以提高我項目的可讀性。

在.NET 中。

我只是使用多行來做到這一點:

// Work out average as:  sum (values)
//                      --------------
//                      count (values)
//
// and distance between points as:
//           _______________________
//          /         2            2
//    d = \/ (x1 - x0)  + (y1 - y0)
//
// and the following function:
//
//             3     2   
//    f(x) = ax  + bx  + cx + d

根本不需要魔法。你不只是喜歡 ASCII 藝術嗎?

跟進@pax’s answer to use ascii-art/plain text to render your equations (+1 by the way, pax):

以下是與數學相關的字元的快捷鍵列表:

°(度)- Alt+0176

±(加/減)- Alt + 0177

²(平方)- Alt+0178

³(立方)- Alt + 0179

¼ (1/4) - Alt + 0188

½ (1/2) - Alt + 0189

¾ (3/4) - Alt + 0190

引用自:https://stackoverflow.com/questions/819300