From: Ry Nohryb on
On May 28, 2:59 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de>
wrote:
> Ry Nohryb wrote:
>
> > parseFloat(Math.PI.toString(33), 33)
> > --> NaN
>
> I cannot confirm this.  Where have you tested it?

Safari / Mac:
navigator.userAgent
--> "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us)
AppleWebKit/534.1+ (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7"
--
Jorge.
From: Johannes Baagoe on
Thomas 'PointedEars' Lahn :

> Your code style is being frowned upon by several knowledgable people
> here.

That *could* end up being a circular definition, like Flew's "No true
Scotsman" argument, http://en.wikipedia.org/wiki/No_true_Scotsman
(If someone does not frown upon Jorge's code style, it shows that
that person is not *knowledgeable*.)

Personally, I consider his suggestions interesting and enlightening.
I wouldn't use them in production code destined to be maintained by
cheap labour, but then, this newsgroup is hardly entirely about writing
Web applications in an industrial environment, is it now ? (If it is,
where can I find discussions about the computer language javascript ?)

--
Johannes
From: Ry Nohryb on
On May 28, 3:02 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de>
wrote:
>
> Your code style is being frowned upon by several knowledgable people here..

♪ We're all ♫ free ♩ to frown ♫

Or not ?

E.g., I have just frowned upon your 23 LOC parsefloat() that doesn't
work.
--
Jorge.
From: Thomas 'PointedEars' Lahn on
Ry Nohryb wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Ry Nohryb wrote:
>> > parseFloat(Math.PI.toString(33), 33)
>> > --> NaN
>>
>> I cannot confirm this. Where have you tested it?
>
> Safari / Mac:
> navigator.userAgent
> --> "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us)
> AppleWebKit/534.1+ (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7"

Thanks, I am seeing this in Google Chrome 5.0.375.55 beta for Linux (V8
2.1), too.

The reason of this is apparently that the fractional part of
"3.4m6dn4ow9qwe210nr3u0cdqkcnrbmwlh7kmfeapn9fijt38kie44jvdqh2vfrd6ogbvu
rnjq2bqkbr01f97av5k7uaffclrl3hmt2glugpaqe422qgfn81ca8pa73pmt51ewqo9234c
km2twg1qgwmahsv1pdti9bug3bjc9w0sn9ul421p5aanjnfuab9rq3bm5lchsu5aq6000no
i5wcf9c5p5idkgclha9j05bcupqqcb9h08dc3i2v2qcqjks96pgpkmangnavpt7tk6kvrfo
s0qq63iqrgv5nu2i8goh8tjmifwbwf9t3bvcd4r61tbqa05ca16ql0icacmucfcl1h3ceb1
hrdmhhmsp8ri842wn3nj97v7r5i9mdv135qo5jd9bn9chun8n1h11qlgt35mqksnn8ef4p6
kdade1d2t1bfigevwtjnjufm5sc9vhgq7qusio03g1ctrgmukjj5frghkmw1f1dhl4hvr7c
8slmplk66fb34twd9dwkvb16dfi8lbq8nvftmvwo2o4aukf0d252v3go1gtbgfbj8qoqtsf
8hpkkdfw9w686je30nmk6ojecalbc9ifs533e4gucpivw3327b1rc8a7qvqplce4o5agc9s
9h64lia1bker9hhbj7tq6saw68e7c6nqo37v97nbgl8bcgniv3g7ebvrwufnuqsqhlk6fee
7nsj348jwe0nstlnrjcet17sdksk7fo81rwtn6tknpo7lmcmskd4t5lebji6h6riabtauul
s2d49kgak0cu02fbwfklvn6jdlchkn7uwfa7qvncrfrw2umrhpja4hkwgrm261o8cf67c0a
lckiq428lpcvnjub55qkp15l90pbd47w9tupnf87iwjt8stpccka0scrqi7o6v8vmn1b73c
9f4r4g3m11ofcdw5rq7rv89s69mnoumfpark413hsogn5lb4qawo789t7oet5kfolb9ltn9
wm4iqlhi1glc5e2nd9q6jc6dghqcr5epkf2fde1rpd3ii2ouj7bq0pn16n4l28b85thc8ob
3bi7debdwogfnhfaif0v6h4k2i9k39fkrvmlc", which is the 33-ary representation
of Math.PI there, is parsed (because of its length) into `Infinity', while
in JavaScript 1.8.2 the representation is rounded to "3.4m6dn4ow9r" and
therefore the fractional part is not parsed into `Infinity'.

Therefore, it appears to be prudent to truncate the fractional part so that
it is not parsed into `Infinity'. A simple solution is to restrict the
number of characters matched by the regular expression, like:

... new RegExp("\\.([" + chars + "]{1,10})", "i") ...

A more sophisticated solution would be an adaptive algorithm that uses only
as many characters as possible so that the result would not be `Infinity'
given the numeric base. An implementation of that might be available
through the Mozilla sources.


BTW, in case you have not noticed yet, like Safari, Chrome has a Developer
menu (in the first main menu, below the Encoding menu item), which provides
access to the Developer tools, including a script console and a debugger
(which helped me to track this down). That makes using Firebug Lite in
Chrome unnecessary.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
From: Thomas 'PointedEars' Lahn on
Johannes Baagoe wrote:

> Thomas 'PointedEars' Lahn :
>> Your code style is being frowned upon by several knowledgable people
>> here.
>
> That *could* end up being a circular definition, like Flew's "No true
> Scotsman" argument, http://en.wikipedia.org/wiki/No_true_Scotsman
> (If someone does not frown upon Jorge's code style, it shows that
> that person is not *knowledgeable*.)

Yes, it could, if one would make that fallacy. However, the outcome of
reviews of Jorge's code style is not the (sole) defining property here.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)