1. Traducir bigatom.e al inglés - Yo no sé
- Posted by cargoan Dec 20, 2014
- 2064 views
Buenas, ante todo aclarar que no soy programador ni matemático ni siquiera he ido a la universidad, solo me gusta, me lo paso bien haciendo mis cosillas.
Al grano, resulta que haciendo otra cosa necesitaba manejar números con muchos dígitos y decimales y claro no podía utilizar atoms, tenía que manipular cadenas que representaban números y además hacer cálculos con ellos y he acabado escribiendo mi propia librería 100% euphoria que he llamado bigatom, básicamente un número real de precisión arbitraria en base 10, sín límite de dígitos y sin almacenar ningún cero innecesario. Admite atoms y cadenas representando números en coma fija y exponencial, la entrada es muy flexible.
Como creo que podría servir a más gente me gustaría publicarla, pero yo no sé inglés.
Agradecería cualquier ayuda.
Aquí un ejemplo:
[$]: tail -n 20 bigatom.e ifdef PRUEBA then puts(1, "\nSabías que...\n\n") integer n = 2, decs = 100 scale(decs) bigatom ba = ba_sqrt(n) printf(1, "La raíz cuadrada de %d con %d decimales es:\n\t%s\n\n", { n, decs, ba_sprintf("%.100aB", ba) }) ba = ba_root(n, 3) ba_printf(1, "Y que su raíz cúbica es:\n\t%.100aB\n\n", ba) ba = ba_log(n) ba_printf(1, "Su logaritmo natural es:\n\t%.100aB\n\n", ba) ba = ba_logb(n, 10) ba_printf(1, "Y su logaritmo decimal es:\n\t%.100aB\n\n", ba) decs = 843 scale(decs) ba = ba_exp("1") printf(1, "Y que 'e' con %d decimales es:\n\t%s\n", { decs, ba_sprint(ba) }) end ifdef [$]: eui -D PRUEBA bigatom.e Sabías que... La raíz cuadrada de 2 con 100 decimales es: 1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850 3875343276415727 Y que su raíz cúbica es: 1.259921049894873164738100249829469766812563224298692094550897648963699835113053650926 5034213843982171 Su logaritmo natural es: 0.693147180559945309417232121458176568075500134360255254120680009493393621969694715605 8633269964186875 Y su logaritmo decimal es: 0.301029995663981195213738894724493026768189881462108541310427461127108189274424509486 9272521181861720 Y que 'e' con 843 decimales es: 2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571 382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490 763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477 411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737 113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056 953696770785449969967946864454905987931636889230098793127736178215424999229576351482208269 895193668033182528869398496465105820939239829488793320362509443117301238197068416140397019 837679320683282376464804295311802328782509819455815301756717361332069811250996181881593041 690351598888519345807273866738589422879228499892086805825749279610484198444363463244968487 560233624827041978623209002160990235304
2. Re: Traducir bigatom.e al inglés - Yo no sé
- Posted by GreenEuphorian Dec 20, 2014
- 2015 views
This is an English-speaking forum
3. Re: Traducir bigatom.e al inglés - Yo no sé
- Posted by _tom (admin) Dec 20, 2014
- 1978 views
Hi, first of all clarify that I am not a programmer or mathematician I have not even gone to college, I just like, I have fun doing my stuff. To the point, is it doing something else needed to handle numbers with many digits and decimals and clear could not use Atoms, had to manipulate strings representing numbers and also do calculations with them and I ended up writing my own library 100% euphoria I called bigatom basically a real arbitrary precision number in base 10, definitelly digit limit without storing any unnecessary zero. As I think could serve more people would like to publish it, but I do not know English. I would appreciate any help. Here's an example:
[$]: Tail -n 20 bigatom.e TEST ifdef then a puts (1, "\ nSabías that ... \ n \ n") integer n = 2, decs = 100 scale (decs) bigatom ba = ba_sqrt (n) printf (1, "The square root of% d with% d decimal is: \ n \ t% s \ n \ n" {N, decs, ba_sprintf ("%. 100aB" ba)}) ba_root ba = (n, 3) ba_printf (1, "And your cube root is: \ n \ t% .100aB \ n \ n" ba) ba = ba_log (n) ba_printf (1, "The natural logarithm is: \ n \ t% .100aB \ n \ n" ba) ba_logb ba = (n, 10) ba_printf (1, "And its logarithm is: \ n \ t% .100aB \ n \ n" ba) decs = 843 scale (decs) ba = ba_exp ("1") printf (1, "And that 'e' with% d decimal is: \ n \ t% s \ n", {decs, ba_sprint (ba)}) end ifdef [$]: D eui bigatom.e TEST Did you know ... The square root of 2 to 100 decimal is: 1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850 3875343276415727 And your cube root is: 1.259921049894873164738100249829469766812563224298692094550897648963699835113053650926 5034213843982171 Its natural logarithm is: 0.693147180559945309417232121458176568075500134360255254120680009493393621969694715605 8633269964186875 And its logarithm is: 0.301029995663981195213738894724493026768189881462108541310427461127108189274424509486 9272521181861720 And that 'e' to 843 decimal is: 2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571 382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490 763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477 411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737 113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056 953696770785449969967946864454905987931636889230098793127736178215424999229576351482208269 895193668033182528869398496465105820939239829488793320362509443117301238197068416140397019 837679320683282376464804295311802328782509819455815301756717361332069811250996181881593041 690351598888519345807273866738589422879228499892086805825749279610484198444363463244968487 560233624827041978623209002160990235304
Welcome!
_tom
4. Re: Traducir bigatom.e al inglés - Yo no sé
- Posted by cargoan Dec 20, 2014
- 2004 views
"This is an English-speaking forum"
I know, but I think worth it. I think it might interest some people.
I'm sorry if I upset, delete it.
Greetings.
5. Re: Traducir bigatom.e al inglés - Yo no sé
- Posted by _tom (admin) Dec 20, 2014
- 1997 views
"This is an English-speaking forum"
I know, but I think worth it. I think it might interest some people.
I'm sorry if I upset, delete it.
Greetings.
This is a Euphoria forum. Everyone is welcome.
It is great if you post even if you do not understand English!
So, once again. Welcome!
_tom
6. Re: Traducir bigatom.e al inglés - Yo no sé
- Posted by _tom (admin) Dec 20, 2014
- 2015 views
Me gustaría ver la biblioteca bigatom.e, al igual que muchos otros usuarios Euphoria.
Google Translate es capaz de hacer el trabajo duro y podemos crear una traducción al Inglés sin mucho trabajo.
Esto es algo que podría terminar en la biblioteca estándar.
I would like to see the bigatom.e library, as would many other Euphoria users. Google translate can do the hard work and we can create an English translation without much work. This is something that could end up in the standard library.
_tom
7. Re: Traducir bigatom.e al inglés - Yo no sé
- Posted by cargoan Dec 20, 2014
- 2056 views
uploaded in pastebin
bigatom.e http://pastebin.com/KBTV4pq2
bigatom-test.ex (some probes developing) http://pastebin.com/L3ePyhEV
if useful, use it.
Edit: in bigatom.e ba_idivide() function is exported only for tests, or should move ba_trunc() calls out of if sentence.
if not bigatom(A) then A = ba_trunc(ba_new(A)) end if if not bigatom(B) then B = ba_trunc(ba_new(B)) end if -- to if not bigatom(A) then A = ba_new(A) end if if not bigatom(B) then B = ba_new(B) end if { A , B } = { ba_trunc(A) , ba_trunc(B) }
8. Re: Traducir bigatom.e al inglés - Yo no sé
- Posted by cargoan Dec 20, 2014
- 2007 views
"This is an English-speaking forum"
I know, but I think worth it. I think it might interest some people.
I'm sorry if I upset, delete it.
Greetings.
This is a Euphoria forum. Everyone is welcome.
It is great if you post even if you do not understand English!
So, once again. Welcome!
_tom
Muchísimas gracias. Lamento no saber inglés y poder contribuir en algo más.
cargoan
Thank you. I regret not know English and be able to contribute something more.
cargoan
9. Re: Traducir bigatom.e al inglés - Yo no sé
- Posted by cargoan Dec 20, 2014
- 1984 views
removing old code from bigatom.e, accidentally i removed in ba_new function and rested one incorrect, must be:
... -- elsif find(c, ".0123456789eE") then -- change these line elsif find(c, ".0123456789") then -- to this pos += 1 number[pos] = c -- add these lines -- ----------------------------------- elsif find(c, "eE") then pos += 1 number[pos] = c sflag = 0 -- ----------------------------------- elsif c = SPACE or c = UNDERLINE then continue else exit end if
10. Re: Traducir bigatom.e al inglés - Yo no sé
- Posted by cargoan Dec 21, 2014
- 1956 views
I wrote bigatom just to do this:
... scale(6, 0) sequence ba_num = ba_divide(numero, tipo[UDIVISOR]) ba_num = ba_round(ba_num, nfracs, round) snum = ba_sprintf("%.6aB", ba_num) ...
for a function that writes numbers in words, with units and fraction names, singular, plural, genre, accents, variable fractions number, conversions, etc. (in spanish). On numbers up to 10 ^ 606 and 6 decimal places in the short scale, long scale or long scale with milliards. Limit is for names, although many multiples as invented, up to 999999 centillions).
If any user interested, say so here and we will send you an archive (includes bigatom.e and others).
And of course, once you start...
I am glad that I was useful, even one only.
Regards.
11. Re: Traducir bigatom.e al inglés - Yo no sé
- Posted by cargoan Dec 21, 2014
- 1938 views
... for a function that writes numbers in words, with units and fraction names, singular, plural, genre, accents, variable fractions number, conversions, etc. (in spanish). On numbers up to 10 ^ 606 and 6 decimal places in the short scale, long scale or long scale with milliards. Limit is for names, although many multiples as invented, up to 999999 centillions). ...
An output example, for interested people, at: http://pastebin.com/k944N7Zz