473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

math problem

Hey,

Expression:
Math.floor(x * 100) / 100

x= 4.1 gives 4.09, why in gods name?
While other values for x don't give a problem.

Thx in advance

Chiwa
Jul 20 '05 #1
40 2939
: Expression:
: Math.floor(x * 100) / 100
:
: x= 4.1 gives 4.09, why in gods name?

Because browsers are not calculators (here = sign is "can be").

4.1 = 4.100000000000
= 4.099999999999
= 4.100000000001

So:
4.1*100 = 410.0000000000
= 409.9999999999

So:
Math.floor(x * 100) = 410
= 409

And so your answer can be 409.
How more devisions, multiplications and roundings the bigger the margin to
the exact calculation may grow.

: While other values for x don't give a problem.
No, you just did not find them ;-)

Wouter
Jul 20 '05 #2
: Expression:
: Math.floor(x * 100) / 100

Try this:

x.setPlaces(2);

Wouter
Jul 20 '05 #3
: Try this:
:
: x.setPlaces(2);
See : http://www.mredkj.com/javascript/num...xample150.html

Wouter
Jul 20 '05 #4
DJ WIce wrote:
: Try this:
:
: x.setPlaces(2);
See : http://www.mredkj.com/javascript/num...xample150.html


http://www.jibbering.com/faq/#FAQ4_7

Is a better reference for the OP

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #5
Chiwa wrote:
Hey,

Expression:
Math.floor(x * 100) / 100

x= 4.1 gives 4.09, why in gods name?
While other values for x don't give a problem.

Thx in advance

Chiwa

Just so you know, this is not just a limitation of Javascript. Many
other languages (C/C++ for instance) have this as an issue. That is
because Real numbers (floating point numbers) are _ALWAYS_
approximations. When you do a measurement of your finger (for
instance), and you measure exactly 1.25 inches... is that really
correct? Or could it be 1.25000002343589 inches instead? Or
1.2500000034322349872342229? (You get the idea)

For this reason (and others dealing with the complexity of floating
point numbers), when a float (indescrete) is represented by binary data
(descrete), you will have some goofiness... it is guaranteed.

Because of this, most languages have methods for you to set the
precision (the number of significant figures), where rounding will occur
to the precision value you wish for.

If you desire an exact floating point value, such as in something like
money calculations, simply set your precisions.

You can also work in values multiplied by (10*order)... For instance,
$10.47 can be worked with as integers... immagine 1,047 pennies :) You
can convert it back by dividing or modding by (10*order) in integer form.

I have had to use that method once when developing assembly code on an
8-bit processor. There was no float support, so I needed to work in
values multiplied by (10*order), and then do some simple calculations to
provide useful user information.

Blah.... I wrote too much. Oh well, I hope it helps :)
Brian

Jul 20 '05 #6
"Chiwa" <Ch******@hotmail.com> writes:
Expression:
Math.floor(x * 100) / 100

x= 4.1 gives 4.09, why in gods name?
While other values for x don't give a problem.


<URL:http://jibbering.com/faq/#FAQ4_7>

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #7
On Sun, 01 Feb 2004 21:25:58 GMT, "Chiwa" <Ch******@hotmail.com>
wrote:
Hey,

Expression:
Math.floor(x * 100) / 100

x= 4.1 gives 4.09, why in gods name?
While other values for x don't give a problem.

Thx in advance


After working on my order form code it appears that I noticed and
solved this same problem long ago.

What I do is to add 0.000001 to the value x before putting it through
this same function, when this makes sure that the value is not below
the true value before you run the calculation.

Since this fraction is so small, then it would be rounded off
anywhere, where you only have to watch out that your x value does not
use this many decimal places.

That of course is not a problem for money values, like what I use it
for, with only two (or three with VAT) decimal places.

There you go, perfect rounding results every time.

Cardman
http://www.cardman.com
http://www.cardman.co.uk
Jul 20 '05 #8
Cardman wrote:
After working on my order form code it appears that I noticed and
solved this same problem long ago.

What I do is to add 0.000001 to the value x before putting it through
this same function, when this makes sure that the value is not below
the true value before you run the calculation.

Since this fraction is so small, then it would be rounded off
anywhere, where you only have to watch out that your x value does not
use this many decimal places.

That of course is not a problem for money values, like what I use it
for, with only two (or three with VAT) decimal places.

There you go, perfect rounding results every time.

Cardman
http://www.cardman.com
http://www.cardman.co.uk


You have got to be careful with a solution like this, since it is just a
hack, and can be confusing to maintainers in the future. You should
really use precision mechanisms built into the language to solve the
problem more elegantly.

Brian

Jul 20 '05 #9
On Mon, 02 Feb 2004 19:48:00 +0000, Cardman <do****@spam-me.com>
wrote:
That of course is not a problem for money values, like what I use it
for, with only two (or three with VAT) decimal places.

There you go, perfect rounding results every time.


however it is not a legal solution for calculating VAT involving Euros
say. Do it properly.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #10
> Expression:
Math.floor(x * 100) / 100

x= 4.1 gives 4.09, why in gods name?
While other values for x don't give a problem.


JavaScript Numbers are 64-bit floating point as specified in IEEE 754.
It is the same representation that Java calls Double.

The scheme is intended to preserve as much precision as possible, but it
has some significant weakness. For example, it is not able to exactly
represent common fractions such as 1/10 or 1/100. It can at best
approximate them. As you can see, with a single operation you begin
accumulating noticeable error. Also, be aware that the associative law
and distributive law do not apply.

I think floating point is the wrong representation for numbers in most
applications. However, it is extremely popular, and popularity is much
more important these days than suitability or reliability. I recommend
that in applications that require exactness (for example, when working
with money) scale your values by a suitable factor (such as 100) so that
all of your arithmetic will be on whole numbers, which are exact.

http://www.crockford.com
Jul 20 '05 #11
: You have got to be careful with a solution like this, since it is just a
: hack, and can be confusing to maintainers in the future. You should
: really use precision mechanisms built into the language to solve the
: problem more elegantly.

I think this:
adding 0.0000001 and then use setPlaces(2);
will only be the solution when one want to have the code work in Netscape 4.
Exept that browser, a value of 4.1 will become 4.10 when directly used
setPlaces(2) (according to precious referred page).

Wouter


:
: Brian
:
:
:
Jul 20 '05 #12

: I think this:
: adding 0.0000001 and then use setPlaces(2);
: will only be the solution ..
<snip>

Sorry correction:
The input is x.
Make it a string.
Then get the lastIndexOf(".") that string.

If it's -1 -> add ".000"
If it's string length-2 -> add "00"
If it's string length-1 -> add "000"
If it's string length -> add "000"

Now parceFloat and setPlaces(2).

Wouter
Jul 20 '05 #13
: Now parceFloat and setPlaces(2).
parseFloat..

sorry
Jul 20 '05 #14
On Mon, 02 Feb 2004 20:12:20 GMT, ji*@jibbering.com (Jim Ley) wrote:
On Mon, 02 Feb 2004 19:48:00 +0000, Cardman <do****@spam-me.com>
wrote:
That of course is not a problem for money values, like what I use it
for, with only two (or three with VAT) decimal places.

There you go, perfect rounding results every time.


however it is not a legal solution for calculating VAT involving Euros
say. Do it properly.


Except that the value is in Sterling when that calculation is done,
where it is only converted to Euros following this.

Even had I used a different method, then the Sterling value before
Euro conversion would still be exactly the same. As I said the value
is too small to ever effect the total.

Cardman
http://www.cardman.com
http://www.cardman.co.uk
Jul 20 '05 #15
: Cardman
: http://www.cardman.com

Advice: remove the translation link for Dutch.
The page becomes none readable; it uses old words and a word by word
translation to the wrong words.

Welcome must be "Welkom"
Not welkomsgroet that can never be the first wordt in a line, so why it's
even chosen.. it's a very rare used word.

And that's only the first word. For all Dutch people the original page will
be way better and faster readable.

I think this holds for most Systran translations.
Even the tekst on their own page uses incorrect chosen words and bad
grammar.
(The Dutch flag link on http://www.systransoft.com/ results in:
http://w4.systranlinks.com/trans?sys...stransoft.com/
)

"Perfectioneer voor e-mail"
should be:
geoptimaliseerd voor e-mail
or:
perfectioneer uw e-mails

And
".. vertaalsoftware voor de dagelijkse meertalige behoeften van kleine
ondernemingen."
should be "behoefte" instead of "behoeften" and so on.

Just to let you know.
Wouter
Jul 20 '05 #16
On Mon, 2 Feb 2004 23:24:13 +0100, "DJ WIce" <contextmenu @
djwice.com> wrote:

I feel that I should start this reply with "Hej". :-]
Advice: remove the translation link for Dutch.
Oh?
The page becomes none readable; it uses old words and a word by word
translation to the wrong words.

Welcome must be "Welkom"
Not welkomsgroet that can never be the first wordt in a line, so why it's
even chosen.. it's a very rare used word.

And that's only the first word. For all Dutch people the original page will
be way better and faster readable.
Well the problem is that I know how terrible machine translations are,
but in most cases it is better than nothing. My pages have way too
much text and change too often to consider real translations.

So if you don't like the translation, then stick to the original
English version.
I think this holds for most Systran translations.
Yes... Still, for those people who do not know English, then they
really are better than nothing, even if they manage only a crude
translation.

I have been doubtful of the Systran translations for a long time,
where maybe I should consider removing them.
Even the tekst on their own page uses incorrect chosen words and bad
grammar.
(The Dutch flag link on http://www.systransoft.com/ results in:
http://w4.systranlinks.com/trans?sys...stransoft.com/
)

"Perfectioneer voor e-mail"
should be:
geoptimaliseerd voor e-mail
or:
perfectioneer uw e-mails

And
".. vertaalsoftware voor de dagelijkse meertalige behoeften van kleine
ondernemingen."
should be "behoefte" instead of "behoeften" and so on.
I see.
Just to let you know.


The problem is that there is no solution to make it better, but at
least Babblefish is not too bad. Shame that they do not support Dutch,
but there you go.

Cardman
http://www.cardman.com
http://www.cardman.co.uk
Jul 20 '05 #17
<snip>
: So if you don't like the translation, then stick to the original
: English version.
What I was trying to tell you is that everyone in the Netherlands can read
and speak English at such level that your machone translation will never be
better readable than the English version. At 10 Dutch people will start
learning English and they must to that till they are at least 16.

Or let me tell give you an other argument;
One has to be very high educated to understand the translated page (very
high is above Univercity level in Dutch).

<snip>
: Yes... Still, for those people who do not know English..
There are no Dutch people who don't know English.
If a Dutch person can use internet he will be able to read Engish.
(remember that hacked software is mostly in English, so it's a must for
Dutch people to learn Engish - joke).

Wouter
Jul 20 '05 #18
On Tue, 3 Feb 2004 00:01:10 +0100, "DJ WIce" <contextmenu @
djwice.com> wrote:
<snip>
: So if you don't like the translation, then stick to the original
: English version.
What I was trying to tell you is that everyone in the Netherlands can read
and speak English at such level that your machone translation will never be
better readable than the English version. At 10 Dutch people will start
learning English and they must to that till they are at least 16.
Then it is odd how my Atlas says that the languages used there are
Dutch and Frisian. Still, it does not mention English for Sweden
either, when I know from my visit to Gothenburg that like everyone
there speaks English.

I think that they are trying to ignore the truth.
Or let me tell give you an other argument;
One has to be very high educated to understand the translated page (very
high is above Univercity level in Dutch).
Ok, I get your point.
There are no Dutch people who don't know English.
Did anyone ever tell you that English is spreading too far around the
region? :-]

I blame TV myself, with all that Hollywood programming, where they
even have the nerve to subtitle instead of dub. They should have done
like the Germans and banned the English language. ;-]
If a Dutch person can use internet he will be able to read Engish.
(remember that hacked software is mostly in English, so it's a must for
Dutch people to learn Engish - joke).


Does the words "Canal Digitaal" feature anywhere in the joke? Yes I
have been watching your local TV stations for years.

Cardman
http://www.cardman.com
http://www.cardman.co.uk
Jul 20 '05 #19
: >There are no Dutch people who don't know English.
:
: Did anyone ever tell you that English is spreading too far around the
: region? :-]
Most Dutch do also speak/understand German and have a 3 to 6 years education
in Frensh.
It's our custom to try to speak the language of the countries we visit for
holidays.

: subtitle instead of dub.
I dislike dubbing, some commercials are in dub, then I always zap to an
other channel (we "only" have 32).

: Does the words "Canal Digitaal" feature anywhere in the joke?
Only the analoge encoded channals are easy to decode without a
licence/decode formula.
For the digital channels we usually have a friend via the internet who knows
the codes for each month (because he works there) :-0

Wouter
Jul 20 '05 #20
>>What I was trying to tell you is that everyone in the Netherlands can read
and speak English at such level that your machone translation will never be
better readable than the English version. At 10 Dutch people will start
learning English and they must to that till they are at least 16.
Well, Wouter, not everyone. For Internet purposes though your statement
below is completely valid.

Then it is odd how my Atlas says that the languages used there are
Dutch and Frisian.
That is officially. Dutch and Frisian (the latter locally) can be used
by the government for communication.
In Holland, either Turkish or Maroc (er, what's that ending?) will be
the second language in frequency. I guess.
Still, it does not mention English for Sweden
either, when I know from my visit to Gothenburg that like everyone
there speaks English.

I think that they are trying to ignore the truth.
Or let me tell give you an other argument;
One has to be very high educated to understand the translated page (very
high is above Univercity level in Dutch).

Agree; given only the 'dutch' version of the page, I think I still would
have failed to understand what it is about--let alone get the details.
In fact, to understand a bit of that version requires *quite a lot* more
English knowledge than the English original!
There are no Dutch people who don't know English.
Know? My son doesn't know English. But then again, he's only 4. ~ ~ ~
Did anyone ever tell you that English is spreading too far around the
region? :-]
Have you ever tried to speak English with Asian people? You should!
I blame TV myself, with all that Hollywood programming, where they
even have the nerve to subtitle instead of dub. They should have done
like the Germans and banned the English language. ;-]
Yeah, and keep synchronized sound tracks. Yulck.
If a Dutch person can use internet he will be able to read Engish.
(remember that hacked software is mostly in English, so it's a must for
Dutch people to learn Engish - joke).


You call that a joke? I call it a chore! Software translation happens,
but most often it helps to know the original terms to understand what
the comments are about. Let alone the fact that English often takes up
less space on screen, so texts in Dutch get trunca someti.

I happen to have quite some customers where I'd better not use any
english word in my software (I happen to be a developer ;-) ) because
they don't get it then!
As a matter of fact, I think I can come up with quite a few people for
whom English is not a real option.

In the case of defending arguments (or on emotional subjects) I prefer
to use a neutral language. English suits me perfectly except when the
other party is a native speaker. You probably wouldn't want to take on
me in Dutch, would you?
Cardman
http://www.cardman.com
http://www.cardman.co.uk

--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Jul 20 '05 #21
: : Now parceFloat and setPlaces(2).

Oeps..
http://www.mredkj.com/javascript/num...mat.html#tryit

Seems that I read about an inplemented script..
But well it's free, so you can use it.
Wouter
Jul 20 '05 #22
: >>There are no Dutch people who don't know English.
: Know? My son doesn't know English. But then again, he's only 4. ~ ~ ~
I hope he will know a bit when he's 8 :-)
But I think he probable already knows some words ("Yes","No","Hello" or a
line or some from the telly).

: Have you ever tried to speak English with Asian people? You should!
LOL. Yeah, and on the same level:
I wander why the TU does ask them to come here to study, but then forgets to
teach them on what side of the road they shuld ride with their new bike.
On daily bases I see foreign studends expose their selfs in dangerous
situations, riding on the leftside of the road when a card rides on the
right side in oposite direction.. or even other bikes..

: As a matter of fact, I think I can come up with quite a few people for
: whom English is not a real option.
Hmm, well the "Discard" button makes manny people wander.
But that's mostly because WP5.1 was Dutch and so was their windows.
I think that sometimes people might be afrait for not understanding the
machine and then getting blackouts. I'm mostly visual geared so I even get
arround configurating some asian windows version.
I do also see that for older people (or other people who till now did not
work with computers) it's hard to distinguish differant windows programs.
They all look alike.
But if you put a child age of 4 behind a computer he mostly finds more
options and works with a mouse the way you would not expect within hours.

: In the case of defending arguments (or on emotional subjects) I prefer
: to use a neutral language. English suits me perfectly except when the
: other party is a native speaker.
Yeah, I think that's the way it should be. One can express himself best in
their native language.

: You probably wouldn't want to take on
: me in Dutch, would you?
Me? np :-)

Wouter
Jul 20 '05 #23
Cardman <do****@spam-me.com> wrote in message news:<at********************************@4ax.com>. ..
On Tue, 3 Feb 2004 00:01:10 +0100, "DJ WIce" <contextmenu @
djwice.com> wrote:
<snip>
: So if you don't like the translation, then stick to the original
: English version.
What I was trying to tell you is that everyone in the Netherlands can read
and speak English at such level that your machone translation will never be
better readable than the English version. At 10 Dutch people will start
learning English and they must to that till they are at least 16.
Then it is odd how my Atlas says that the languages used there are
Dutch and Frisian. Still, it does not mention English for Sweden
either, when I know from my visit to Gothenburg that like everyone
there speaks English.

<snip>
Sorry man, but the dutch translation is really horrible! No one will
be able to grasp what your site is about!
Wait, I'll re-translate the first line for you:

YOU: Welcome to my new web-site, which I hope you will like.
SYSTRAN: Welkomstgroet voor mijn opkomend zwemvlies- terrein, wie MIJ
hoop u zal zoals.
RETRANSLATED: Welcomegreetings for my nascending flipper- terrain, who
ME hope you will likewise.

Well, the manual that came with my Taiwanese microwave seems like the
'Kings English' compared to this. My advise: junk it and ask a
friendly dutchman to translate your page for you!
Cardman
http://www.cardman.com
http://www.cardman.co.uk


Groetjes, Wiesje
Jul 20 '05 #24
DJ WIce wrote:
: >>There are no Dutch people who don't know English.
: Know? My son doesn't know English. But then again, he's only 4. ~ ~ ~
I hope he will know a bit when he's 8 :-)
But I think he probable already knows some words ("Yes","No","Hello" or a
line or some from the telly).
Possibly. He's already near fluent in Esperanto.
: Have you ever tried to speak English with Asian people? You should!
LOL. Yeah, and on the same level:
I wander why the TU does ask them to come here to study, but then forgets to
teach them on what side of the road they shuld ride with their new bike.
On daily bases I see foreign studends expose their selfs in dangerous
situations, riding on the leftside of the road when a card rides on the
right side in oposite direction.. or even other bikes..


Why? Is one required to keep right with a bicycle ? :-)
--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Jul 20 '05 #25
wiesje janssen wrote:
<snip>
Sorry man, but the dutch translation is really horrible! No one will
be able to grasp what your site is about!
Wait, I'll re-translate the first line for you:

YOU: Welcome to my new web-site, which I hope you will like.
SYSTRAN: Welkomstgroet voor mijn opkomend zwemvlies- terrein, wie MIJ
hoop u zal zoals.
RETRANSLATED: Welcomegreetings for my nascending flipper- terrain, who
ME hope you will likewise. [hopes], even
Well, the manual that came with my Taiwanese microwave seems like the
'Kings English' compared to this. My advise: junk it and ask a
friendly dutchman to translate your page for you!

Cardman
http://www.cardman.com
http://www.cardman.co.uk

Groetjes, Wiesje

--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Jul 20 '05 #26
Hey, was that Send I hit? How come my hands have grown so big? :-)
Well, the manual that came with my Taiwanese microwave seems like the
'Kings English' compared to this. My advise: junk it and ask a
friendly dutchman to translate your page for you!


I would.
--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Jul 20 '05 #27
JRS: In article <40****************@news.cis.dfn.de>, seen in
news:comp.lang.javascript, Jim Ley <ji*@jibbering.com> posted at
Mon, 2 Feb 2004 20:12:20 :-
On Mon, 02 Feb 2004 19:48:00 +0000, Cardman <do****@spam-me.com>
wrote:
That of course is not a problem for money values, like what I use it
for, with only two (or three with VAT) decimal places.

There you go, perfect rounding results every time.


however it is not a legal solution for calculating VAT involving Euros
say. Do it properly.


If you have URLs leading to Euro arithmetic rules, it might be
worth putting one in the FAQ; and I'd be pleased to put some in
<URL:http://www.merlyn.demon.co.uk/eurocash.htm>.

--
© John Stockton, Surrey, UK. ??*@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
Dates - miscdate.htm Year 2000 - date2000.htm Critical Dates - critdate.htm
Euro computing - eurocash.htm UK Y2k mini-FAQ: y2k_mfaq.txt Don't Mail News
Jul 20 '05 #28
JRS: In article <rt********************************@4ax.com>, seen in
news:comp.lang.javascript, Cardman <do****@spam-me.com> posted at Mon, 2
Feb 2004 19:48:00 :-
On Sun, 01 Feb 2004 21:25:58 GMT, "Chiwa" <Ch******@hotmail.com>
wrote:
Math.floor(x * 100) / 100

What I do is to add 0.000001 to the value x before putting it through
this same function, when this makes sure that the value is not below
the true value before you run the calculation.

Since this fraction is so small, then it would be rounded off
anywhere, where you only have to watch out that your x value does not
use this many decimal places.


One fundamental error is that Math.floor is being used where Math.round
is needed.

Another is that there is almost no intrinsic need to round numbers to a
multiple of 0.01; the need is to convert a Number to a String with two
decimal places.

Read the FAQ.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 20 '05 #29
On Tue, 03 Feb 2004 13:00:02 +0100, Bas Cost Budde <ba*@heuveltop.org>
wrote:
Hey, was that Send I hit? How come my hands have grown so big? :-)
Well, the manual that came with my Taiwanese microwave seems like the
'Kings English' compared to this. My advise: junk it and ask a
friendly dutchman to translate your page for you!


I would.


Then there is the other 77 pages...

My best idea for having a multiple language site would be to remove as
much information as possible, including minimum item information with
no real description except the photo, then to have this very compacted
site translated into many languages as possible.

The only real problem is when adding new items, but you can just learn
the phrase "No Information Available" in all the languages.

Having my current site translated, even for free, is a crazy idea,
when other languages cannot be maintained for any real time, despite
such promises.

Yes I could well get rid of the Systran options, but then there would
go most of the flags as well.

Maybe one day I may actually do that multi-language shopping site,
when a photo based selection gallery in lots of languages is not too
hard. The only issue is that customers like shopping in their own
country, which is a difficult one to solve.

In fact one of my rival suppliers already does a system like that,
where he is a little too successful.

Cardman
http://www.cardman.com
http://www.cardman.co.uk
Jul 20 '05 #30
Cardman wrote:
I would.
Then there is the other 77 pages...

My best idea for having a multiple language site would be to remove as
much information as possible, including minimum item information with
no real description except the photo, then to have this very compacted
site translated into many languages as possible.

The only real problem is when adding new items, but you can just learn
the phrase "No Information Available" in all the languages.


LOL
Having my current site translated, even for free, is a crazy idea,
when other languages cannot be maintained for any real time, despite
such promises.


True. Yet it happens that especially Dutch (or, to be honest, germanic
languages in general) needs manual assistance. Keep Systran. Please do.

Just checked the German version--it can be read.

But for the Dutch version, how much time/patience have you got? The
offer stands. Translating into Dutch is not as much a problem for me as
translating into English ;-)

--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Jul 20 '05 #31
You know what? Relieve some of the strain on the translation machines by
using shorter sentences. (Sorry, that is a bad example).

An example:

"To begin with then if this is your first visit then odds are that you
came here because someone you know recommended you to visit"
this is bound to cause trouble.

"Is this your first visit? Possibly your friend has recommended this
site to you"
has a little more universal structure. Maybe it is not your style of
writing; but you won't develop a style of writing in 8000 languages,
would you?
--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Jul 20 '05 #32
On Tue, 3 Feb 2004 12:34:58 +0000, Dr John Stockton
<sp**@merlyn.demon.co.uk> wrote:
One fundamental error is that Math.floor is being used where Math.round
is needed.
The calculation is being done for VAT. Customs & Excise rules state
that how the VAT value is rounded is the choice of the VAT registered
company, but the system used must always be constant.

Since I believe in giving that 1p to my customers instead of tax man,
then that is why the Math.floor function is used.
Another is that there is almost no intrinsic need to round numbers to a
multiple of 0.01; the need is to convert a Number to a String with two
decimal places.


The need is to display the correct answer, where that is being done
string or no string.

It is quite interesting when you examine this problem at the bit
level, but why the used a rubbish fuzzy number system in the first
place is a good question.

Cardman
http://www.cardman.com
http://www.cardman.co.uk
Jul 20 '05 #33
On Tue, 03 Feb 2004 23:17:17 +0100, Bas Cost Budde <ba*@heuveltop.org>
wrote:
You know what? Relieve some of the strain on the translation machines by
using shorter sentences. (Sorry, that is a bad example).

An example:

"To begin with then if this is your first visit then odds are that you
came here because someone you know recommended you to visit"
this is bound to cause trouble.

"Is this your first visit? Possibly your friend has recommended this
site to you"
has a little more universal structure. Maybe it is not your style of
writing; but you won't develop a style of writing in 8000 languages,
would you?


It is a case that people with multiple language skills can better
understand the language construct or grammar. Others of us are still
working on the one we have.

Since that text of mine seems a bit doggy these days, then something
like "Should this be your first visit to this site, then the odds are
that someone told you to visit" would be better.

Yes I could go and rewrite my entire site and improve the text, but I
work on a gradual improvement system. So when I am doing some large
work on a page, then I can review all the text on that page.

Over the last three and a half years that Welcome page first got
wrote, then about two years ago it got improved. I have been feeling
for a long time that it needs another improvement.

Cardman
http://www.cardman.com
http://www.cardman.co.uk
Jul 20 '05 #34
On Tue, 03 Feb 2004 22:59:58 +0100, Bas Cost Budde <ba*@heuveltop.org>
wrote:
Cardman wrote:
Having my current site translated, even for free, is a crazy idea,
when other languages cannot be maintained for any real time, despite
such promises.
True. Yet it happens that especially Dutch (or, to be honest, germanic
languages in general) needs manual assistance. Keep Systran. Please do.


Now you like it?
Just checked the German version--it can be read.
That is good news then, but are you sure that was not the Babblefish
version of the German language?
But for the Dutch version, how much time/patience have you got? The
offer stands. Translating into Dutch is not as much a problem for me as
translating into English ;-)


Should you really desire to translate my site into Dutch, then be my
guest. As the worst case situation is that it just gets neglected if
you get interested in other things.

Just don't try translating the News page, when I tend to type a lot,
where that News goes all the way back to 2000.

The best way to do this is to just translate the paragraphs into a
text file, where I can then paste these into the right sections on my
HTML pages.

Should you really want to translate all suitable pages, then there are
about 38 pages excluding all the News ones. There are a few pages that
are not easy to find, where I would have to point those out.

The first job would be to translate the welcome page and the menu
text.

And since it is best to e-mail me to discuss this further, then you
can do so at yourads at cardman.co.uk.

Well, good luck, when the last attempt to translate my former site was
back in 1998 to Svenska. For nostelga purproses, then I have put the
Swedish version of my old site here...
http://www.cardman.co.uk/esg/Svenska/

You can see that 9 pages were translated before he gave up, where I
will keep that up for a few days before removing it again.

Cardman
http://www.cardman.com
http://www.cardman.co.uk
Jul 20 '05 #35
: I have been feeling
: for a long time that it needs another improvement.
Maybe, you can test serverside if one visits for the first time.
You can check with script or serverside if one comes via google..

So you don't need to guess.. that bad.

Then it shows more professional I think.

And maybe just start to tell people what's the site about.. instead of
guessing where they come from or how that they did find you.

Maybe you want items to be clickable and then be added to a basket.
PHP-Nuke is a free php/MySQL script to built a website that also has
shopping script and can handle multiple languages.

Wouter
Jul 20 '05 #36
On Tue, 03 Feb 2004 02:24:42 +0000, Cardman <do****@spam-me.com>
wrote:
Then it is odd how my Atlas says that the languages used there are
Dutch and Frisian.


It probably tells you the official language of Eire is Gaelic too, I
wouldn't bet on your chances of finding a speaker, let alone a speaker
who doesn't also understand English.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #37
On Wed, 04 Feb 2004 12:55:38 GMT, ji*@jibbering.com (Jim Ley) wrote:
On Tue, 03 Feb 2004 02:24:42 +0000, Cardman <do****@spam-me.com>
wrote:
Then it is odd how my Atlas says that the languages used there are
Dutch and Frisian.
It probably tells you the official language of Eire is Gaelic too,


English followed by Irish Gaelic apparently.
I wouldn't bet on your chances of finding a speaker, let alone a
speaker who doesn't also understand English.


I believe the difference is that Ireland (Eire) has accepted the fact
that English has assimilated the population, but they have not
scrubbed off the former national language yet.

The same thing happens in Wales to a lesser degree, when more people
their speak English than Welsh. One reason could be the neighbouring
English crossing the mountains into dragon country.

It would be nice had it listed what a large percentage of the
population can speak, instead of what the politicians desire the
population to only speak.

Cardman
http://www.cardman.com
http://www.cardman.co.uk
Jul 20 '05 #38
Jim Ley wrote:
[the atlas] probably tells you the official language of Eire is Gaelic too, I
wouldn't bet on your chances of finding a speaker, let alone a speaker
who doesn't also understand English.


Maybe the oldest people?

My atlas notes gaelic as regional (western parts) and diminishing in
use. No notes about first or second language.

--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Jul 20 '05 #39
JRS: In article <gf********************************@4ax.com>, seen in
news:comp.lang.javascript, Cardman <do****@spam-me.com> posted at Tue, 3
Feb 2004 23:04:36 :-

(VAT stuff) : I was not addressing your situation, but the defects of
your answer to Chiwa's original question, and the probable context of
that question. When responding to an article in News, it is wise to
examine the position of that article in its thread, and at least to
review its immediate predecessors.
Another is that there is almost no intrinsic need to round numbers to a
multiple of 0.01; the need is to convert a Number to a String with two
decimal places.


The need is to display the correct answer, where that is being done
string or no string.


Numbers cannot be displayed; only strings can. On output of a
javascript number, there is an automatic conversion to string.

Consider document.write(3.00) - the result will be 3, not
3.00, and that is correct by language definition.

The usual reason for wanting to truncate a Number to a multiple of 0.01
is that a currency calculation with input sums to two places gives a
result with rounding errors which displays something like 3.00000000001;
"numeric truncation" and "numeric rounding" both give a Number of 3,
displaying as 3. Those who use numeric truncation eventually discover
that they need to change to numeric rounding, in order not to lose one
unit up to half the time.

But they then see that sums of money such as three pounds, three pounds
five pence, and three pounds ten pence display as 3 3.05 3.1, whereas
convention demands 3.00, 3.05, 3.10. To get those in javascript the
Number must be converted to a String with two decimal places before
output.

The conversion needs a function.

There is no need to round the number before the function; it is better
to do it within.


I see a possible problem with your VAT approach. VAT here is 17.5%.

In any language using IEEE Doubles,
1.175 - 1.0 - 0.125 = 0.050000000000000044
0.175 - 0.125 = 0.04999999999999999
Here 1.0 and 0.125 are numbers that an IEEE Double can represent
exactly. So 1.175 is stored as slightly more, but 0.175 as slightly
less.

Thus for ten items costing GBP 1.00 exc. VAT, with truncation, the
customer may be called on to pay GBP 11.75, and the VATman may be
offered GBP 1.74. Accounts may show a discrepancy of one penny.
Amusing thought : % means /per centum/. Literally, a VAT rate of 17.5%
means not that the tax is the net times 0.175, but that for every 100
pence in the net the tax is 17.5 pence --- and 17.5 can of course be
represented exactly. If the calculation had been done literally,
calculating the pennies of VAT from the hundreds-of-pence net, the
results would have been exact.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 20 '05 #40
On Wed, 04 Feb 2004 15:13:19 +0000, Cardman <do****@spam-me.com>
wrote:
On Wed, 04 Feb 2004 12:55:38 GMT, ji*@jibbering.com (Jim Ley) wrote:
On Tue, 03 Feb 2004 02:24:42 +0000, Cardman <do****@spam-me.com>
wrote:
Then it is odd how my Atlas says that the languages used there are
Dutch and Frisian.
It probably tells you the official language of Eire is Gaelic too,


English followed by Irish Gaelic apparently.


So it has nothing to do with national languages, English is not a
national language of Eire.
I believe the difference is that Ireland (Eire) has accepted the fact
that English has assimilated the population,
It'd had assimilated the population even before 1911 I believe.
It would be nice had it listed what a large percentage of the
population can speak, instead of what the politicians desire the
population to only speak.


What? The Irish don't even get the EU to produce documents in it
national language (uniquely AIUI) because so few people can.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #41

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: qwweeeit | last post by:
Another math problem easier to solve by hand, but, IMHO, difficult to program in a concise way like the solution of Bill Mill (linalg_brute.py) to the problem of engsol. I appreciated very much...
8
by: McKirahan | last post by:
How do I add floating point numbers accurately? The following adds the 4 numbers 46.57, 45.00, 45.00, and 54.83 to give 191.39999999999998 instead of 191.40. <html> <head>...
14
by: marcokrechting | last post by:
Hi All, I have a rather complex math problem concerning dates. I will try to explain my problem. I have a table with the fields SUBJECT (text), DUE DATE (date) and CHECKED (yes/no). In this...
4
by: nick | last post by:
I'm having a really weird problem. Take a look at this screenshot. http://users.aber.ac.uk/njb4/dotnetproblem1.jpg Notice the 4 watches at the bottom, _totalRecords, MyDataGrid.PageSize and...
5
by: Todd | last post by:
OK...I have a form that has two text boxes. These two fields are being filled from a file import, which works fine. I am then passing these values into a custom class with both values typed as...
16
by: Bill Nguyen | last post by:
I'm running into a very weird problem regarding subtraction. Subtraction behaves as if it's an addition in the below sub txtJacoCost.Text = Format(mRackc - (mDisc + mJaEc), "0.#####0") ...
5
by: BEES INC | last post by:
I've been awfully busy programming lately. My Django-based side project is coming along well and I hope to have it ready for use in a few weeks. Please don't ask more about it, that's really all I...
0
by: Gary Herron | last post by:
BEES INC wrote: Much simpler this way. This produces the number of whole start and the number of half stars: v = ... calculate the average ... whole = int(v+0.25) half =...
2
by: astrogirl77 | last post by:
Hi, I'm new to Python and am hoping to find help with coding a Python script, applet. I code in an old version of Visual Basic 4.0, I have a simple app that is about 3 and a half pages of code...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.