Eero af Heurlin <[EMAIL PROTECTED]> wrote: Hi!
> Andreas Flack wrote: > > > > Here's two anomalies: > > > > DB: 80.3, Midgard value: 80,300003 > > DB: 1736.40649, Midgard value: 1736.406494 > > > > The dbtype of the property is double, the type is float. The same thing > > happens when both dbtype and type are set to float. Plus, it happens > > with straight Midgard objects (on 1.8.4, PHP5.2, Debian Testing and > > openSuse 10.2), i.e. it doesn't seem to have anything to do with MidCOM. Can you describe table? Did you try to debug queries to see if value used in SQL is correct? > AFAIK MgdSchema treats type="float" as type="double" (since that's what > people usually mean) but you could try specifying it as double in the > mgdschema. Piotras should be able to elaborate. Actually we use only C float type. I do not see any reason to provide both float and double ATM. > > So if someone knows anything I could try, please let me know, the only > > workaround I can think of right now would be to set the property type to > > text and then cast the value back to float in my component code, which > > would be a bit too messy, really. Doubles on PHP level are always messy. Especially when your locale separator is dot, not a coma. Type cast to string seems to be the best solution in such case. Or probably switching between C and palticular locale all over again would be better one. Did you try , round, printf, sprintf or anything similiar? > Might not help you much actually as it's the casting the float that > likely is the problem here and I'm not sure if it makes much difference > whether it's made by Midgard core or PHP unless PHP has some special > magick there. Just imagine code which is invoked when locale is set with dot separator. MySQL doesn't accept dot in floats or doubles, so midgard-php must do this magick to get correct value with coma separator. Regarding http://trac.midgard-project.org/ticket/92. The only one way I found to add property with type double was to use internal PHP_ROUND_WITH_FUZZ macro, which forces 6 numbers after the separator. This seems to me much more flexible as it's easier to "shrink" value on higher level language. Piotras _______________________________________________ user mailing list [email protected] http://lists.midgard-project.org/mailman/listinfo/user
