### Calculator Alpha for iPad released on the App Store

Posted by Ladislav Klinc in iPad on October 11, 2010

Apple just released Calculator Alpha for iPad on the App Store. It is a calculator/converter for the iPad and it is free of charge.

http://itunes.apple.com/us/app/calcualtor-alpha/id396151092?mt=8

Try it out and let me know what you think of it…

Some of the features are:

- works in portrait and landscape mode
- memory functions (add, subtract, recall, delete)
- elementary functions (x2, xy, sin, cos, log and others)
- flow display – shows last 3 calculations
- saves state, so the next time it is opened you are back where you finished

### iPad Calculator Alpha and KD Jezica website

Posted by Ladislav Klinc in Internet on October 7, 2010

Hey, it has been a while since I last posted something here on this blog. I have been busy with building my calculator/converter for iPad called Calculator Alpha. I uploaded it to Apple for review, so probably it will be up there on the App Store in couple of days (or maybe a week). It is going to be free and I think it will be competitive with other calculators out there for the iPad.

I was also busy building a website for my basketball team here in Slovenia. It is now live at http://www.kdjezica.com. It is build on WordPress blogging platform (like this one here, but is hosted on it’s own server). Hopefully we will keep it up to date so everyone will be able to follow what is going on with our basketball team.

On kdjezica.com we will represent all the teams that are part of KD Ježica, from the men’s team that plays in the second Slovenian league (which I am part of) to the youngest members of our club.

### Social Calc just released on the App Store

Posted by Ladislav Klinc in iPhone on September 24, 2010

My first app that I submitted to the App Store was just approved. It can be found on: Social Calc

Social Calc calculates how two names get along for love, friendship, business, kids and partying.

Algorithm to calculate percentage is what we used when we were kids in elementary school, it was fun then and I guess it is still fun now (after 20 years).

Application consistis of 5 calculators:

- Love Calculator
- Friendship Calculator
- Business Partner Calculator
- Kids Calculator
- Party Calculator

### OnTime5D plugin tested on newly released Sketchup 8

Posted by Ladislav Klinc in ontime scheduling program, ontime5d, SketchUp Ruby API on September 16, 2010

I just tested the OnTime5D plugin on the newly released Sketchup 8, and it works without a problem. Sketchup 8 was recetly released by Google and can be found on http://sketchup.google.com/.

### % (modulo) operator only works on int and long data types in Objective C 2.0

Posted by Ladislav Klinc in Objective C 2.0 on August 30, 2010

Today, I tried to use a modulo % operator in a function in Objective C 2.0 like so: (Modulo operator finds the remainder of division of one number by another)

-(double) someFunction: (double) value { ... if (value % 90 == 0) return 0; ... }

When I compiled my code, XCode generated and error saying that % function cannot be used for double values. I googled my way on to this stackoverflow question (isn’t it amazing that for almost every problem you have, stackoverflow.com has an answer to your question…), where one of the ways of getting remainder of division where one or both numbers are double is to use c function fmod(). So I rewrote my function and XCode compiled without a problem…

-(double) someFunction: (double) value { ... if (fmod(value,90) == 0) return 0; ... }

### Implementing factorial numbers in Objective C 2.0

Posted by Ladislav Klinc in Objective C 2.0 on August 26, 2010

I was implementing a function that would calculate factorial number for a given positive integer value. Factorial is denoted by n! and is the product of all positive integers less than or equal to n. For example:

6! = 1*2*3*4*5*6 = 720

So I implemented the function factorialX as follows:

-(double) factorialX: (int) value { double tempResult = 1; for (int i=2; i<=value; i++) { tempResult *= i; } return tempResult }

Tried the code out and [self factorialX:6] does return 720 as it should. Then I tried it with bigger numbers, and the first problem noticed was with 13! which returned result 1,932,053,504 but it should have returned 6,227,020,800. Well that is a little bit strange, then I googled factorial a little bit and found this post: Factorial Function in Objective C, and the author points out: “That’s because 13! exceeds unsigned integer maximum of about 4,000 million on 32-bit platforms.”.

Ok, but I have tempResult defined as double, so why did I get the problem that is associated with int. It turns out that in the loop tempResult is multiplied by i (which is defined as int) and thus the whole calculation is done for int values.

The solution is to cast the i as double, thus changing the expression in the loop to:

tempResult *= (double) i;

Then if I try to calculate 13! I get the correct result of 6,227,020,800 🙂

Found that math.h indeed has a gamma function, so I could calculate any factorial n (where n can be any positive number) with lgamma(n+1).

(*One question I have, which maybe of of the readers can solve is, how to calculate factorial of non integer value. For example 6.4!. If you input this into **wolframalpha.com** it shows you the result and it is calculated as Gamma(7.4), since Gamma(n+1) = n!. But **Gamma function** is defined as integral, and I do not know a way to calculate it numerically…*)