-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
101 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
*/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ | |
\begin{document} | ||
\frontmatter | ||
\pagestyle{empty} | ||
\title{TomsFastMath User Manual \\ v0.13.0} | ||
\title{TomsFastMath User Manual \\ v0.13.1} | ||
\author{Tom St Denis \\ [email protected]} | ||
\maketitle | ||
This text and library are all hereby placed in the public domain. This book has been formatted for B5 | ||
|
@@ -279,6 +279,21 @@ \subsection{Initialize Copy} | |
This will initialize $a$ as a copy of $b$. Note that for compatibility with LibTomMath the function | ||
fp\_copy() is also provided. | ||
|
||
\subsection{Initialization with a random value} | ||
To initialize an integer with a random value of a specific length use the fp\_rand() function. | ||
|
||
\index{fp\_rand} | ||
\begin{verbatim} | ||
void fp_rand(fp_int *a, int digits) | ||
\end{verbatim} | ||
|
||
This will initialize $a$ with $digits$ random digits. | ||
|
||
\index{FP\_GEN\_RANDOM} \index{FP\_GEN\_RANDOM\_MAX} | ||
The source of the random data is \textbf{arc4random()} on *BSD systems that provide this function | ||
and the standard C function \textbf{rand()} on all other systems. It can be configured at compile time | ||
by pre-defining \textbf{FP\_GEN\_RANDOM} and \textbf{FP\_GEN\_RANDOM\_MAX}. | ||
|
||
\chapter{Arithmetic Operations} | ||
\section{Odds and Evens} | ||
To quickly and easily tell if an integer is zero, odd or even use the following functions. | ||
|