Skip to content

Instantly share code, notes, and snippets.

View yungyuc's full-sized avatar

Yung-Yu Chen yungyuc

View GitHub Profile
@yungyuc
yungyuc / realnum.cpp
Last active December 22, 2020 13:39
Round-off error
#include <iostream>
#include <iomanip>
#include <cmath>
int main(int argc, char ** argv)
{
double sum = 0.1;
std::cout << "sum = " << std::setprecision(20) << sum << std::endl;
double a = std::sin(2.71828);
@yungyuc
yungyuc / test_linear_scalar.py.diff
Created December 9, 2020 10:47
git diff master..error_analysis
diff --git a/spacetime/tests/test_linear_scalar.py b/spacetime/tests/test_linear_scalar.py
index f327a06..381822f 100644
--- a/spacetime/tests/test_linear_scalar.py
+++ b/spacetime/tests/test_linear_scalar.py
@@ -7,20 +7,20 @@ import numpy as np
import libst
+import math

Keybase proof

I hereby claim:

  • I am yungyuc on github.
  • I am yungyuc (https://keybase.io/yungyuc) on keybase.
  • I have a public key ASD9BJRoo_SmEN1IqFlHsAd5EuTwQM_tmk5IstUs_qoLZAo

To claim this, I am signing this object:

#include <stdio.h>
#include <vector>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/weak_ptr.hpp>
class Base
: boost::noncopyable
From 1d94bb0a17b20ded2b7db695db88510dc16ac4a7 Mon Sep 17 00:00:00 2001
From: "Taihsiang Ho (tai271828)" <tai271828@gmail.com>
Date: Sun, 24 Jul 2016 23:10:19 +0800
Subject: [PATCH] used for debug thread
---
solvcon/case_legacy.py | 4 ++--
solvcon/rpc.py | 14 ++++++++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
#include <boost/python.hpp>
#include <boost/python/module.hpp>
int foo() { return 1; }
int bar() { return 0; }
int work(bool selector) {
if (selector) { return foo(); }
else { return bar(); }
}
using namespace boost::python;
BOOST_PYTHON_MODULE(bpyway) {
#include <pybind11/pybind11.h>
int foo() { return 1; }
int bar() { return 0; }
namespace py = pybind11;
PYBIND11_PLUGIN(pybway) {
py::module m("pybway", "test module");
m.def("work", [](bool selector) {
if (selector) { return foo(); }
else { return bar(); }
});