jhs / bigdecimal.js Goto Github PK
View Code? Open in Web Editor NEWJavascript BigDecimal data type for arbitrary precision real numbers
Javascript BigDecimal data type for arbitrary precision real numbers
Hi.
Tried this with master and v0.5 on Windows (7, 64bit), + Cygwin, Cygwin's bin directory is on the PATH.
rake fails
C:\work\bigdecimal_js>rake
(in C:/work/bigdecimal_js)
ant build
C:\work\bigdecimal_js\GwtApp>/*
'/*' is not recognized as an internal or external command,
operable program or batch file.
C:\work\bigdecimal_js\GwtApp>Licensed to the Apache Software Foundation (ASF) under one or more
'Licensed' is not recognized as an internal or external command,
operable program or batch file.
C:\work\bigdecimal_js\GwtApp>contributor license agreements. See the NOTICE file distributed with
'contributor' is not recognized as an internal or external command,
operable program or batch file.
C:\work\bigdecimal_js\GwtApp>this work for additional information regarding copyright ownership.
'this' is not recognized as an internal or external command,
operable program or batch file.
C:\work\bigdecimal_js\GwtApp>The ASF licenses this file to You under the Apache
License, Version 2.0
'The' is not recognized as an internal or external command,
operable program or batch file.
you was unexpected at this time.
C:\work\bigdecimal_js\GwtApp> (the "License"); you may not use this file except in compliance with
rake aborted!
Command failed with status (255): [ant build...]
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:993:in `block in sh'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:1008:in `call'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:1008:in `sh'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:1092:in `sh'
C:/work/bigdecimal_js/Rakefile:28:in `block (2 levels) in <top (required)>'
C:/work/bigdecimal_js/Rakefile:27:in `chdir'
C:/work/bigdecimal_js/Rakefile:27:in `block in <top (required)>'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:632:in `call'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:632:in `block in execute'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:629:in `each'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:629:in `execute'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
c:/bin/ruby/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:602:in `each'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain'
c:/bin/ruby/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:602:in `each'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain'
c:/bin/ruby/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:581:in `invoke'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:2019:in `each'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
c:/bin/ruby/lib/ruby/1.9.1/rake.rb:1992:in `run'
c:/bin/ruby/bin/rake:31:in `<main>'
Separately from that Ant build fails:
C:\work\bigdecimal_js\GwtApp>ant
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
Buildfile: C:\work\bigdecimal_js\GwtApp\build.xml
libs:
BUILD FAILED
C:\work\bigdecimal_js\GwtApp\build.xml:19: Warning: Could not find file C:\work\bigdecimal_js\gwt-2.1.0\gwt-servlet.jar to copy.
Total time: 0 seconds
I'd say to make this easy on users, might be better to remove /build from .gitignore and keep a fresh copy of bigdecimal.js in there and both, master and release branches/tags. This way ppl like me would not bug you often. :)
using your instructions:
paul@paul-rt7-desktop:~/bigdecimal.js$ rake
(in /home/paul/bigdecimal.js)
ant build
Buildfile: /home/paul/bigdecimal.js/GwtApp/build.xml
libs:
BUILD FAILED
/home/paul/bigdecimal.js/GwtApp/build.xml:19: Warning: Could not find file /home/paul/bigdecimal.js/gwt-2.1.0/gwt-servlet.jar to copy.
Total time: 0 seconds
rake aborted!
Command failed with status (1): [ant build...]
i'm not sure what "vX.Y tag" means, or how i'm supposed to compile this code. could you link me to a guide, or post command line install instructions in the readme. thank you.
also, even better would be to include a compiled bigDecimal.js/min.js in the git.
In the first couple statements of the built javascript file, please prefix window and document with var to not create global variables in my node app :)
Also, I'm not sure if you have any control over this, but the "ro" function breaks if Array's prototype is extended. The for in loop will iterate the extra prototype items, which basically makes it so you can't instantiate any BigDecimals or BigIntegers. A normal i++ for loop gets around the problem (hasOwnProperty would also work, etc. etc.).
Thanks,
Chris
please. pretty please.
Hi
I wanted to make sure. Awesome work :).
I've been trying to build the project with all kinds of combinations as I'm trying to build a slim version with only the biginteger class in it for the https://github.com/christkv/node-pure-crypto project I'm working on so I can get rsa working correctly.
I tried ruby 1.8.6, 1.8.7, 1.9.1, 1.9.2 with rake 0.8.3, 0.8.7, 0.9.0, 0.9.2. also with gwt-2.1.0.
No luck.
Any idea what I can try ? The error I get is
ant build
Buildfile: /Users/christian.kvalheim/coding/checkouts/bigdecimal.js/GwtApp/build.xml
libs:
javac:
[javac] /Users/christian.kvalheim/coding/checkouts/bigdecimal.js/GwtApp/build.xml:28: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 8 source files to /Users/christian.kvalheim/coding/checkouts/bigdecimal.js/GwtApp/war/WEB-INF/classes
[javac] /Users/christian.kvalheim/coding/checkouts/bigdecimal.js/GwtApp/src/io/couch/gwtapp/client/BigInteger.java:25: 'else' without 'if'
[javac] else if(sig == "string")
[javac] ^
[javac] 1 error
To implement the 'Miller–Rabin primality test' I need to be able to select a random integer from 1 to n. If my n is a BigInteger, I can't just do
n.multiply(Math.random())
Do you have another way to pick a random number from 1 to n?
you've got some unsafe loops in your code that break things when the array prototype is extended.
Please consider using .forEach
or .hasOwnProperty()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.