Float tolerance
sh
rust-anything record <crate> --float-tolerance 1e-9
rust-anything app record . --float-tolerance 1e-9 -- python3 cli.py
Numeric code (physics, statistics, graphics) port பண்ணினதுக்கு அப்புறம் அரிதா தான் bit-identical floats கொடுக்கும்: operation order, fused multiply-add மற்றும் math library ஆகியவை compilers-க்கு இடையே வேறுபடும். அதை நீங்க ஏத்துக்கும்போது, --float-tolerance மற்றும் உங்க number கூட record பண்ணுங்க. அப்போ floats பெரிய மதிப்போட அந்தப் பங்குக்குள்ள (1-க்குக் கீழே absolute) match ஆகும், மேலும் diff மற்றும் gate அதைப் பயன்படுத்தும். 0 அதை நீக்கிடும்.
இன்னும் துல்லியமா match ஆக வேண்டியவை:
- integers, text மற்றும் structure;
- வேற மாதிரி எழுதப்பட்ட அதே மதிப்பு (
3மற்றும்3.0); - formatting. Number-ல இருந்து text-ஆக்கும் formatting மொழிகளுக்கு இடையே வேறுபடும் (
1e21,-0, digit counts); traps அந்த மதிப்புகளை உள்ளடக்கும், மற்றும்--float-tolerancerounding-ஐ மட்டும் தான் மன்னிக்கும், ஒருபோதும் formatting-ஐ இல்ல.
ஒரு mismatch மறையணும்ங்கிறதுக்காக tolerance-ஐ எப்பவுமே அதிகப்படுத்தாதீங்க: அதுக்கு மேல உள்ள வித்தியாசம் port-ல இருக்குற ஒரு bug.