jalone jalone - 1 year ago 72
Objective-C Question

In Objective-C, fabsf() has the wrong result type

If in the Xcode's debug console I type

(lldb) p (float)fabsf(-5.0f)
(float) $22 = 0
(lldb) p (double)fabsf(-5.0f)
(double) $23 = 5

where the first result casting to float (without casting, the
command can't recognize the
return type) is wrong no matter the parameter.

But in the library headers the return type of
is clearly a float. Can somebody explain me this?

ios9.2: math.h

extern float fabsf(float);
extern double fabs(double);
extern long double fabsl(long double);

Is there some lldb mechanism or issue which I am not aware of, or really a language implementation issue (guess not...)?

Answer Source

It was pretty sure a bug of lldb console in Xcode 7, and a ticket was created for it.

The issue is not present any more in Xcode 8.0.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download