Agnisr Posted May 17, 2007 Report Share Posted May 17, 2007 (edited) Sveiki. ir probleema ar vienu scriptu: <?php for ($i = 1; $i <= 20; $i++) { $p = (20/$i)*((1/10)^$i)*((9/10)^(20-$i)); echo $i.' - '.$p; echo '<br />'; } ?> lieta taada, ka vinjs nepareizi izreekina P veertiibu, ar taadu pashu izteiksmi ieksh Exel viss ir Ok, bet ar php garaam - skaitli aiziet simtos. meeginaajos visvisaadiigi, bet nekaadiigi nepiespiedu reekinaat pareizi. Vai tieshaam php nesaprot kaapinaashanu? funkcijas izteiksme ir shaada: mlja.. bildez... apaksaa /i /10 /10 vajag atrast veertiibas, kad mainaas i. Varbuut tieshaam esmu taads laame un korekti nevaru uzrakstiit f-iju, varbuut kaut kas greizi. Kaads, luudzu, var apskatiities un noraadiit kluudu. Jau ieprieksh paldies! Edited May 17, 2007 by Agnisr Link to comment Share on other sites More sharing options...
march Posted May 17, 2007 Report Share Posted May 17, 2007 Tāda ^ operatora nav, izmanto pow() funkciju. Link to comment Share on other sites More sharing options...
Agnisr Posted May 17, 2007 Author Report Share Posted May 17, 2007 ooops skaidrs, paldies. Hmm javascript izmet taadus pashus rez, maybe kaads zin, javascriptam ar nav taada operatora (vienk darbs jaaveic ieksh javascript, ar php speeleejos, jo vieglaak, eertaak)? Link to comment Share on other sites More sharing options...
march Posted May 17, 2007 Report Share Posted May 17, 2007 Javaskriptam ir funkcija Math.pow() Link to comment Share on other sites More sharing options...
Agnisr Posted May 17, 2007 Author Report Share Posted May 17, 2007 jap, biju jau atradis. Liels paldies tev. Link to comment Share on other sites More sharing options...
bubu Posted May 17, 2007 Report Share Posted May 17, 2007 march: tāds operators ^ ir, tikai tas apzīmē bitwise XOR. Link to comment Share on other sites More sharing options...
march Posted May 17, 2007 Report Share Posted May 17, 2007 Zināju ka tāds xor eksistē, tikai rakstot biju domājis, ka neeksistē kā matemātisks operators Link to comment Share on other sites More sharing options...
Recommended Posts