Thanks, Will file a bug. Not sure how the library uses the NSNumber since it's closed source. So it might be other inconsistencies as well..
> 5. okt. 2016 kl. 13.50 skrev Zhao Xin <[email protected]>: > > I think you should file a bug on the inconsistence of `description`. However, > the third-party API somehow using the `description` is not a good idea. > > Zhaoxin > > On Wed, Oct 5, 2016 at 5:30 PM, Lars-Jørgen Kristiansen via swift-users > <[email protected] <mailto:[email protected]>> wrote: > I'm working with a third party API for some external hardware. One of the > functions takes a NSNumber, and it fails to interact correctly with the > hardware if I cast a Float too NSNumber, but works as expected if I use > Double.. > > I dont know if it is related to NSNumber.stringValue since I dont know what > the third part lib does with the NSNumber, but I noticed this: > > let float = 100_000_00 as Float > let floatNumber = float as NSNumber > > let double = 100_000_00 as Double > let doubleNumer = double as NSNumber > > hardware.doThing(number: floatNumber as NSNumber) // Hardware does not work > hardware.doThing(number: doubleNumer as NSNumber) // Hardware works > > // Also noticed this: > "\(floatNumber)" // "1e+07" > "\(doubleNumer)" // "10000000" > > Is this expected behaviour? > > _______________________________________________ > swift-users mailing list > [email protected] <mailto:[email protected]> > https://lists.swift.org/mailman/listinfo/swift-users > <https://lists.swift.org/mailman/listinfo/swift-users> > >
_______________________________________________ swift-users mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-users
