|
|
| version 1.114, 2026/10/16 13:55:16 | version 1.115, 2026/11/02 00:45:58 |
|---|---|
| Line 122 static void _eq(Request& r, MethodParams | Line 122 static void _eq(Request& r, MethodParams |
| r.write(VBool::get(ulp_eq_double(a, b, max_ulp))); | r.write(VBool::get(ulp_eq_double(a, b, max_ulp))); |
| } | } |
| static void _min(Request& r, MethodParams& params) { | |
| double result=params.as_double(0, "parameter must be expression", r); | |
| for(size_t i=1; i<params.count(); i++) { | |
| double value=params.as_double(i, "parameter must be expression", r); | |
| if(value<result) | |
| result=value; | |
| } | |
| r.write(*new VDouble(result)); | |
| } | |
| static void _max(Request& r, MethodParams& params) { | |
| double result=params.as_double(0, "parameter must be expression", r); | |
| for(size_t i=1; i<params.count(); i++) { | |
| double value=params.as_double(i, "parameter must be expression", r); | |
| if(value>result) | |
| result=value; | |
| } | |
| r.write(*new VDouble(result)); | |
| } | |
| inline bool is_salt_body_char(unsigned char c) { | inline bool is_salt_body_char(unsigned char c) { |
| return pa_isalnum(c) || c == '.' || c=='/'; | return pa_isalnum(c) || c == '.' || c=='/'; |
| } | } |
| Line 643 MMath::MMath(): Methoded("math") { | Line 663 MMath::MMath(): Methoded("math") { |
| // ^math:eq(a;b[;precision]) | // ^math:eq(a;b[;precision]) |
| add_native_method("eq", Method::CT_STATIC, _eq, 2, 3); | add_native_method("eq", Method::CT_STATIC, _eq, 2, 3); |
| // ^math:min(a;b[;c...]) | |
| add_native_method("min", Method::CT_STATIC, _min, 2, 10000); | |
| // ^math:max(a;b[;c...]) | |
| add_native_method("max", Method::CT_STATIC, _max, 2, 10000); | |
| // ^math:crypt[password;salt] | // ^math:crypt[password;salt] |
| ADDN(crypt, 2); | ADDN(crypt, 2); |