round(), handling numbers
round(), handling numbers
- Subject: round(), handling numbers
- From: Martin Kautz <email@hidden>
- Date: Tue, 08 Jan 2002 08:41:25 +0100
Hello list,
I'm trying to write an conversion app to deal with our new currrency called
euro and unfortunately I'm stuck on round()...
Could someone post a little snippet to show how rounding can be done with
Cocoa/ObjC.
So far I wrote this actions:
@implementation Euro
// Euro -> Deutschmark
- (IBAction)convDM:(id)sender
{
input=[view doubleValue];
output=(input*1.95583);
temp1=[NSNumber numberWithFloat:(input*1.95583)];
NSLog (@"DEBUG: %d",temp1);
[view setDoubleValue:output];
}
// Deutschmark to Euro
- (IBAction)convEUR:(id)sender
{
input=[view doubleValue];
output=(input/1.95583);
temp1=[NSNumber numberWithFloat:(input*1.95583)];
NSLog (@"DEBUG: %d",temp1);
[view setDoubleValue:output];
}
- (void)awakeFromNib
{
[view setStringValue:@"0"];
}
However, I want to round() the output of e. g. 12.234523311 to 12.23... The
function round() would give 12. :-(
Thanks,
Martin