1

I've been having issues with math functions on swift. Sinf(), sqrtf() work on the iPhone 5 simulator but do not work on the iPhone 5S. Sin() and sqrt() work on iPhone 5S simulator but not on the iPhone 5. All my variables were introduced as CGFLoat(). I figured it has something to do with the 32 bit vs 64 bit but I could not find a fix for this. Is there a way to make sine and square root functions to work on both iphone5 and iPhone 5s? I am running Xcode6-Beta2. Thanks

Dman
  • 99
  • 1
  • 11
  • 2
    What line code of works on the simulator but not the device? And what error do you get? – Alex Wayne Aug 15 '14 at 16:29
  • 1
    Just update to Beta 5, then you can use the math functions with CGFloat without problems. – Martin R Aug 15 '14 at 17:38
  • I downloaded and installed Xcode 6 Beta 5 today. This version doesn't work very well for me. When I open the file it says indexing, and then nothing happens. If I try to compile it, the status says 'building' but nothing is happening. Anybody has an idea of whats going on? – Dman Aug 16 '14 at 03:21
  • Added Foundation framework and everything is back to normal. Martin R thanks for the tip. Upgrading to Beta 5 fixed everything! – Dman Aug 16 '14 at 07:02

2 Answers2

1

CGFloat is a double at 64-bit environment, use CGFLOAT_IS_DOUBLE to verify whether it is float or double.

Community
  • 1
  • 1
A-Live
  • 8,904
  • 2
  • 39
  • 74
0

Updating to Beta5 fixed the issue.

Dman
  • 99
  • 1
  • 11