Skip to content

Instantly share code, notes, and snippets.

import math
def reinv_ldexp(x, n):
b = 2 if n >= 0 else 1 / 2
n *= -1 if n < 0 else 1
a = int(n)
while a > 0:
if bool(a & 1):
x *= b
b *= b
#! /usr/env/bin python
# -*- coding;utf-8 -*-
import sys
class Parser():
def __init__(self):
self.s = ""
self.ptr = 0
self.mem = [ 0 for x in range(0, 100) ]
@akahana-1
akahana-1 / calc.pas
Created December 15, 2012 14:18
授業で作成した多倍長整数(30桁)を計算する電卓
program calc(input,output);
const DIGIT = 30;
type ary = array[0..DIGIT-1] of integer;
var a,b,c:ary; op:char;
procedure InputNum(var a:ary);
var ch:char;
i:integer;
begin
for i := 0 to DIGIT-1 do
begin;