[etoys-dev] Re: Need more decimal places (more than 10)

Yoshiki Ohshima yoshiki at vpri.org
Fri Jul 17 14:44:45 EDT 2009

At Thu, 16 Jul 2009 17:48:21 -0400,
USeITWes wrote:
> I was in hurry with the post above, so I kept it brief. I apologize for being unclear, but now I can elaborate. The
> member in question is using the read out from a pH probe that gives a measurement which is alway between 0 (acid) and 14
> (base) which gives 7 digits of precision. He then tried to create a script to calculate the concentration of hydrogen
> ions [H+]. The formula to calculate that is 10^-pH = [H+]. For a substance that is extremely basic, say a 12.6 on the pH
> scale, that would result in a concentration of 0.000000000000251. He attempted to use that result in another script and
> another equation and received a divide-by-zero exception.
> I hope that clears up any confusion. Thanks for the prompt response Mr. Cherlin. I will try your solution immediately.

  There can be a unexpected truncation somewhere.  Yes, please show
us your script.

  For getting more digits, you could use Text and Labels.  In an
experimental project I created:


I type the input concentration into the top text (which you may not
need).  When you click on the light blue rectangle, it calculates the
pH from the input, and then calculate back the density and set it into
the label below.  Note the usage of function tiles like exp and log.

  Yes, but this was not obvious even for me:

  - We have ln and log, but we only have exp.
  - The Text's numericValue setter truncates the value.  But the Label
    in the Connectors doesn't.  So I resort to use the Label for the
    read out.

-- Yoshiki
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ph.png
Type: image/png
Size: 65644 bytes
Desc: not available
Url : http://luna.immuexa.com/pipermail/etoys-dev/attachments/20090717/cd3d6eda/ph-0001.png

More information about the etoys-dev mailing list