I see. So as I understand it now, only the trigonometric functions are "picky". Thanks a lot! (Gerald)
----- Original Message ----- From: Zabach, Elke To: 'Gerald Nowitzky' ; [EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 4:22 PM Subject: RE: floating point calculations Gerald Nowitzky wrote: > > ok, that makes my real code look like that, but now it works :-) > Thanks a lot! > (Gerald) > > SELECT > dist=float(acos(float(float(Sin(float(0.01745329251994 * > zc.lat,15)),15) * > float(Sin(float(0.01745329251994 * z.lat,15)),15)+ > float(Cos(float(0.01745329251994 * zc.lat,15)),15) * > float(Cos(float(0.01745329251994 * z.lat,15)),15)* > float(Cos(float(0.01745329251994 * (z.lng - > zc.lng),15)),15),15)),15) * 6370 > from dba.zipcodes z, dba.zipcodes zc inner join dba.users uc > on zc.zip = > uc.zip where uc.user_key = 13 and zc.country_id = uc.country > and z.zip=60329 Nice idea, but a little bit too much floating. + and * and = work even with more than 15 digits --> SELECT dist=acos(float(Sin(float(0.01745329251994 * zc.lat,15)) * Sin(float(0.01745329251994 * z.lat,15))+ Cos(float(0.01745329251994 * zc.lat,15)) * Cos(float(0.01745329251994 * z.lat,15))* Cos(float(0.01745329251994 * (z.lng - zc.lng),15)),15)) * 6370 from dba.zipcodes z, dba.zipcodes zc inner join dba.users uc on zc.zip = uc.zip where uc.user_key = 13 and zc.country_id = uc.country and z.zip=60329 Puh, I hope, there is no bracket in the wrong place. Elke SAP Labs Berlin > ----- Original Message ----- > From: Zabach, Elke > To: 'Gerald Nowitzky' ; [EMAIL PROTECTED] > Sent: Wednesday, March 19, 2003 3:10 PM > Subject: RE: floating point calculations > > > Gerald Nowitzky wrote: > > > > select sin(sin(52)*sin(2)) > > > > should return 0.78154461294988686 in my opinion - and as well > > in the opinion > > of my pocket calculator. SAPDB insists on "?" as result. What > > am I doing > > wrong? I thought it might be necessary to cast the result as > > float, but > > there is no CAST. I've got no idea at the moment. > > 1. In the code there is a very nervous part: in case a number > has more than 16 non-zero digits and should be handled > with one of a bunch of functions, there is panic and the result > is that '?'. > This will be changed in one of the next releases > > 2. A workaround for this is > select sin( float(sin(52)*sin(2), 15) ) > > Elke > SAP Labs Berlin > _______________________________________________ > sapdb.general mailing list > [EMAIL PROTECTED] > http://listserv.sap.com/mailman/listinfo/sapdb.general > > _______________________________________________ > sapdb.general mailing list > [EMAIL PROTECTED] > http://listserv.sap.com/mailman/listinfo/sapdb.general > _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
