Omar Mainegra
04/28/2020, 8:25 PMcos
function in K/N, i.e:
@Test
fun cosine_functions_works_the_same_in_all_platform() {
assertEquals(0.6441559905471732, cos(0.8708769899641021))
}
This test pass in JVM and JS, but fails in iOS:
kotlin.AssertionError: Expected <0.6441559905471732>, actual <0.6441559905471733>.
Kris Wong
04/28/2020, 9:28 PMKris Wong
04/28/2020, 9:29 PMKris Wong
04/28/2020, 9:30 PMNico Buescher
04/28/2020, 9:37 PMassertEquals
.Omar Mainegra
04/28/2020, 9:51 PMDouble
precision issue that might be related to the implementation of the functions in K/NOmar Mainegra
04/28/2020, 9:52 PMfun multiply(a: Double, b: Double) = a*b
@Test
fun cosine_functions_works_the_same_in_all_platform() {
assertEquals(0.49271114849400754, 0.7648941494365021*0.6441559905471732)
assertEquals(0.49271114849400754, multiply(0.7648941494365021, 0.6441559905471732))
}
Omar Mainegra
04/28/2020, 9:54 PMpassing floating point numbers across language boundaries
? If so I'd expect a loss in the precision as happened with cos
and sin
functionsKris Wong
04/28/2020, 9:55 PMOmar Mainegra
04/28/2020, 9:56 PMOmar Mainegra
04/28/2020, 9:58 PMmultiply
function in C or ObjC and create the bindings, can I expect the loss in the precision too?Kris Wong
04/28/2020, 9:59 PMOmar Mainegra
04/28/2020, 9:59 PM