Skip to content

Instantly share code, notes, and snippets.

@tkamishima
Last active May 13, 2021 09:01
Show Gist options
  • Save tkamishima/821031f3ce2e6634a08b7d6eb20354be to your computer and use it in GitHub Desktop.
Save tkamishima/821031f3ce2e6634a08b7d6eb20354be to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0.0025]\n",
"[0.0025000000000000005]\n"
]
}
],
"source": [
"a = np.empty(1, dtype=np.float64)\n",
"a[:] = 0.05 ** 2\n",
"np.set_printoptions(precision=8) # default\n",
"print(a)\n",
"np.set_printoptions(precision=30)\n",
"print(a)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:py3k]",
"language": "python",
"name": "conda-env-py3k-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment