Skip to content

Change effective precision of [DateUtils toJulian] from float to double#1

Open
drewolbrich wants to merge 1 commit intoswerdlow:masterfrom
drewolbrich:master
Open

Change effective precision of [DateUtils toJulian] from float to double#1
drewolbrich wants to merge 1 commit intoswerdlow:masterfrom
drewolbrich:master

Conversation

@drewolbrich
Copy link

[NSDate timeIntervalSince1970] returns a double, and [DateUtils
toJulian] was casting it a float, stripping off valuable
precision. This was causing [SunCalc
getSunPositionDate:latitude:longitude:] to return a Sun position that
would stay fixed for many seconds at a time, and then suddenly jump
half a degree when it eventually changed.

In test code, the Sun altitude remained unchanged at 8.76209 degrees
for many seconds, and then later changed to 9.29653, where it stayed
for an extended period.

This behavior occurred only on the device, and not in the simulator.

[NSDate timeIntervalSince1970] returns a double, and [DateUtils
toJulian] was casting it a float, stripping off valuable
precision. This was causing [SunCalc
getSunPositionDate:latitude:longitude:] to return a Sun position that
would stay fixed for many seconds at a time, and then suddenly jump
half a degree when it eventually changed.

In test code, the Sun altitude remained unchanged at 8.76209 degrees
for many seconds, and then later changed to 9.29653, where it stayed
for an extended period.

This behavior occurred only on the device, and not in the simulator.
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

Successfully merging this pull request may close these issues.

1 participant