Loading...
Searching...
No Matches
utils.cpp File Reference

Implementation of the utils. More...

`#include "utils.hpp"`

## Functions

std::string | scientific_format (double d, int width, int prec)
| Turns a double into a string written in scientific format.
std::string | scientific_format (const std::vector< double > &v, int width, int prec)
| Turns a vector of doubles into a string written in scientific format.

## Detailed Description

Implementation of the utils.

Author
  Cory Alexander Balaton (coryab)
  Janita Ovidie Sandtrøen Willumsen (janitaws)

Bug:
  No known bugs

## Function Documentation

## scientific_format() [1/2]

std::string scientific_format | ( | const std::vector< double > & | v,
|  | int | width = `20`,
|  | int | prec = `10`
| ) |  |

Turns a vector of doubles into a string written in scientific format.

Parameters

  v | The vector to stringify
  width | The reserved width of the string
  prec | The precision of the stringified number

Returns
  String

## scientific_format() [2/2]

std::string scientific_format | ( | double | d,
|  | int | width = `20`,
|  | int | prec = `10`
| ) |  |

Turns a double into a string written in scientific format.

Code stolen from https://github.com/anderkve/FYS3150 Header: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/include/utils.hpp Source: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/src/utils.cpp

Parameters

  d | The number to stringify
  width | The reserved width of the string
  prec | The precision of the stringified number

Returns
  String