Am 23.09.2014 um 07:53 schrieb Torsten Bronger: > Hallöchen! > > johannes hanika writes: > >> if lf returns this magic error value sometimes, maybe it's just a >> matter of fixing the branch that results in this special >> treatment? i think it should be lf's responsibility not to >> randomly return inf/nan/special value. creating nan from sqrt(-1) >> situations sounds like badly written code and results in >> frustrating error handling workarounds in all client code.. > > I don't see an actual difference between returning 1.6e16, inf, or > nan. The caller has to special-handle it in either case. >
No, the caller should not have to handle these cases. Usually all operations that lead to NaN/inf/... are mathematically well defined but cannot be translated into a float value. So we have to check in lensfun what the correct result would be and act accordingly. In particular it is even a better idea to check input values and not to clamp output values whenever possible. This means that a NaN/inf should be handled right before it occurs so the rest of the processing even inside lensfun can proceed correctly. Example: Some operations lead to a varA = NaN which actually is meant to be varA = MAX_FLT and fixed accordingly. If later on we calculate something like varB = 1/varA we can get a valid output of the function. However 1/NaN = NaN can never be recovered or interpreted correctly. Can anyone summarize in which lensfun functions the invalid NaN/inf values occur? Then I will have a look at this... Sebastian ------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk _______________________________________________ darktable-devel mailing list darktable-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/darktable-devel