The price calculation is often too precise in the purchase, earnings, account information; this leads to some transactions failing or making mistakes. This problem can be solved very well when using _N in the program. When the accuracy is controlled, the _N does not perform a quadruple entry. _N uses _N (variables to be processed, controlled decimal precision) Returns results after processing
JavaScript
function main() {
var sell_price=0.1234567;
Log("sell_price _N:",_N(sell_price,6));
var buy_price="0.1234567";
Log("buy_price _N:",_N(buy_price,6));
}
Code retested the results of the run:
Python
def main():
sell_price=0.1234567
Log("sell_price _N:",_N(sell_price,6))
buy_price="0.1234567"
Log("buy_price _N:",_N(float(buy_price),6))
Tip In python, the first parameter _N must be converted to float The code retested the results of the run:
FangBeiThe python version is running an error and needs to be modified as follows: 1. No spaces before the first line def 2. The fourth line is not blank, it has tabs.
yjt111 sell_price not shell_price