Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asinh() acosh() atanh() provide wrong value in case angleMeasurementMode is set to degree. #49

Closed
KamranKhan-DL opened this issue Sep 20, 2013 · 1 comment

Comments

@KamranKhan-DL
Copy link

For anyone facing the same issue, following is the solution.

+ (DDMathFunction) asinhFunction {
    DDMathFunction function = ^ DDExpression* (NSArray *arguments, NSDictionary *variables, DDMathEvaluator *evaluator, NSError **error) {
        REQUIRE_N_ARGS(1);
        DDExpression *argument = [arguments objectAtIndex:0];
        argument = _DDDTOR(argument, evaluator, error);
        NSNumber *n = [[arguments objectAtIndex:0] evaluateWithSubstitutions:variables evaluator:evaluator error:error];
        RETURN_IF_NIL(n);

        NSNumber *result = [NSNumber numberWithDouble:asinh([n doubleValue])];
        return [DDExpression numberExpressionWithNumber:result];
    };
    return DD_AUTORELEASE([function copy]);
}

+ (DDMathFunction) acoshFunction {
    DDMathFunction function = ^ DDExpression* (NSArray *arguments, NSDictionary *variables, DDMathEvaluator *evaluator, NSError **error) {
        REQUIRE_N_ARGS(1);
        DDExpression *argument = [arguments objectAtIndex:0];
        argument = _DDDTOR(argument, evaluator, error);
        NSNumber *n = [[arguments objectAtIndex:0] evaluateWithSubstitutions:variables evaluator:evaluator error:error];
        RETURN_IF_NIL(n);

        NSNumber *result = [NSNumber numberWithDouble:acosh([n doubleValue])];
        return [DDExpression numberExpressionWithNumber:result];
    };
    return DD_AUTORELEASE([function copy]);
}

+ (DDMathFunction) atanhFunction {
    DDMathFunction function = ^ DDExpression* (NSArray *arguments, NSDictionary *variables, DDMathEvaluator *evaluator, NSError **error) {
        REQUIRE_N_ARGS(1);
        DDExpression *argument = [arguments objectAtIndex:0];
        argument = _DDDTOR(argument, evaluator, error);
        NSNumber *n = [[arguments objectAtIndex:0] evaluateWithSubstitutions:variables evaluator:evaluator error:error];
        RETURN_IF_NIL(n);

        NSNumber *result = [NSNumber numberWithDouble:atanh([n doubleValue])];
        return [DDExpression numberExpressionWithNumber:result];
    };
    return DD_AUTORELEASE([function copy]);
}
davedelong added a commit that referenced this issue Sep 12, 2015
@davedelong
Copy link
Owner

This is fixed on the 2.0 branch, which will be merged in to master soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants