Maths and programming languages
Rick Murray (539) 13806 posts |
It seems that most common programming languages have settled down to using a handful of operators – equals, exactly equals 1, not equals, less than, or greater than. Wouldn’t it be fun if we had things like “≆”, which means “approximately but not actually equal to”? 1 In languages where it compares both value and type; or other languages where zero and null aren’t considered the same. |
Clive Semmens (2335) 3276 posts |
Yes. |
GavinWraith (26) 1563 posts |
In Haskell you can define your own operators. |
Grahame Parish (436) 480 posts |
The bulk of my work involves databases, specifically in the telecoms industry where every call is logged with a start and end time. It would be so useful to have a approximation comparison on date/time data, because I often have to match up calls from two different datasources where the clocks may be very slightly different or the two ends of the system see the start or end at very slightly different times. Something like Rick’s idea above, but maybe with a scoping or limiting factor would be very useful – are all the parameters (called number, caller number, trunk id, etc.) of this record identical with the date/time field within 50ms? |
Chris Evans (457) 1614 posts |
The problem I see is +/- 1% might not be a wide enough range in some situations but nowhere near slim enough in others. Having an accuracy parameter as part of the test command should cover that problem. |
Stuart Swales (8827) 1349 posts |
Or +/1 1hr +/1 a wee bit for when you have to deal with file servers that don’t play ball with your time zone. |
Clive Semmens (2335) 3276 posts |
You might want the accuracy parameter to vary from context to context – at which point |
Jean-Michel BRUCK (3009) 351 posts |
ABS(x - y) < eis very often used in mathematics for limit studies, which can be useful with the problem of approximate time matches. Boolean logic has a sister: fuzzy logic. |
Clive Semmens (2335) 3276 posts |
|