简体   繁体   English

Math.min在目标c

[英]Math.min in objective c

can any one tell me how can change this java code into objective c.is there any function for Math.min. 任何人都可以告诉我如何将这个java代码更改为Objective c.is有Math.min的任何函数。 i'm new to objective c 我是客观的新手

result = Math.min(Math.min((hra * 12), rent), 
    (0.4 * pay));

You can use MIN from NSObjCRuntime.h : 您可以使用NSObjCRuntime.h MIN

#ifndef MIN
#import <NSObjCRuntime.h>
#endif

result = MIN(MIN((hra * 12), rent), (0.4 * pay));

You can use math.h from C : 您可以使用C中的math.h:

#import <math.h>

// double fmin (double, double)
NSLog(@"res: %.f", fmin(5,10));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM